ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
There's the get_parameter_or
method:
http://docs.ros2.org/bouncy/api/rclcpp/classrclcpp_1_1_node.html#ae5d51004e6e4fc32194251587eb8711a
Which would allow you to do something like this:
int ip_port_;
node->get_parameter_or("ip_port", &ip_port_, 80);
And recently the get_parameter_or_set
which will get it if set, and if not it will set the parameter to the "default" you gave and then return it.
2 | No.2 Revision |
There's the get_parameter_or
method:
http://docs.ros2.org/bouncy/api/rclcpp/classrclcpp_1_1_node.html#ae5d51004e6e4fc32194251587eb8711a
Which would allow you to do something like this:
int ip_port_;
node->get_parameter_or("ip_port", &ip_port_, ip_port_, 80);
And recently the get_parameter_or_set
which will get it if set, and if not it will set the parameter to the "default" you gave and then return it.
Edit: remove &
because it's pass by reference not a pointer.