yahboom
HomeLearn
Solution
Blog
Online Store
About Us
EN/中文
PALMSLAM📖
1. Product Introduction
  • 0.Get started
  • 1. Learning route
  • 2. Frequently Questions
  • 3. Control panel introduction
  • 4. Introduction to LiDAR
  • 5. Robot charging and battery considerations
  • 6.Unboxing and reviewing
2. Assembly video
  • Installation Video
3. Basic configuration
  • 0. Get started quickly
  • 1. Write the firmware
  • 2. Virtual machine installation and startup system
  • 3. Expansion board configuration parameters
  • 4. How to choose the alarm level and radar model
  • 5. Connection Agent
4. LiDAR course
  • 0. Enter the same docker terminal
  • 1. Robot information release
  • 2. Robot URDF model
  • 3. Basic distance measurement function
  • 4. SLAM Gmapping
  • 5. SLAM Cartographer
  • 6. APP mapping
5. Linux operating system
  • 1.Introduction to Linux system
  • 2.Ubuntu file system
  • 3.Ubuntu common commands
  • 4.Ubuntu common editors
  • 5.Ubuntu software operation commands
  • 6.Virtual machine installation
  • 7.SSH remote control
  • 8.VNC remote control
  • 9.Transfer files remotely
  • 10.Driver library and communication
  • 11.Static IP and hotspot mode
  • 12.Bind device ID
  • 13.Capacity expansion and resource allocation
  • 14.Update system software sources
  • 15.Set root user password
  • 16.sudo free password
  • 17.Connect to WiFi network
  • 18.View system version
  • 19.Customized service management
  • 20.Back up system image
6. 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
Download
  • System_File
  • VM_File
  • Code
  • Software_Tool
  • Hareware_Info
  • 3D_Model_File
  • Instruction_Manual
  • ROS2_Basic_VM
Download ZIP

Welcome to PALMSLAM repository

11.ROS2 parameter service case

11.ROS2 parameter service case

11. ROS2 parameter service case

1. Introduction to parameters

Similar to global variables in C++ programming, they facilitate sharing data across multiple programs. Parameters are global dictionaries in the ROS robot system, allowing data to be shared across multiple nodes.

In the ROS system, parameters exist in the form of a global dictionary. What is a dictionary? Just like a real dictionary, they consist of a name and a value, also known as a key and a value. Alternatively, we can think of them as being like parameters in programming: there's a parameter name, followed by an equals sign, and then the parameter value. To use it, you simply access the parameter name.

Parameters have a rich set of features. For example, if a node shares a parameter, other nodes can access it. If a node modifies a parameter, other nodes can immediately be notified and obtain the latest value.

2. Parameters in the Little Turtle Example

In the Little Turtle example, the emulator provides a number of parameters. Let's use this example to familiarize ourselves with the meaning of parameters and command line usage.

Since a GUI is displayed here, the following examples are demonstrated in the virtual machine that comes with the tutorial for ease of operation.

  1. Launch two terminals in the virtual machine, running the turtle simulator and the keyboard control node respectively:
xxxxxxxxxx
ros2 run turtlesim turtlesim_node
ros2 run turtlesim turtle_teleop_key

image-20231030182608893

  1. Launch a terminal in the virtual machine and use the following command to view the parameter list:
xxxxxxxxxx
ros2 param list

image-20231030182640039

  1. Querying and Modifying Parameters

To query or modify the value of a parameter, follow the param command with a get or set subcommand:

xxxxxxxxxx
ros2 param describe turtlesim background_b # View the description of a parameter
ros2 param get turtlesim background_b # Query the value of a parameter
ros2 param set turtlesim background_b 10 # Modify the value of a parameter
  1. Saving and Loading Parameter Files

Querying/modifying parameters one by one is too cumbersome. Why not try using a parameter file? Parameter files in ROS use the YAML format. You can follow the param command with the dump subcommand to save all the parameters for a node to a file, or use the load command to load all the contents of a parameter file at once:

xxxxxxxxxx
ros2 param dump turtlesim >> turtlesim.yaml # Save the parameters of a node to a parameter file
ros2 param load turtlesim turtlesim.yaml # Load all parameters from a file at once

3. Parameter Examples

3.1. Creating a New Function Package

  • Create a new function package in the src directory of the workspace
xxxxxxxxxx
ros2 pkg create pkg_param --build-type ament_python --dependencies rclpy --node-name param_demo

After executing the above command, the pkg_param package will be created, a param_demo node will be created, and the relevant configuration files will be configured.

image-20231030185328553

3.2 Code Implementation

Next, edit [param_demo.py] to implement the publisher functionality and add the following code:

ROS2 custom interface message
ROS2 meta-function package

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