yahboom
HomeLearn
Solution
Blog
Online Store
About Us
EN/中文
ROS Robot Expansion Board📖
1.Expansion board STM32 driver
  • 0. Precautions
  • 1.1 Expansion Board Introduction_V3.0
  • 1.1 Expansion Board Introduction_V1.0
  • 1.2 STM32 Development environment
  • 1.3 Button to control the buzzer to whistle
  • 1.4 FreeRTOS application
  • 1.5 Serial communication
  • 1.6 SBUS model aircraft remote control
  • 1.7 CAN bus communication
  • 1.8 RGB colorful light bar
  • 1.9 Timer interrupt to control PWM servo
  • 1.10 Control serial port servos
  • 1.11 Nine-axis attitude sensor to obtain data
  • 1.12 Control the forward and reverse rotation of the motor
  • 1.13 The timer captures the encoder data
  • 1.14.1 Robot kinematics analysis theory
  • 1.14.2 Mecanum wheel kinematics analysis
  • 1.15 PID control robot movement
  • 1.16 OLED character display
2.Python basic control
  • 2.0 Bind PCB port devices
  • 2.1 Update the firmware of the expansion board
  • 2.2 Turn off the self-starting large program at startup
  • 2.3 Install the Rosmaster driver library
  • 2.4 Buzzer whistle
  • 2.5 Control PWM servo
  • 2.6 RGB colorful light bar special effects display
  • 2.7 Control the forward and reverse rotation of the motor
  • 2.8 Control the movement of the robot
  • 2.9 Control Serial Servo
3.ROS1 Basic Course
  • 1.ROS introduction
  • 2.ROS installation
  • 3.ROS common command tools
  • 4.ROS workspace
  • 5.ROS function package
  • 6.ROS node
  • 7.ROS topic publisher
  • 8.ROS topic subscribers
  • 9.ROS service client
  • 10.ROS service server
  • 11.ROS action client
  • 12.ROS action server
  • 13.ROS custom message reception
  • 14.ROS-launch file
  • 15.ROS-TF transformation
  • 16.ROS parameter service
  • 17.ROS-rviz use
  • 18.ROS-rqt tool usage
  • 19.Topic message recording and playback
  • 20.urdf model introduction
  • 21.gazebo introduction
  • 22.ROS distributed communication
4.ROS1 robot control
  • 0. Bind PCB port devices
  • 1. Package Use the tutorial
  • 2. Package Description
  • 3. Robot keyboard control
  • 4. Robot state estimation
  • 5. Robot imu calibration
  • 6. Robot URDF Model
5.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
6.ROS2 robot control
  • 0. Bind PCB port devices
  • 1. Package Use the tutorial
  • 2. Robot information release
  • 3. Robot keyboard control
  • 4. Robot state estimation
  • 5. Robot calibration
  • 6. URDF model
7.RDK X3 course
  • 1. Update the firmware of the expansion board
  • 2. Turn off the self-starting large program at startup
  • 3. Install the Rosmaster driver library
  • 4. Buzzer whistle
  • 5. Control PWM servo
  • 6. RGB colorful light bar special effects
  • 7. Control motor forward reverse
  • 8. Control robot movement
  • 9. Control Serial Servo
Download
  • Rules_File
  • Hardware Info
  • Code
  • 3D Model File
  • RDK Code
  • ROS2_Basic_VM
Download ZIP

Welcome to ROS Robot Expansion Board repository

16.ROS parameter service

16.ROS parameter service

The parameter server is where the node stores parameters. You can modify the parameters to achieve the function of debugging the program. In the ros system, the tool for parameter servers is rosparam. This lesson explains how to use the rosparam command.

image-20231025092917164

Among them, parameter represents the actual parameter, and file represents the actual file.

16.1 rosparam list

This command is used to list all the parameters in the parameter server of the currently running ros node. For example, we run the node of the little turtle, and then use this command to see what parameters there are and run the terminal.

roslaunch learn_launch turtle_node.launch

After running successfully, enter rosparam list in another terminal to query the parameters.

xxxxxxxxxx
rosparam list

image-20231025093437965

16.2 rosparam get [parameter]

This command is to get the parameter value of a certain parameter. You can query it by typing rosparam get on the terminal. Then use the little turtle program above to query the value of /turtle/background_b. Enter the terminal.

xxxxxxxxxx
rosparam get /turtle/background_b

image-20231025094105447

16.3 rosparam set [parameter] [value]

