No data from SICK S300 in ROS

asked 2019-08-27 03:56:33 -0500

fzeta gravatar image

updated 2022-01-22 16:10:03 -0500

Evgeny gravatar image

Using the cob_sick_s300 package and an RS422 -> USB connection to a Raspberry Pi I can't seem to get any data that will visualise in ROS/RVIZ although I am able to view the incoming data in a python program reading from the /dev/ttyUSB0 interface.

s300_launch.launch file

<launch
        <rosparam command ="load" file="$(find cob_sick_s300)s300_config.yaml"/> 
</launch>

s300_config.yaml file

port: /dev/ttyUSB0
baud: 38400
scan_duration: 0.025
scan_cycle_time: 0.040
inverted: true
scan_id: 7
frame_id: laser
scan_intervals: [[-1.3526, 1.361357]]
edit retag flag offensive close merge delete

Comments

Can you show what your rviz looks like? It is possible you don't have rviz configured correctly.

MCornelis gravatar image MCornelis  ( 2019-08-27 05:27:46 -0500 )edit

I've added the laserscan and tried to add the topic for the scanner, however before doing so I'm unable to find it using rostopic list as it only shows

/rosout
/rosout_agg
fzeta gravatar image fzeta  ( 2019-08-27 05:41:47 -0500 )edit
1

Your .launch file doesn't appear to start any node(s). It just loads some parameters from a .yaml file.

No driver is started, which would explain why you're not seeing any topics other than the default ones, and no data is being published.

gvdhoorn gravatar image gvdhoorn  ( 2019-08-27 05:55:38 -0500 )edit

Oh, what would I need to do to start a node in this context?

fzeta gravatar image fzeta  ( 2019-08-27 05:56:27 -0500 )edit
1

You'll have to figure out how to actually start the driver. I don't have any experience with that package, so I wouldn't know.

There may be other .launch files that you could use. I'd check for those first.

Have you checked the wiki page of the package? It refers to launch files in cob_bringup that you may be able to use as templates/examples.

gvdhoorn gravatar image gvdhoorn  ( 2019-08-27 05:59:33 -0500 )edit

Have a look here for an explanation on roslaunch using XML: http://wiki.ros.org/roslaunch/XML

MCornelis gravatar image MCornelis  ( 2019-08-27 06:01:42 -0500 )edit
1

https://github.com/ipa320/cob_robots/... I was also able to find this for kinetic. Might be useful as an example.

MCornelis gravatar image MCornelis  ( 2019-08-27 06:06:36 -0500 )edit

I'm having trouble with the cob_hardware_config package as I can't seem to find it through apt-get. It doesn't seem to be a Melodic package

fzeta gravatar image fzeta  ( 2019-08-27 06:16:41 -0500 )edit

You don't need to install all of those packages. I would suggest to look at the source, find the launch files mentioned and then create one of your own.

gvdhoorn gravatar image gvdhoorn  ( 2019-08-27 06:50:04 -0500 )edit
1

The link I gave you was how to bringup a complete robot setup. That setup happened to be using the sick s300 laser that you are using. So you could probably use the lines related to starting the laser driver. The other lines, you will need to replace with whatever you need for your setup. If your only goal is to see some laserdata in ROS and rviz then just launching the driver will probably suffice. So the relevant part of the launch file for you would be:

<node  pkg="cob_sick_s300" type="cob_sick_s300" name="driver" respawn="false" output="screen">
</node>

You can use the other link I posted about roslaunch XML to figure out how to pass your config file in there. Alternatively you can set all the params in your launch file as follows:

<launch>
  <node  pkg="cob_sick_s300" type="cob_sick_s300" name="driver" respawn="false" output="screen"> ...
(more)
MCornelis gravatar image MCornelis  ( 2019-08-27 07:16:15 -0500 )edit

Thank you so much, I've got the node running, however it can't seem to open the config file correctly, as I don't know how to format it with the new node name

fzeta gravatar image fzeta  ( 2019-08-27 07:51:54 -0500 )edit

I believe I have the data coming through, I just need to setup Rviz correctly to the node I think or make a topic?

fzeta gravatar image fzeta  ( 2019-08-27 08:01:13 -0500 )edit

In Rviz you can press the add button in the bottom left and then add a LaserScan. The LaserScan will then be in the Displays list. There you can open the dropdown under the laserscan and select your laserscan topic. If nothing is displayed then make sure you set the fixed frame under global options to the frame of the laser.

MCornelis gravatar image MCornelis  ( 2019-08-27 09:01:26 -0500 )edit

If you get this to work you can then in rviz go to "file>save config as" and save your rviz configuration. This configuration can then be reloaded the next time you open rviz. You could also add rviz to your launchfile and load rviz with the config. This way, when your laser node starts, rviz will also be started with the correct config. This means you don't have to add the LaserScan to the display every time.

MCornelis gravatar image MCornelis  ( 2019-08-27 09:06:27 -0500 )edit

It finds the topics /scan from the laser frame but nothing is printed out onto the map

fzeta gravatar image fzeta  ( 2019-08-27 09:16:05 -0500 )edit

Have you tried setting Global options>fixed frame to "laser" instead of "map". If that does not work then you'll have to figure out the name of the frame the laserscan is published in (laser tends to be the default).

MCornelis gravatar image MCornelis  ( 2019-08-27 09:17:47 -0500 )edit

i believe it finds the correct topic, its the only one availible in "laser" https://imgur.com/a/eWN2LwR

fzeta gravatar image fzeta  ( 2019-08-27 09:25:31 -0500 )edit

Rviz says the frame laser does not exist. So that is the problem right now. Your data is being published, but rviz needs to know in which tf frame this is happening. Tf is used to transform data between frames. The fixed frame stated in rviz is the "base" frame/center of your visualization. All other data is visualized relative to this fixed frame in their respective frames. You need to find the name of your laser frame and make that the fixed frame. From your config:

frame_id: laser

I expected this to be "laser", but according to rviz this is not he case. Did you manage to pass the parameters correctly yet?

MCornelis gravatar image MCornelis  ( 2019-08-27 09:31:58 -0500 )edit