The mobile chassis needs to be driven by a program to achieve the navigation of Limo. The chassis driver of Limo only has the C++ version at the moment.

1. Driver file structure

The folder where the chassis driver is located is ~/agilex_ws/src/limo_ros2/limo_base. Enter this folder through the following command.

cd ~/agilex_ws/src/limo_ros2/limo_base

The following is the file list of the limo_base package:

├── CMakeLists.txt
├── include
│   └── limo_base
├── launch
│   ├── limo_base.launch.py
│   ├── open_ydlidar_launch.py
│   └── start_limo.launch.py
├── package.xml
├── scripts
│   └── tf_pub.py
└── src
    ├── limo_base_node.cpp
    ├── limo_driver.cpp
    ├── serial_port.cpp
    └── tf_pub.cpp

The message file used by the chassis driver is located in the folder ~/agilex_ws/src/limo_ros2/limo_msgs. Enter this folder through the following command.

cd ~/agilex_ws/src/limo_ros2/limo_msgs

The following is the file list of the limo_msgs function package.

├── action
│   └── LimoAction.action
├── CMakeLists.txt
├── msg
│   └── LimoStatus.msg
├── package.xml
└── srv
    └── LimoSrv.srv

There are include, launch, src, scripts, action, srv, and msg folders under the two function packages. The library files called by the driver are stored in the include folder; the driver startup files are stored in the launch folder; the Python code is stored in the scripts folder; the action message files are stored in the action folder; and the srv folder stored the server message files; the msg message file is stored in the msg folder; the driver C++ source code is stored in the src folder.

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
scripts Python code
action action message files
srv server message files

2. Msg files

In ROS 2, Msg files (Message files) are used to define custom message types in ROS 2. The Msg file describes the structure and fields of the message, and multiple fields and data types can be defined as needed.

The following is the customized Msg file in Limo called LimoStatus.msg:

std_msgs/Header header

uint8 vehicle_state
uint8 control_mode
float64 battery_voltage
uint16 error_code
uint8 motion_mode

The message file about Limo status is customized here. The meaning of each field is as follows:

  1. std_msgs/Header header: This is a standard message type std_msgs/Header, which contains timestamp and message source information.
  2. uint8 vehicle_state: This is an unsigned 8-bit integer type field used to represent vehicle status.
  3. uint8 control_mode: This is an unsigned 8-bit integer type field used to represent the control mode.