yahboom
HomeLearn
Solution
Blog
Online Store
About Us
EN/中文
RDK X5 Robot📖
01. RDK-X5-Robot Introduction
  • 1.Introduction
  • 2.Common Problem Analysis
  • 3.Battery and charger usage precautions
  • 4.TF card expand capacity
02. Assembly Tutorial
  • Assembly Tutorial
  • Assembly Video-1
  • Assembly Video-2
  • Assembly Video-3
  • Assembly Video-4
03. Remote Control Course
  • 1.Mobile APP remote control
  • 2.USB Wireless Controller Remote Control
04. ROS Driver Board Course
  • 1. Introduction of extension board
  • 2. Set up STM32 development environment
  • 3. Key control buzzer sound
  • 4. FreeRTOS application
  • 5. Serial communication
  • 6. SBUS model remote control
  • 7. CAN bus communication
  • 8. RGB color light strip
  • 9. Timer interrupt control PWM servo
  • 10. Control serial steering gear
  • 11. Nine-axis attitude sensor to obtain data
  • 12. Control motor forward and reverse
  • 13. The timer captures encoder data
  • 14. Theory of robot kinematics analysis
  • 15. PID control robot motion
05. Basic Control Course
  • 1.Update expansion board firmware
  • 2.Install Python driver library
  • 3.Set the car type
  • 4.Open and close APP program control
  • 5.Turn hotspot mode on and off
  • 6.Buzzer sound
  • 7.Control the motor to rotate forward and reverse
  • 8.Controlling robot movement
  • 9.OLED display
  • 10.Control fans and lighting effects
06. Development Environment
  • 1. Virtual machine installation and use
  • 2. Linux Basics
  • 3. Remote connection
  • 4. Multi-machine communication configuration
  • 5. Bind device ID
  • 6. Image installation and backup
07. ROS2 Basic Course
  • 1. Introduction to ROS2
  • 2. ROS2 install Humble
  • 3. ROS2 development environment
  • 4. ROS2 workspace
  • 5. ROS2 function package
  • 6. ROS2 node
  • 7. ROS2 topic communication
  • 8. ROS2 service communication
  • 9. ROS2 action communication
  • 10. ROS2 custom interface message
  • 11. ROS2 parameter service case
  • 12. ROS2 meta-function package
  • 13. ROS2 distributed communication
  • 14. ROS2 DDS
  • 15. ROS2 time related API
  • 16. ROS2 common command tools
  • 17. ROS2 rviz2 use
  • 18. ROS2 rqt toolbox
  • 19. ROS2 Launch startup file configuration
  • 20. ROS2 recording and playback tool
  • 21. ROS2 URDF model
  • 22. ROS2 Gazebo simulation platform
  • 23. ROS2 TF2 coordinate transformation
08. Robot Chassis Control Course
  • 1. PID algorithm theory
  • 2. Robot information release
  • 3. Robot control
  • 4. Robot state estimation
  • 5. Robot calibration
  • 6. Robot trajectory tracking
  • 7. URDF Model
09. LiDAR Course
  • 1. Introduction and use of lidar
  • 2. Lidar obstacle avoidance
  • 3. Lidar tracking
  • 4. Lidar guard
  • 5. Lidar patrol
  • 6. gmapping mapping algorithm
  • 7. Cartographer mapping algorithm
  • 8. Navigation and obstacle avoidance
  • 9. App Mapping and Navigation
10. OpenCV Course
  • 1. Getting started with OpenCV
  • 2. OpenCV geometric transformation
  • 3. OpenCV Image Processing
  • 4. OpenCV image beautification
  • 5. QR code creation and recognition
11. Mipi Camera Course
  • 1. Camera driver
  • 2. Adjust the color HSV value
  • 3. Color recognition
  • 4. Color Tracking
  • 5. Color Follow
  • 6. QR code instructions
  • 7. Face Detection
  • 8. Object Detection
  • 9. Visual line patrol-OpenCV
  • 10. Visual line patrol-deep learning
  • 11. Human body tracking
  • 12. Gesture control
