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

Logging and processing the same sensor data

asked 2018-11-09 15:09:00 -0500

quantum gravatar image

updated 2018-11-09 18:08:07 -0500

Hi all,

In my system I have a sensor that sends data via TCP/IP. This data should be logged for future processing and also used for a live computation at the same time.

Since i am a newbie to ROS, I have a question concerning a good design for the situation above. Does it make sense to write a node(let) which simply opens the socket, reads the data and publishes the bytes as they come from the sensor. Then use two node(let)s to subscribe to the topic? Or better, one node reads the data, processes it and writes the data to a rosbag?

What happens to this design if there are 20 sensors?

Regards

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2018-11-09 18:01:26 -0500

updated 2018-11-09 18:09:51 -0500

For the task you have described you should make a node which connects to the sensor and publishes it's data. The raw data from the sensor should be converted either to one of the standard ROS messages or a suitable custom message type. This is the recommended architecture within ROS.

As you suggested you can use rosbag to record the data and play it back later. This way your processing node will subscribe to the sensor topic so it can be used just as easily with the live data as with the recorded data.

If you need more sensors you can start multiple sensor nodes and remap their outputs to different topics.

Hope this helps.

edit flag offensive delete link more

Comments

Assuming my sensor is GPS, then based on your recommendation, I should decode the data and transfer it to e.g. geometry_msgs/Pose and then published and loggen this "compact" data set. In case of a bug in my decoder, that geometry_msgs/Pose won't make sense, my rosbag won't help me.

quantum gravatar image quantum  ( 2018-11-10 00:42:02 -0500 )edit

Assuming your sensor is GPS, you should try to find an existing component.

As to @PeteBlackerThe3rd's suggestion: that is indeed how sensors should be integrated into ROS.

@quantum: debugging internal algorithms is typically part of unit tests, not integration tests. ROS nodes do not come ..

gvdhoorn gravatar image gvdhoorn  ( 2018-11-10 01:34:16 -0500 )edit

.. into play in unit tests. So verifying your decoder is ok would be a unit-test level task and at that point you'd have access to the serialised packets/streams/X and the decoded ones and can do all the verification you'd need (it would most likely not even be against an actual device).

gvdhoorn gravatar image gvdhoorn  ( 2018-11-10 01:35:28 -0500 )edit

@gvdhoorn, thanks for trying to explain newbie how ROS works. Assuming my sensor is a camera, then i saw sensor_msgs/Image Message. Fine for me, since i have, uint8[] data, which contain the actual matrix data, size is (step * rows), then i am with you.

quantum gravatar image quantum  ( 2018-11-10 02:37:31 -0500 )edit

Normally moving from one format to another causes for reduce of information, that is why I would always like to log in a rosbag the original information. How knows, maybe in one year you will need something that now you do not need\thought about it.

quantum gravatar image quantum  ( 2018-11-10 02:40:20 -0500 )edit

The question is one of abstraction, to reduce overall system complexity. The idea of the sensor driver node is that the rest of the ROS system doesn't need to know anything specific about the sensor, just that it's a camera/gps/etc.

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2018-11-10 03:08:40 -0500 )edit

@PeteBlackerThe3rd, i agree with you. The idea is always to have the sensor data in an abstract layer.

quantum gravatar image quantum  ( 2018-11-10 03:22:55 -0500 )edit

Perhaps you can take a look at how the velodyne_driver approaches this: it uses custom messages as a first step that try to capture as much of the original data and semantics, and then uses a post-processing node that turns those msgs into ..

gvdhoorn gravatar image gvdhoorn  ( 2018-11-10 05:58:01 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2018-11-09 15:09:00 -0500

Seen: 572 times

Last updated: Nov 09 '18