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

trasfer vectors between python and c++ packages

asked 2017-06-04 06:41:42 -0500

ismaisma gravatar image

hi; I want to subscribe a vector from a node written in python to a node written in c++. I use the std::msg float64multiarray type in the two nodes, however, the message is not received Can you help me please Thank you

edit retag flag offensive close merge delete


Not an answer, but: if by 'vector' you really mean a standard xyz triplet, please try to use geometry_msgs/Vector3 as its semantics are much clearer.

gvdhoorn gravatar image gvdhoorn  ( 2017-06-04 07:09:45 -0500 )edit

the vector is the coordinates of a manipulator and the position with the orientation of a mobile robot, and an instantaneous velocity of the wheels of the mobile system

ismaisma gravatar image ismaisma  ( 2017-06-04 07:36:46 -0500 )edit

Then I would suggest you use a combination of Pose and JointState, or an Odometry msg. The whole point of ROS is to use as much semantically correct messages as possible. A multi-array throws away any and all meaning the original data might have.

gvdhoorn gravatar image gvdhoorn  ( 2017-06-04 07:39:06 -0500 )edit

I'm new in ROS, how could I combine Pose and JointState msg !!!!

ismaisma gravatar image ismaisma  ( 2017-06-04 08:13:40 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2017-06-04 16:20:37 -0500

ahendrix gravatar image

To pass messages between nodes they need to have the same topic name, the same topic type, and the nodes need to be connected to the same ROS master.

If you're running both nodes on the same computer, they're probably connected to the same ROS master. I wouldn't worry about this unless you're trying to run ROS across multiple machines.

In your code you should be able to see that you're using the same topic name and message type (although the message type syntax is slightly different in python and C++).

When both of your nodes are running, you can use rosnode info with the node name to see which topics your node is actually publishing and subscribing, and if your nodes are connected you'll be able to see the connection between nodes.

You can also use rostopic list to see the list of topics, and rostopic echo to confirm that your publisher is actually publishing messages.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2017-06-04 06:41:42 -0500

Seen: 149 times

Last updated: Jun 04 '17