12. Depth Camera Course
  • 1. Use of Depth Camera
  • 2. Camera intrinsic calibration
  • 3. ROS+OpenCV Basics
  • 4. AR Vision
  • 5. Color Tracking
  • 6. Object Tracking
  • 7. RTAB-Map 3D Mapping Navigation
13. Multi-robot Synchronous Control
  • Multi-vehicle synchronous control
Remote login control
  • 1. VNC and SSH remote login
  • 2. Jupyter lab login and case code running
Download
  • System_File
  • Code
  • VM_File
  • Software_Tools
  • Hardware_Info
  • Firmware
  • Instruction_Manual
  • ROS2_Basic_VM
Download ZIP

Welcome to RDK X5 Robot repository

Multi-vehicle synchronous control

Multi-car synchronous control

1. Multi-car synchronous control

1.1. Program function description

Connect the handle to the virtual machine, set the virtual machine to connect to the handle, and after the program on the virtual machine and the car is started, the joystick of the handle can be used to control the two cars at the same time, and the movements of the two cars are synchronized.

1.2, Program reference path

After SSH connects to the car, the location of the function source code is,

xxxxxxxxxx
/home/sunrise/yahboomcar_ws/src/yahboomcar_multi/launch/yahboomcar_bringup_multi_ctrl.launch.xml

The virtual machine control code is located at,

xxxxxxxxxx
/home/yahboom/yahboomcar_ws/src/yahboomcar_multi/launch/multi_ctrl.launch.xml

1.3, Program startup

Note: Here you need to set up multi-machine communication in advance, that is, the virtual machine and the car (taking two cars as an example) need to be in the same LAN and the ROS_DOMAIN_ID must be the same, in order to be able to perform distributed communication.

Input in the virtual machine terminal,

xxxxxxxxxx
ros2 launch yahboomcar_multi multi_ctrl.launch.xml

After SSH connects to car 1, input in the terminal,

xxxxxxxxxx
ros2 launch yahboomcar_multi yahboomcar_bringup_multi_ctrl.launch.xml robot_name:=robot1

After SSH connects to car 2, input in the terminal,

xxxxxxxxxx
ros2 launch yahboomcar_multi yahboomcar_bringup_multi_ctrl.launch.xml robot_name:=robot2

After the program starts, press L1 to enter control.

1.4. View the node communication graph

Virtual machine terminal input,

xxxxxxxxxx
ros2 run rqt_graph rqt_graph

image-20230720162849385

It can be seen that the virtual machine published the /cmd_vel topic speed, and the chassis of robot1 and robot2 subscribed to the topic, so when the virtual machine publishes the topic data, both cars will receive it and then control the movement of their respective chassis.

1.5、Core code analysis

The code on the virtual machine side is the same as the handle control code on the car side, so I won't go into details here. Let's mainly look at the content on the car side and the startup file yahboomcar_bringup_multi_ctrl.launch.xml,

xxxxxxxxxx
<launch>
<arg name="robot_name" default="robot1"/>
<group>
<push-ros-namespace namespace="$(var robot_name)"/>
<!--driver_node-->
<node name="driver" pkg="yahboomcar_bringup" exec="Mcnamu_driver" output="screen">
<param name="imu_link" value="$(var robot_name)/imu_link"/>
<remap from="cmd_vel" to="/cmd_vel"/>
</node>
<!--base_node-->
<node name="base" pkg="yahboomcar_base_node" exec="base_node" output="screen"> <param name="odom_frame" value="$(var robot_name)/odom"/> <param name="base_footprint_frame" value="$(var robot_name)/base_footprint"/> </node> <!--imu_filter_node--> <node name="imu_filter" pkg="imu_filter_madgwick" exec="imu_filter_madgwick_node" output="screen"> <param name="fixed_frame" value="$(var robot_name)/base_link"/> <param name="use_mag" value="false"/> <param name="publish_tf" value="false"/> <param name="world_frame" value="$(var robot_name)/enu"/> <param name="orientation_stddev" value="0.05"/> </node> <!--ekf_node--> <node name="ekf_filter_node" pkg="robot_localization" exec="ekf_node"> <param name="odom_frame" value="$(var robot_name)/odom"/> <param name="base_link_frame" value="$(var robot_name)/base_footprint"/> <param name="world_frame" value="$(var robot_name)/odom"/> <param from="$(find-pkg-share yahboomcar_multi)/param/ekf_$(var robot_name).yaml"/> <remap from="odometry/filtered" to="odom"/> <remap from="/odom_raw" to="odom_raw"/> </node> </group> <include file="$(find-pkg-share yahboomcar_description)/launch/description_multi_$(var robot_name).launch.py"/>
</launch>

