ros2 launch - how to send a ROS msg type as parameter
Hello,
I am working on a ROS msgs recorder and I am not sure how should I set up a launch parameter with given ROS message type.
I tried with something like:
self.declare_parameter(
"msg_type", None, descriptor=ParameterDescriptor(dynamic_typing=True)
)
self.declare_parameter(
"source_topic", None, descriptor=ParameterDescriptor(dynamic_typing=True)
)
and
start_string_recorder = Node(
package="bag_recorder",
executable="string_msg_recorder",
name="string_msg_recorder",
namespace=namespace,
output="screen",
parameters=[
{
"msg_type": "String",
"source_topic": "/chatter",
}
],
)
But the resulting rosbag2 is empty and there is a problem with ros2 topic echo /chatter
too:
Cannot echo topic '/chatter', as it contains more than one type: [rcl_interfaces/msg/ParameterValue, std_msgs/msg/String]
What is the best approach to launcher with this kind of needs (e.g. one of the parameters should be arguments is a ROS message type)?