Ask Your Question
0

Aggregate multiple topics of same name and type

asked 2019-10-03 22:03:21 -0500

Akashjinandra gravatar image

Hello all,

I am trying to do a multirobot simulation. I need away to keep track of all of their positions. The complicated part is I want to not define how many robots there are in the beginning. Imagine all the robots publish their pose and name on the same topic. There is a node subscribing to that topic and would be able to then publish a topic that has all the robot positions that it has recieved.

I think this is a similar concept to the robot state publisher. This is because it's subscribes to the topic joint_states. The topic joint_states can be published and it aggregates them together in tf.

If there are any examples of this or packages that do this please enlighten me!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-10-04 02:08:58 -0500

Delb gravatar image

First, you should see #q275079 answer for a better understanding of what robot_state_publisher and joint_state_publisher nodes really do.

Regarding your question I'm not sure to completly understand it : You can already get the pose of each robots using TFs by listenning to the transform between map and robot_N/base_link (assumming that the frame have a prefix like robot_N if you spawn your robots propperly) with the command rosrun tf tf_echo source_frame target_frame.

Imagine all the robots publish their pose and name on the same topic. There is a node subscribing to that topic and would be able to then publish a topic that has all the robot positions that it has recieved.

You could create a node listenning to the transform of each robots and use an array of geometry_msgs::Poseto publish them.

edit flag offensive delete link more

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: 2019-10-03 22:03:21 -0500

Seen: 272 times

Last updated: Oct 04