Ask Your Question
0

Issue in communicating with multiple robots using rosserial_xbee

asked 2018-10-01 13:41:24 -0500

robot_probot gravatar image

Hi,

I have 10 robots - all with an xbee end device and an xbee coordinator to which they all connect. I calculate velocity commands for each of the robots and publish the cmd_vel to 10 different topics, 1 for each robot to which they subscribe. This seems to be overloading the communication resulting in delayed command reception/ packet drop. Are there ros_messages that I can use where only one publisher can publish all the velocity commands for all the bots on one topic to which all the robots subscribe and receive the commands?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-10-02 07:16:52 -0500

The twist messages used by cmd_vel contain 6 DOF information, if you're controlling turtle bots for example then you only need two of these six values. A quick and dirty way of doing this would be to use the Float32MultiArray message, with 20 elements.

Consecutive pairs of elements could encode the linear x veloccity and angular z velocity for each robot using a single message which is also a third of the size of the original ten cmd_vel messages.

The longer and more correct way of doing this would be to create a custom message type, possibly using int16 values in mm to save even more space. However I would recommend implementing the quicker version first to see if it solves your problem.

Hope this helps.

edit flag offensive delete link more

Comments

@PeteBlackerThe3rd, I agree with FloatMultiArray & it would still take more space than required. So I made a custom message with two float arrays with 10 elements each, the bot receive the whole msg and use the values indexed by bot IDs in both arrays. This overflows my serial buffer though.

robot_probot gravatar image robot_probot  ( 2018-10-02 10:57:57 -0500 )edit

Message from ROS network dropped: message larger than buffer is the error I get.

robot_probot gravatar image robot_probot  ( 2018-10-02 10:58:36 -0500 )edit

I'd recommend doing an experiment changing the size of the float arrays so you can find the limit of the buffer size, then decide what to do based on that

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2018-10-02 11:03:21 -0500 )edit

Sorry, I edited the comment

robot_probot gravatar image robot_probot  ( 2018-10-02 11:03:31 -0500 )edit

If you want to be as space efficient as possible, try a custom message with 20 individual int16 values. An array has to store its length as well as the content so takes up more space even though it's tidier.

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2018-10-02 11:13:25 -0500 )edit

Thanks, now, the array with 20 elements is working fine without buffer overflow. However I still see that not all robots get their commands. Since the robots are mobile, I don't have a feedback of what command are they receiving. But, from observation, they dont seem to be getting the right commands

robot_probot gravatar image robot_probot  ( 2018-10-02 19:48:27 -0500 )edit

Can that be because of multiple subscribers subscribing to the same topic with just 1 publisher? If one of the bots reads the message, will that stop the other subscribers from servicing the callback?

robot_probot gravatar image robot_probot  ( 2018-10-02 19:49:54 -0500 )edit

No. ROS topics are one-to-many. However there is no guaranteed delivery in the protocol, in fact it's designed to drop messages when the network capacity is reached. If your network is that constrained it may be worth looking into a more efficient, lower level, non-ROS solution.

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2018-10-02 19:56:29 -0500 )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

2 followers

Stats

Asked: 2018-10-01 13:41:24 -0500

Seen: 84 times

Last updated: Oct 02 '18