Ask Your Question
0

Remapping arguments of topics

asked 2015-07-23 06:14:51 -0500

AdrianGonzalez gravatar image

updated 2015-07-23 06:15:15 -0500

Hi all:

I have a question about remapping topics in launch files. I have a controller which is subscribed to the topics: /pelican/pose and /pelican/twist, expecting a Pose and a Twist respectively. Gazebo publishes both information in the topic /gazebo/model_states, so I expected do do the following remappings:

/gazebo/model_states/pose[1] to /pelican/pose

/gazebo/model_states/twist[1] to /pelican/twist

Doing the remap of /gazebo/model_states works well, but the ones before do not work. Anyone knows how can I do that, or something similar?

Thank you in advance

edit retag flag offensive close merge delete

Comments

Could you post your launch-file?

NEngelhard gravatar imageNEngelhard ( 2015-07-23 12:05:34 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
1

answered 2015-07-23 14:29:32 -0500

updated 2015-07-23 14:36:42 -0500

You are trying to remap the content of the message not the topic, which you can't do directly.

You'll need to write a simple node that subscribes to gazebo/model_states and publishes the desired topics.

Another option, if you don't want to write the simple node, would be to try to use the topic-tools/transform node.

Edit: this also won't work...

edit flag offensive delete link more
0

answered 2015-07-24 19:56:42 -0500

I had a similar problem some time ago and end up with a recompose.py script. Please have a look at this question.

Basically the script allows you to convert any message to any just from a command line. For your case it will be something like:

$ rostopic echo /gazebo/model_states | ./recompose.py "{pose: 'pose[1]'}" | rostopic pub -r 100 /pelican/pose geometry_msgs/Pose

Although this is convenient for prototyping, for a production code it might be better to write a small node as @gary-servin suggests.

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: 2015-07-23 06:14:51 -0500

Seen: 490 times

Last updated: Jul 24 '15