This command is to set the parameter value of a certain parameter. You can set the parameter value by typing rosparam set in the terminal. Then follow the little turtle program above and set /turtle/background_b to 0 to see the effect. Terminal input,

xxxxxxxxxx
rosparam set /turtle/background_b 0

It is found that the background of the little turtle has not changed after input. That is because this parameter does not support dynamic adjustment. We can use the above command rosparam get to obtain it again and enter it in the terminal.

xxxxxxxxxx
rosparam get /turtle/background_b

image-20231025095546843

As shown in the figure above, the query found that the parameter value of /turtle/background_b has been changed to 0.

16.4 rosparam delete [parameter]

This command is used to delete a certain parameter. Enter rosparam delete parameter to be deleted in the terminal to delete the parameter. Then use the little turtle program above to delete the /turtle/background_b parameter and enter in the terminal.

xxxxxxxxxx
rosparam delete /turtle/background_b

Then, enter rosparam list to check whether there is still /turtle/background_b after deletion.

xxxxxxxxxx
rosparam list

image-20231025101353141

The query revealed that the /turtle/background_b parameter no longer exists.

16.5 rosparam dump [file]

This command is used to export all parameter values of the current ros parameter service table and save them to a file. Enter rosparam dump save parameter file in the terminal to export to the specified file.Then use the little turtle program above to export the parameters to turtle.yaml in the terminal directory and input it into the terminal.

xxxxxxxxxx
rosparam dump turtle.yaml

In the terminal directory, you can see a turtle.yaml file. Double-click it to open it, as shown in the figure below.

image-20231025102051522

16.6 rosparam load [file]

This command can load the parameter table file to the parameter server to realize the function of modifying multiple parameters at the same time. Enter rosparam load parameter table file name in the terminal,We have just exported a turtle.yaml parameter table, copy and modify the contents, name it turtle_changed.yaml, and change the background_g and background_r values in it to 0 and 255.

​x
rosdistro: 'noetic

  '
roslaunch:
  uris:
    host_localhost__35295: http://localhost:35295/
rosversion: '1.16.0

  '
run_id: 7e98ba4a-72d6-11ee-b168-f15ddb9cdb6a
turtle:
  background_g: 0
  background_r: 255

Exit after saving, then open the terminal in the directory where the parameter table file is located and enter,

xxxxxxxxxx
rosparam load turtle_changed.yaml

Then, we enter the parameter query command to query the values of background_g and background_r,

xxxxxxxxxx
rosparam get /turtle/background_g
rosparam get /turtle/background_r

image-20231025103201903

From the query, we found that the values set in our parameter table are indeed consistent.

16.7 Launch file loading param

We mentioned the concept of param parameters in the course [14. ros-launch file]. In the launch file, you can also pass in this yaml to set parameters. Generally, we will create a new param folder under the launch folder to store the parameter table file, so we create a folder under the learn_launch folder and name it param.

xxxxxxxxxx
cd ~/ros_ws/src/learn_launch
mkdir param

Then, in the param folder, create a new file named background_rgb.yaml, which is used to set the background board of the little turtle. Copy the following content to background_rgb.yaml,

xxxxxxxxxx
background_b: 0
background_g: 100
background_r: 255

Pay attention to the colon: there is a space after it. The background_b, background_g, and background_r here correspond to the parameters of the little turtle. Save and exit. Create a new launch file in the launch folder and name it turtle_param_set.launch. Copy the following content into it. ,

xxxxxxxxxx
<launch>
    <node pkg="turtlesim" type="turtlesim_node" name="turtle">
        <rosparam file="$(find learn_launch)/param/background_rgb.yaml" command="load"/>
    </node>  
</launch>

Enter the following command in the terminal to run the launch file:

xxxxxxxxxx
roslaunch learn_launch turtle_param_set.launch

image-20231025112438988

After successful operation, as shown in the picture above, the terminal will also print out the values of background_b, background_g, and background_r, which are consistent with those in the parameter table, indicating that the loading is successful, and the background of the little turtle has also been changed from the default blue to the color shown in the picture . In the launch file, the code for loading the parameter table is as follows:

xxxxxxxxxx
<rosparam file="$(find pkg_name)/param/file_name.yaml" command="load"/>

Among them, pkg_name is the name of the function package, file_name.yaml represents the name of the parameter table file, and the default parameter table file is placed in the param folder under the function package folder. Combined with the cases, the corresponding result is,

xxxxxxxxxx
<rosparam file="$(find learn_launch)/param/background_rgb.yaml" command="load"/>

 

ROS-TF transformation
ROS-rviz use

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/中文