ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
I don't think the ~
expansion has been implemented, as the parameters exist on the nodes directly, providing just the name of the parameter (without ~
) should be enough.
e.g. params.yaml:
minimal_publisher:
ros__parameters:
some_int: 42
diff on publisher_member_function:
--- a/rclpy/topics/minimal_publisher/examples_rclpy_minimal_publisher/publisher_member_function.py
+++ b/rclpy/topics/minimal_publisher/examples_rclpy_minimal_publisher/publisher_member_function.py
@@ -33,6 +33,9 @@ class MinimalPublisher(Node):
self.publisher_.publish(msg)
self.get_logger().info('Publishing: "%s"' % msg.data)
self.i += 1
+ print()
+ print(self.get_parameter('some_int')._value)
+ print()
def main(args=None):
in terminal:
$ ros2 run examples_rclpy_minimal_publisher publisher_member_function __params:=params.yaml
[INFO] [minimal_publisher]: Publishing: "Hello World: 0"
42
[INFO] [minimal_publisher]: Publishing: "Hello World: 1"
42
HTH,