The Parameters Server is an essential component of the Robot Operating System (ROS) that allows nodes to read and write parameters. Parameters can be used to configure the behavior of a node or the entire system.
Basic Usage
- Parameters: Parameters are key-value pairs that can be set at runtime or at startup.
- Accessing Parameters: Nodes can access parameters using the
get_param
andset_param
functions. - Types of Parameters: Parameters can be of different types such as strings, integers, booleans, and more.
Example
#include <ros/ros.h>
int main(int argc, char **argv)
{
ros::init(argc, argv, "parameters_node");
// Set a parameter
ros::param::set("robot_name", "ROSbot");
// Get a parameter
std::string robot_name;
ros::param::get("robot_name", robot_name);
ROS_INFO("The robot's name is %s", robot_name.c_str());
return 0;
}
More Information
For more detailed tutorials and examples, visit our ROS Tutorials page.
ROS Tutorials
ROS Parameters