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

Using data from a ROS node in a separate C++/Python program

asked 2015-02-02 17:12:34 -0600

GoBaxter gravatar image

Suppose there is a user-defined ROS node. I make it publish to a topic. Now i want to use this data published to the topic as input to a C++/Python program. So how do I

  1. make the node publish to a topic?
  2. route the data from the topic as input to another separate C++/Python program?

Any reference/tutorial with concrete coding examples is sought.

edit retag flag offensive close merge delete

Comments

Did I understand you right that you do not want to subscribe to this topic. Instead you want this data as a program parameter?

BennyRe gravatar image BennyRe  ( 2015-02-03 03:00:32 -0600 )edit

yes. i have a c++ function and the node is reading sensor data and processing it. i need the outputted data from this node as input for my c++ function. will subscribing to the topic to which this node publishes work? i amn't sure.

GoBaxter gravatar image GoBaxter  ( 2015-02-03 08:48:08 -0600 )edit
1

I guess that creating a subscriber node that executes your c++ function on callback should work... But I'm not sure what you are trying to do.

gustavo.velascoh gravatar image gustavo.velascoh  ( 2015-02-04 08:23:39 -0600 )edit

Yes, I think i should combine my code to a subscriber code and it should work.

GoBaxter gravatar image GoBaxter  ( 2015-02-04 09:21:01 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2015-02-05 03:53:32 -0600

BennyRe gravatar image

@gustavovelascoh is right.

Create a subscriber node and call you function from this subscriber.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-02-02 17:12:34 -0600

Seen: 274 times

Last updated: Feb 05 '15