The mobile chassis needs to be driven by a program to achieve the navigation of Limo. The chassis driver of Limo has the C++ version and the Python version. Both two versions can control the movement of the Limo.
The folder where the C++ version of the driver is located is ~/agilex_ws/src/limo_ros/limo_base
, which can be accessed by the following command.
cd agilex_ws/src/limo_ros/limo_base
The following is the file list of the limo_base package:
├── limo_base
├── CMakeLists.txt
├── include
│ ├── limo_driver.h
│ ├── limo_protocol.h
│ └── serial_port.h
├── launch
│ └── limo_base.launch
├── msg
│ └── LimoStatus.msg
├── package.xml
└── src
├── limo_base_node.cpp
├── limo_driver.cpp
└── serial_port.cpp
There are four folders under limo_base, namely include, launch, msg, and src. The include folder stores the library files called by the driver; the launch folder stores the startup files of the driver; the msg folder stores the message files needed by the driver; the src folder stores the driver source code.
Folder | Stored files |
---|---|
include | Library files called by the driver |
launch | Startup files of the driver |
msg | Message files needed by the driver |
src | Driver source code |
You can control the forward movement of limo with a simple command.
Note: Before running the command, please make sure that the programs in other terminals have been terminated. The termination command is: Ctrl+c.
roslaunch limo_base limo_base.launch
rostopic pub /cmd_vel geometry_msgs/Twist "linear:
x: 0.2
y: 0.0
z: 0.0
angular:
x: 0.0
y: 0.0
z: 0.0"
<aside> 📙 Note: Copy the entire command to the terminal and enter it, and don’t enter it manually.
</aside>
Functions used in the driver source code:
Name | Function |
---|---|
connect() | Connect the chassis |
readData() | Read the data, and get the information feedback from the chassis |
processRxData() | Receive serial data |
parseFrame() | Process serial data |
sendFrame() | Send serial data |
setMotionCommand() | Set limo’s control mode |
enableCommandedMode() | Enable control mode |
publishOdometry() | Publish odometer data |
publishLimoState() | Publish limo’s state information |
publishIMUData() | Publish IMU data |
processErrorCode() | Error detection |
twistCmdCallback() | Publish speed control data |
normalizeAngle() | Output a normal angle |
degToRad() | Turn the angle to radian |
convertInnerAngleToCentral() | Convert inner angle to central angle |
convertCentralAngleToInner() | Convert central angle to inner angle |
The driver of Limo (Python version) is uploaded to pypi, and it can be downloaded through the pip command. The installation directory of the program is ~/.local/lib/python3.6/site-packages/pylimo. Its file list is: