setting a param from the launch file doesn't work with string
Hi,
I'm trying to set a param using the launch file like so:
<node name="right_sensor" pkg="action" type="input_signal" output="screen" >
<param name="port" value="55551" />
<param name="signal_name" value="right" />
</node>
In my code I have this:
string port, signal_name;
ros::NodeHandle private_node_handle_("~");
private_node_handle_.param("signal_name", signal_name, string("signal"));
private_node_handle_.param("port", port, string("55555"));
ROS_INFO("PORT: %s", port.c_str());
ROS_INFO("Signal Name: %s", signal_name.c_str());
It appears that the "port" is not transferred correctly (I get "55555").
Only "signal_name" is correct.
BTW, if I add a letter before the value of the param in port (e.g. "a55551), it will be ok.
Can anyone assist? Is this a bug or a feature?
Thanks,
Did you try setting the type in the launch file with
type="string"
?