Skip to content

Commit

Permalink
bugs in load_parameter_file
Browse files Browse the repository at this point in the history
  ros2/ros2cli#960

Signed-off-by: Tomoya Fujita <[email protected]>
  • Loading branch information
fujitatomoya committed Jan 13, 2025
1 parent 3fd8495 commit b1ab77c
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
1 change: 1 addition & 0 deletions prover_rclpy/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
],
Expand Down
31 changes: 31 additions & 0 deletions prover_rclpy/src/ros2cli_960.py
Original file line number Diff line number Diff line change
@@ -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()

0 comments on commit b1ab77c

Please sign in to comment.