Welcome to RDK X5 Robot repository
4. Robot state estimation
4. Robot state estimation
4. Robot state estimation4.1. Program function description4.2, Program code reference path4.3, Program startup4.3.1, Start command4.3.2, View the node communication diagram4.4, launch file analysis
4.1. Program function description
After the program runs, it combines the imu data and speed vel data read from the ROS expansion board to output an odom data that integrates imu and odom data. This data can be used when performing positioning functions.
4.2, Program code reference path
After SSH connects to the car, the location of the function source code is,
xxxxxxxxxx/home/sunrise/yahboomcar_ws/src/yahboomcar_bringup/launch/yahboomcar_bringup_launch.pyekf fusion program code reference path,
xxxxxxxxxx/home/sunrise/yahboomcar_ws/src/robot_localization/launch/ekf.launch.py4.3, Program startup
4.3.1, Start command
After SSH connects to the car, enter in the terminal,
xxxxxxxxxxros2 launch yahboomcar_bringup yahboomcar_bringup_launch.py4.3.2, View the node communication diagram
Open the virtual machine terminal and enter,
xxxxxxxxxxros2 run rqt_graph rqt_graph
[Note] Since Xuripi does not provide a graphical desktop environment, all ROS rqt-related operations must be implemented on the PC side (virtual machine side). That is, as long as the communication between the PC side and the car side is normal, you can open the terminal without SSH connection to the car and directly run the relevant instructions.

Mainly look at the node input and output in the red box in the above figure. It can be seen that /ekf_filter_node receives odom_raw data and imu_data data for fusion, and finally outputs and publishes an odom data. We can view it through the ros2 node tool, terminal input,
xxxxxxxxxxros2 node info /ekf_filter_node
4.4, launch file analysis
Let's take a look at the main related nodes of the launch file,
/driver_node: Start the car chassis, obtain the wheel speed vel data, publish it to the /base_node node, obtain imu data, and publish it to the /imu_filter_node node;
/base_node: Receive vel data, convert it into odom_raw data through calculation, and publish it to the /ekf_node node;
/imu_filter_node: Receive the imu data published by the chassis, filter it through its own algorithm, and publish the filtered imu/data data to the /ekf_node node;
/ekf_node: Receive the odom data published by the /base_node node and the imu/data data published by the /imu_filter_node, merge them through its own algorithm, and publish the odom data.