diff --git a/prover_rclpy/setup.py b/prover_rclpy/setup.py index 14f6b22..c94e178 100644 --- a/prover_rclpy/setup.py +++ b/prover_rclpy/setup.py @@ -88,6 +88,7 @@ 'ros2cli_862 = src.ros2cli_862:main', 'ros2cli_885 = src.ros2cli_885:main', 'ros2cli_936 = src.ros2cli_936:main', + 'ros2cli_960 = src.ros2cli_960:main', 'rosbag2_1549 = src.rosbag2_1549:main', 'ros2_doc_4132 = src.ros2_doc_4132:main', ], diff --git a/prover_rclpy/src/ros2cli_960.py b/prover_rclpy/src/ros2cli_960.py new file mode 100644 index 0000000..7e28c1c --- /dev/null +++ b/prover_rclpy/src/ros2cli_960.py @@ -0,0 +1,31 @@ +import rclpy +from rclpy.node import Node +from rclpy.parameter import Parameter +from rcl_interfaces.msg import SetParametersResult + + +class MinimalParameterNode(Node): + def __init__(self): + super().__init__('minimal_param_node') + self.log = self.get_logger() + self.declare_parameter('my_parameter', Parameter.Type.STRING) + self.declare_parameter('foobar.my_parameter', Parameter.Type.STRING) + + self.add_on_set_parameters_callback(self.callback) + + def callback(self, parameters): + for p in parameters: + if p.name == 'my_parameter': + self.log.info(f"Got my_parameter: {p.value}") + if p.name == 'foobar.my_parameter': + self.log.info(f"Got foobar.my_parameter: {p.value}") + return SetParametersResult(successful=True) + + +def main(): + rclpy.init() + node = MinimalParameterNode() + rclpy.spin(node) + +if __name__ == '__main__': + main() \ No newline at end of file