Ask Your Question
0

Several errors wthen subscribing to two topics

asked 2017-01-26 13:11:01 -0600

zfellone gravatar image

updated 2017-01-26 13:33:41 -0600

gvdhoorn gravatar image

When I subscribe to one topic everything works perfectly but when I try to subscribe to two topics I get a variety of errors

[INFO] [1485455415.530806]: ROS Serial Python Node
init done
[INFO] [1485455415.598943]: Connecting to /dev/ttyACM0 at 57600 baud
[INFO] [1485455415.730069]: ROS Serial Python Node
[INFO] [1485455415.759043]: Connecting to /dev/ttyACM0 at 57600 baud
[INFO] [1485455417.851490]: Note: subscribe buffer size is 512 bytes
[INFO] [1485455417.851787]: Setup subscriber on external1/tag_pose [apriltags_ros/MetaPose]
[INFO] [1485455417.862592]: Setup subscriber on external2/tag_pose [apriltags_ros/MetaPose]
[INFO] [1485455417.974516]: Note: subscribe buffer size is 512 bytes
[INFO] [1485455417.974869]: Setup subscriber on external1/tag_pose [apriltags_ros/MetaPose]
[INFO] [1485455430.471515]: wrong checksum for topic id and msg
[ERROR] [1485455432.946574]: Lost sync with device, restarting...
[INFO] [1485455432.993689]: wrong checksum for topic id and msg
[INFO] [1485455435.496778]: wrong checksum for msg length, length -2304
[INFO] [1485455435.502251]: chk is 10
[ERROR] [1485455447.947238]: Lost sync with device, restarting...
[WARN] [1485455453.022465]: Serial Port read failure: object of type 'int' has no len()
[INFO] [1485455453.028041]: Packet Failed :  Failed to read msg data
[INFO] [1485455453.028446]: msg len is 8
[INFO] [1485455458.150668]: wrong checksum for topic id and msg
[INFO] [1485455493.152246]: wrong checksum for topic id and msg
[ERROR] [1485455493.157915]: Lost sync with device, restarting...
[INFO] [1485455493.291012]: Setup subscriber on external2/tag_pose [apriltags_ros/MetaPose]
[WARN] [1485455500.782483]: Serial Port read failure: device reports readiness to read but returned no data (device disconnected or multiple access on port?)
[INFO] [1485455538.406165]: wrong checksum for topic id and msg
[INFO] [1485455558.412407]: wrong checksum for msg length, length -257
[INFO] [1485455558.412790]: chk is 8
[ERROR] [1485455580.912865]: Mismatched protocol version in packet: lost sync or rosserial_python is from different ros release than the rosserial client
[INFO] [1485455580.913300]: Protocol version of client is unrecognized, expected Rev 1 (rosserial 0.5+)

For reference I have two callback functions(messageCb1 and messageCb2) and two different subscribers(ex1 and ex2). Both subscribers subscribe to the same message type but each is from a different topic. The message type is a custom message with a Pose and two floats.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2017-01-27 08:44:14 -0600

zfellone gravatar image

My problem was trying to run two serial nodes in launch. Fixed and works wonderfully.

edit flag offensive delete link more
0

answered 2017-01-26 14:53:38 -0600

Steven_Daniluk gravatar image

My first thought is that you are trying to send too much data over serial. You mention that the messages that you are receiving contain a pose and two floats. That means they are (7*64 + 32 + 32) bits per message. This gives ~512 bits per message, and you are subscribing to two topics containing these messages.

If you are using the default baud rate of 9600, you will likely have issues. If both of your topics were publishing at 20Hz, that would result in 20,480 bits/s (202512). Plus there should be a bit of overhead for communication on top of that.

Also, I believe rosserial_arduino's buffer is about 80 bytes (I read that somewhere, but I cannot recall where). Two of your messages consume 128 bytes, which would be problematic if my memory of an 80 byte buffer is correct.

So, your options then would be:

  • Increase the baud rate, and hope the buffer is not the limiting factor
  • Find a way to reduce your message size (do you need all 6 degrees of freedom in the pose?)
  • Throttle the frequency which your messages are published (can whatever your messages are being used for respond at that rate?)

You can increase the baud rate with the arduino by adding to your arduino script:

nh.getHardware()->setBaud(57600);

Along with the parameter for the rosserial_arduino node:

<param name="baud" value="57600"/>
edit flag offensive delete link more

Comments

I'll look into increasing the baud rate. I am already using a baud rate of 57600.

zfellone gravatar imagezfellone ( 2017-01-26 15:15:08 -0600 )edit

Ah, I missed that from your log output, sorry. I also missed that it states the subscriber buffer size as 512 bytes. Would you be calling spin() on the arduino close to how frequently the messages are being published? Just to avoid messages piling up.

Steven_Daniluk gravatar imageSteven_Daniluk ( 2017-01-26 15:34:59 -0600 )edit

I think I figured out my problem. I haven't two serial nodes launching. Will check and respond tomorrow.

zfellone gravatar imagezfellone ( 2017-01-26 16:16:39 -0600 )edit
1

@zfellone: you don't need / can't have two rosserial server nodes running over the same serial port.

gvdhoorn gravatar imagegvdhoorn ( 2017-01-27 00:17:59 -0600 )edit

This was in fact the problem.

zfellone gravatar imagezfellone ( 2017-01-27 08:43:26 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2017-01-26 13:11:01 -0600

Seen: 974 times

Last updated: Jan 27 '17