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

Can I "overload" topic names in ROS? (Different versions by datatype)

asked 2011-04-12 07:33:24 -0500

Murph gravatar image

updated 2011-04-12 07:47:06 -0500

Can I advertise a topic with one name and two versions depending on the data type being transferred?

Specifically, the pointcloud_throttle node is hardcoded to a depth-only pointcloud, and I'm going to extend it to a RGB cloud as well. I want to know if i can just

pub_ = nh.advertise<pointcloud>("cloud_out", 10);

pub_ = nh.advertise<pointcloudrgb>("cloud_out", 10);

Or if i need to come up with a separate topic name, etc.

edit retag flag offensive close merge delete

Comments

Do you mean topic names?
Eric Perko gravatar image Eric Perko  ( 2011-04-12 07:34:14 -0500 )edit
woops, yup, edited.
Murph gravatar image Murph  ( 2011-04-12 07:41:52 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
4

answered 2011-04-12 08:10:58 -0500

kwc gravatar image

No, you cannot overload topics.

edit flag offensive delete link more
0

answered 2011-04-12 07:53:30 -0500

Eric Perko gravatar image

updated 2011-04-12 07:54:17 -0500

I'm not 100% sure on the answer to this (my gut says "no, for example how would rostopic echo know which to subscribe to"), but I think you may be able to get around the problem by just throttling sensor_msgs::PointCloud2 types. I've not looked into the code, but does it matter what data is contained in the PointCloud?

Maybe you could even extend it to a ShapeShifter type, like the node version of the generic throttle does and see about it getting into nodelet_topic_tools (not really sure why there isn't one already...).

edit flag offensive delete link more

Question Tools

Stats

Asked: 2011-04-12 07:33:24 -0500

Seen: 331 times

Last updated: Apr 12 '11