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

Serial Load Cell is slow in ROS

asked 2013-01-08 12:07:47 -0500

Nishant gravatar image

updated 2014-01-28 17:14:46 -0500

ngrennan gravatar image

Hi all,

So I have these load cells (4 of them) for which I have written a nice C++ class wrapper to interface with the sensors in a ROS environment. I have 4 topics, called "loadSensorX" where X = 0,1,2,3. These topics publish the force felt by these sensors in millipounds.

Now the load cells are actually LoadStar Sensor capacitive sensors with serial USB output. Here is the link to it

http://www.loadstarsensors.com/lc003-iload-tr-series-tilt-resistant-usb-load-cell.html

To the left of the page, you can see that default data rate for a standard sensor is 150 Hz. I have 4 of these sensors connected to my PC with a USB hub. Now all the topics and everything work fine. But when I do

rostopic hz /loadSensor0

instead of getting 150 Hz, I get only about 10-15 Hz. Also, when I connect just a single load cell instead of all 4 and try

rostopic hz /loadSensor0

I get about 50-55 Hz.

In both cases, I get much less data output rate compared to the promised 150 Hz. Which brings me to my question. Why does this happen? Is it because I am using a USB hub? Or is it my laptop specifications? Or is it ROS using up a lot of CPU power for just publishing 4 topics? Also, why do multiple load cells being connected with the hub affect my data rate?

My laptop specifications are

Intel Pentium CPU B960 Processor @ 2.20 GHz

64-bit Windows 8 OS with 32-bit Ubuntu 12.04 on VMWare Player.

4 GB RAM for host OS, 1 GB RAM for Ubuntu 12.04.

Thanks and any help is greatly appreciated.

edit retag flag offensive close merge delete

Comments

1

Can you try on Ubuntu installed on an actual machine? I'm curious if maybe there is some odd interaction in the VMWare USB stack that could be affecting this. Try @dornhege's suggestion first, but if it doesn't look like your code that is the problem, try removing the VM.

Eric Perko gravatar image Eric Perko  ( 2013-01-09 03:42:17 -0500 )edit

Yes, I had that feeling too. Plus, the computer I am using has only 1 processor. On an different computer that I used earlier, with 4 processors (pentium core i7), I got 16-20 Hz when I used 4 sensors and 60-65 Hz with 1 sensor. In any case, I will first try dornheges solution and post updates here.

Nishant gravatar image Nishant  ( 2013-01-09 08:52:31 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2013-01-08 23:07:01 -0500

dornhege gravatar image

I suspect that this is not a ROS problem. This can be simply tested: Just take your driver code and don't do anything ROS related. You'll need to check the frequency yourself manually and see the result. Depending on the result you can look further.

The data rate with one sensor connected seems 4x data rate with 4 sensors, so there seems to be some general bottleneck.

edit flag offensive delete link more

Comments

I was planning on doing exactly that. Isolate the serial reading and writing parts, and see how many times I can write to a file in say 1 second. However, I need to use the force logging feature in the background while I am doing something else. Do you suggest I use threads instead of topics then?

Nishant gravatar image Nishant  ( 2013-01-09 03:02:03 -0500 )edit

Not sure what you mean by "force logging feature". I wouldn't do anything with the data first, but get it, discard it and count the frequency. Once that is fine, you can go to processing (or check why it is too slow).

dornhege gravatar image dornhege  ( 2013-01-09 03:14:59 -0500 )edit

By force logging feature, I basically meant reading the force data from the sensor and writing it to a text file. I shall update this post as soon as I get results from the manual frequency tests.

Nishant gravatar image Nishant  ( 2013-01-09 08:47:02 -0500 )edit

@dornhege : I know this is a bit late, but I did try out your suggestion. Without the ROS stuff and manually measuring the frequency, I get about 55 Hz frequency per sensor. This means that I am losing out some data somewhere. What do you suggest I do now?

Nishant gravatar image Nishant  ( 2013-01-31 18:42:49 -0500 )edit

Make sure your send and receive buffers are large enough to receive messages from all senders simultaneously

tfoote gravatar image tfoote  ( 2013-03-05 10:01:45 -0500 )edit

Question Tools

Stats

Asked: 2013-01-08 12:07:47 -0500

Seen: 552 times

Last updated: Jan 08 '13