Welcome to Raspbot V2 repository
当製品の日本語版マニュアル資料は、こちらからご取得ください。
1. Robot information release
Robot information release
1. Program function description
After the car starts the chassis drive, it will publish the data of sensor modules such as ultrasonic and four-way patrol. You can run commands in docker to query this information, and you can also publish the control data of sensors such as speed, buzzer, RGB light bar, etc.
2. Query car information
2.1. Enter the car docker
Open a terminal and enter the following command to enter docker,
./docker_ros2.sh
The following interface appears, indicating that you have successfully entered docker. Now you can control the car through commands.
xxxxxxxxxxros2 launch yahboomcar_bringup bringup.launch.py
Start the chassis drive, as shown in the figure below,

Open a new terminal and enter the same docker. Change the following da8c4f47020a to the ID displayed in the actual terminal.
xxxxxxxxxxdocker ps
xxxxxxxxxxdocker exec -it da8c4f47020a /bin/bash
Enter the following command to query the node,
xxxxxxxxxxros2 node list

Then enter the following command to query which topics the node has published/subscribed to,
xxxxxxxxxxros2 node info /driver_node

It can be seen that the subscribed topics are,
/buzzer: buzzer control
/cmd_vel: car speed control
/rgblight: RGB light bar control
/servo: s1 servo pan/tilt control, s2 servo pan/tilt control
The published topics are,
/ultrasonic: ultrasonic module data
/line_sensor: four-way line patrol module data
We can also query the topic command, terminal input,
xxxxxxxxxxros2 topic list 
2.3. Query topic data
Query ultrasonic data,
xxxxxxxxxxros2 topic echo /ultrasonic 
Query the data of the four-way line patrol module.
xxxxxxxxxxros2 topic echo /line_sensor 
3. Publish car control information
3.1. Control the buzzer
First query the following buzzer topic related information, terminal input,
xxxxxxxxxxros2 topic info /buzzer 
The data type is std_msgs/msg/Bool. Then enter the following command to turn on the buzzer, and enter in the terminal,
xxxxxxxxxxros2 topic pub /buzzer std_msgs/msg/Bool "data: 1" 
Enter the following command to turn off the buzzer, terminal input,
xxxxxxxxxxros2 topic pub /buzzer std_msgs/msg/Bool "data: 0" 
3.2. Release speed control information
We assume that the speed of the car is 0.1 of the linear speed, and the terminal input is,
xxxxxxxxxx#Valid value range#linear: x[-1,1] y[-1,1] z#angular: x y z[-3,3]xxxxxxxxxxros2 topic pub -1 /cmd_vel geometry_msgs/msg/Twist "{linear: {x: 0.1, y: 0.0, z: 0.0}, angular: {x: 0.0, y: 0.0, z: 0.0}}" 
If parking, input
xxxxxxxxxxros2 topic pub -1 /cmd_vel geometry_msgs/msg/Twist "{linear: {x: 0.0, y: 0.0, z: 0.0}, angular: {x: 0.0, y: 0.0, z: 0.0}}"3.3. Control RGB light bar
We assume that the published RGB value is 255,0,0, and the terminal input is
xxxxxxxxxxros2 topic pub -1 /rgblight std_msgs/msg/Int32MultiArray "data: [255, 0, 0]" 
Turn off the light and enter
xxxxxxxxxxros2 topic pub -1 /rgblight std_msgs/msg/Int32MultiArray "data: [0, 0, 0]" 3.4. Control the PTZ Servo
It should be noted that the range of the s1 servo is [0,180], and the range of the s2 servo is [0,110]. If the value exceeds the range, the servo will not rotate.
We assume that the s1 servo is controlled to rotate to 90 degrees and the s2 servo is controlled to rotate to 25 degrees. Then the terminal input is,
xxxxxxxxxxros2 topic pub -1 /servo yahboomcar_msgs/msg/ServoControl "{'servo_s1': 90, 'servo_s2': 25}"3.5. Complete chassis driver
3.5.1. Startup program
xxxxxxxxxxros2 launch yahboomcar_bringup yahboomcar_bringup.launch.py
Start the chassis drive, as shown below.

Enter the following command in the terminal to query the node:
xxxxxxxxxxros2 node list

Enter the following command to view the communication diagram between nodes.
xxxxxxxxxxros2 run rqt_graph rqt_graph

Enter the command to view the relevant information of the node
xxxxxxxxxxros2 node info /driver_node

3.5.2. Parsing launch files
xfrom ament_index_python.packages import get_package_share_path
from launch import LaunchDescriptionfrom launch.actions import DeclareLaunchArgumentfrom launch.conditions import IfCondition, UnlessConditionfrom launch.substitutions import Command, LaunchConfiguration
from launch_ros.actions import Nodefrom launch_ros.parameter_descriptions import ParameterValue
import osfrom ament_index_python.packages import get_package_share_directory
from launch.actions import IncludeLaunchDescriptionfrom launch.launch_description_sources import PythonLaunchDescriptionSource
def generate_launch_description(): # 配置参数
description_launch = IncludeLaunchDescription( PythonLaunchDescriptionSource([os.path.join( get_package_share_directory('yahboomcar_description'), 'launch'), '/description_launch.py']) )
driver_node = Node( package='yahboomcar_bringup', executable='Mcnamu_driver', )
# 返回LaunchDescription对象 return LaunchDescription([ driver_node, description_launch ])
The launch file starts the following nodes:
- driver_node: chassis driver data node;
- description_launch: load URDF model.