ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

MosheS's profile - activity

2018-07-05 16:56:49 -0500 received badge  Famous Question (source)
2018-07-05 16:56:49 -0500 received badge  Notable Question (source)
2016-01-19 08:31:22 -0500 received badge  Famous Question (source)
2015-03-25 13:15:30 -0500 received badge  Popular Question (source)
2014-09-30 02:48:25 -0500 received badge  Enthusiast
2014-09-28 06:11:14 -0500 received badge  Supporter (source)
2014-09-25 02:59:54 -0500 received badge  Notable Question (source)
2014-09-24 12:25:07 -0500 received badge  Popular Question (source)
2014-09-24 03:23:24 -0500 asked a question 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,

2014-09-09 00:21:41 -0500 received badge  Scholar (source)
2014-09-09 00:21:40 -0500 commented answer simple proximity sensor msg

Well, I guess that this is what I should do then. I thought that maybe I'm missing something. Thanks,