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

roslaunch ignoring set parameters for sicktoolbox_wrapper package

asked 2017-11-13 18:21:40 -0600

updated 2017-11-13 18:56:00 -0600

I am setting a few parameters in my launch file. I can verify my parameters have been set correctly based on the terminal output. However, when roslaunch attempts to start the node, it ignores the set parameters. How do I fix this? kindly see below for details.

The parameters are correct and everything works when I use rosrun.

I am using a Lenovo laptop (W530) with Ubuntu 14.04. ROS distribution is Indigo which I installed with apt-get.

the launch file looks like this:

<launch>

<!--define the serial port for the PC to LMS comm in parameter server-->
<param 
    name="sicklms/port" 
    value="/dev/ttyUSB0">
</param>

<!--define the lms comm baud rate in parameter server-->
<param 
    name="sicklms/baud" 
    value="500000">
</param>

<!--launch the sicktoolbox_wrapper node. -->
<node 
    pkg="sicktoolbox_wrapper" 
    type="sicklms" 
    name="sick_lms_scan_publisher"
    output="screen">
</node>
</launch>

The terminal message when I run the roslauch command looks like this:

constructor@constructor-pc:~/Desktop/workspace$ roslaunch j_robot_state_publisher jimmy_state_publisher.launch
... logging to /home/constructor/.ros/log/4d83f6e0-c8c8-11e7-9df6-e09d3128cfa4/roslaunch-constructor-pc-11263.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://constructor-pc:38491/

SUMMARY
========

PARAMETERS
* /robot_description: <?xml version="1....
* /rosdistro: indigo
* /rosversion: 1.11.21
* /sicklms/baud: 500000
* /sicklms/port: /dev/ttyUSB0

NODES
/
jimmy_state_publisher (j_robot_state_publisher/jimmy_state_publisher)
node_publishing_enc_data (j_lms_enc_pos_publisher/publish_lms_enc_pos)
robot_state_publisher (robot_state_publisher/robot_state_publisher)
rviz (rviz/rviz)
sick_lms_scan_publisher (sicktoolbox_wrapper/sicklms)

ROS_MASTER_URI=http://localhost:11311

core service [/rosout] found
process[node_publishing_enc_data-1]: started with pid [11282]
 process[robot_state_publisher-2]: started with pid [11283]
 process[jimmy_state_publisher-3]: started with pid [11284]
 process[sick_lms_scan_publisher-4]: started with pid [11292]
 process[rviz-5]: started with pid [11308]

*** Attempting to initialize the Sick LMS...
Attempting to open device @ /dev/lms200
ERROR: I/O exception - SickLMS2xx::_setupConnection: - Unable to open serial port
ERROR: I/O exception - SickLMS2xx::_setupConnection: - Unable to open serial port
[ERROR] [1510615504.630421790]: Initialize failed! are you using the correct device path?
[ INFO] [1510615504.715419546]: rviz version 1.11.18
[ INFO] [1510615504.715525284]: compiled against Qt version 4.8.6
[ INFO] [1510615504.715558080]: compiled against OGRE version 1.8.1 (Byatis)
[sick_lms_scan_publisher-4] process has died [pid 11292, exit code 2, cmd /home/constructor/Desktop    /workspace/devel/lib/sicktoolbox_wrapper/sicklms __name:=sick_lms_scan_publisher __log:=/home/constructor/.ros/log/4d83f6e0-c8c8-11e7-9df6-e09d3128cfa4/sick_lms_scan_publisher-4.log].log file: /home/constructor/.ros/log/4d83f6e0-c8c8-11e7-9df6-e09d3128cfa4/sick_lms_scan_publisher-4*.log
[ INFO] [1510615505.088206168]: Stereo is NOT SUPPORTED
[ INFO] [1510615505.088408404]: OpenGl version: 4.4 (GLSL 4.4).

You can see that the sicklms/port: /dev/ttyUSB0 is set correctly, and just a few lines down the code tries to use the wrong parameter (Attempting to open device @ /dev/lms200)

I tried:

  1. starting up roscore, and then manually setting the parameter using rosparam set sicklms/port /dev/ttyUSB0. Then I confirmed it using sickparam get /sicklms/port and it is indeed /dev/ttyUSB0. Then I try roslauch again, and I get the same exact error.
  2. I tried to start the node manually using rosrun sicktoolbox_wrapper sicklms and the node starts up fine.
  3. Originally the launch file code was kept in a ...
(more)
edit retag flag offensive close merge delete

Comments

Can you please copy and paste the terminal output to your question? Images aren't searchable and pastebins can disappear.

jayess gravatar image jayess  ( 2017-11-13 18:43:27 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
3

answered 2017-11-13 21:49:33 -0600

ahendrix gravatar image

It looks like setting the parameters in the wrong namespace. Since the driver is looking for the parameters in it's private namespace, they need to be in the namespace of the node name (sick_lms_scan_publisher).

Roslaunch can help you avoid errors like this by doing the namespacing automatically, if you nest the param tags inside the node tag in your launch file:

<launch>
  <!--launch the sicktoolbox_wrapper node. -->
  <node 
      pkg="sicktoolbox_wrapper" 
      type="sicklms" 
      name="sick_lms_scan_publisher"
      output="screen">
    <!--define the serial port for the PC to LMS comm in parameter server-->
    <param name="port" value="/dev/ttyUSB0">
    <!--define the lms comm baud rate in parameter server-->
    <param name="baud" value="500000"/>
  </node>
</launch>

You can also do this with param tags outside of the node tag, but it's more error-prone because you're duplicating the node name in many places:

<launch>

    <!--define the serial port for the PC to LMS comm in parameter server-->
    <param 
        name="sick_lms_scan_publisher/port" 
        value="/dev/ttyUSB0">
    </param>

    <!--define the lms comm baud rate in parameter server-->
    <param 
        name="sick_lms_scan_publisher/baud" 
        value="500000">
    </param>

    <!--launch the sicktoolbox_wrapper node. -->
    <node 
        pkg="sicktoolbox_wrapper" 
        type="sicklms" 
        name="sick_lms_scan_publisher"
        output="screen">
    </node>

</launch>
edit flag offensive delete link more

Comments

@ahendrix thank you very much!! worked like a charm. Thank you for your time and expertise.

BuilderMike gravatar image BuilderMike  ( 2017-11-14 15:40:34 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2017-11-13 18:21:40 -0600

Seen: 855 times

Last updated: Nov 13 '17