Here we use the XML format to write the launch file, so that we can add namespaces in front of multiple nodes. Adding namespaces is to solve the conflict caused by the same node name. We have two cars here. Take the chassis program as an example. If both chassis nodes are named driver, then after establishing multi-machine communication, this is not allowed. So we add the namespace namespace in front of the node name. In this way, the chassis node name of car 1 is /robot1/driver, and the chassis node program of car 2 is /robot2/driver. In the launch file in XML format, a group group is used to specify that in this group, both the node name and the topic name need to be added with namespace.

xxxxxxxxxx
<group>
<push-ros-namespace namespace="$(var robot_name)"/>
</group>

The parameters defined in the launch file in XML format are $(var robot_name). The parameter passed in here is robot_name. When entering the command, you can enter it in the command line.

xxxxxxxxxx
ros2 launch yahboomcar_multi yahboomcar_bringup_multi_ctrl.launch.xml robot_name:=robot1

One thing to note here is that after adding the namespace, we remap the topic name of /robot1/cmd_vel to /cmd_vel, which is to receive the topic message sent by the virtual machine.

xxxxxxxxxx
<node name="driver" pkg="yahboomcar_bringup" exec="Mcnamu_driver" output="screen">
<param name="imu_link" value="$(var robot_name)/imu_link"/>
<remap from="cmd_vel" to="/cmd_vel"/>
</node>

Regarding the parameter input, plus the namespace, it is necessary to explain it in the launch file, such as the following parameters,

xxxxxxxxxx
<node name="base" pkg="yahboomcar_base_node" exec="base_node" output="screen">
<param name="odom_frame" value="$(var robot_name)/odom"/>
<param name="base_footprint_frame" value="$(var robot_name)/base_footprint"/>
</node>

It can be seen that the odom_frame parameter is assigned to (varrobotname)/odom,thebasefootprintframeparameterisassignedto(var robot_name)/base_footprint.

If some parameters do not need to be added with a namespace, then they are passed in as a parameter table, for example,

xxxxxxxxxx
<param from="$(find-pkg-share yahboomcar_multi)/param/ekf_$(var robot_name).yaml"/>

It should be noted that this parameter table needs to add the namespace to be able to find it accurately. If we start robot1, the node started becomes robot1/ekf_filter_node, so the beginning of the parameter file should be,

xxxxxxxxxx
### ekf config file ###
robot1/ekf_filter_node:
ros__parameters:

View the node list, enter in the virtual machine terminal,

xxxxxxxxxx
ros2 node list

image-20230720163407420

To view the topic list, enter the virtual machine terminal,

xxxxxxxxxx
ros2 topic list

image-20230720163255016

RTAB-Map 3D Mapping Navigation
VNC and SSH remote login

COMPANY

  • About us
  • Team Style
  • Blog

LEARNING & EXPLORATION

  • Tutorials
  • Edge AI hardware
  • Educational robots
  • Embedded intelligent hardware

WHERE TO BUY

  • Yahboom Online Store
  • Amazon
  • Alibaba
  • AliExpress
  • Mercado

TECHNOLOGY SUPPORT

  • Email: support@yahboom.com

BE A DISTRIBUTOR

  • Email: sales@yahboom.com
QR Code

Copyright © 2017-2026 Yahboom. All Rights Reserved.

EN/中文