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

Connect bool topics - node required?

asked 2014-05-26 07:14:53 -0500

Hendrik Wiese gravatar image

Hey folks,

do I actually need a node to translate a boolean topic into two others?

I've got subscribed topic /input and two published topics /out1 and /out2. All message are boolean, /out1 shall republish /input and /out2 shall republish NOT /input. So if there's a True coming in on /input, /out1 shall publish True and /out2 shall publish False.

Is there a way to achieve that without writing a node? Some sort of remapping or something?

Thank you, guys!

Cheers, Hendrik

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2014-05-26 08:18:41 -0500

ahendrix gravatar image

Remapping only changes the name of a topic; not the data types involved.

You can do the mapping of /input to /out1 with remapping arguments, but you'll need to write a node to do the inversion between /input and /out2

edit flag offensive delete link more

Comments

Would be an interesting addition for roslaunch, doesn't it? You could create truth-table like connections between topics. Some kind of value mapping could also be achieved by it instead of having to write nodes for each of this purposes. Would reduce some overhead, I'd guess...

Hendrik Wiese gravatar image Hendrik Wiese  ( 2014-05-26 11:18:56 -0500 )edit

The trouble is that this isn't directly a roslaunch proposal, since all roslaunch is doing is passing remapping arguments to the underlying rospy and roscpp libraries. Instead, you'd have to extend the remapping syntax to support arbitrary data modification/remapping.

ahendrix gravatar image ahendrix  ( 2014-05-26 11:29:13 -0500 )edit

You're welcome to propose this as a feature request against the ros_comm bug tracker, but I think it is unlikely to go very far.

ahendrix gravatar image ahendrix  ( 2014-05-26 11:30:13 -0500 )edit

As an alternative, you could write your subscriber node so that it takes an additional `invert` parameter and uses that to decide whether or not to invert the incoming data. If you need this a lot, you could wrap it up in a class and namespace the invert parameter to node/topic/invert or something.

ahendrix gravatar image ahendrix  ( 2014-05-26 11:33:38 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2014-05-26 07:14:53 -0500

Seen: 236 times

Last updated: May 26 '14