Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Hi, I think the easiest way to do it in your case would be to send either Point, or Vector3 You can send it using: On the talker part: ros::Publisher vector_pub = n.advertise<geometry_msgs::vector3>("coordinates", 1);

geometry_msgs::Vector3 vectSend; vectSend.x = coordinates.x; vectSend.y = coordinates.y; vectSend.z = coordinates.theta; vector_pub.publish(vectSend); On the listener part: ros::Subscriber vector_sub = n.subscribe("chatter", 1000, coordinatesCb);

void coordinatesCb(const geometry_msgs::Vector3::ConstPtr& msg) { float goal_x, goal_y, goal_z; goal_x = msg->x; goal_y = msg->y; goal_z = msg->z; // do whatever you want with it and send to move_base }

Hi, I think the easiest way to do it in your case would be to send either Point, or Vector3
You can send it using: using:
On the talker part: part:

ros::Publisher vector_pub = n.advertise<geometry_msgs::vector3>("coordinates", 1);

ros::Publisher vector_pub = n.advertise<geometry_msgs::vector3>("coordinates", 1); geometry_msgs::Vector3 vectSend; vectSend.x = coordinates.x; vectSend.y = coordinates.y; vectSend.z = coordinates.theta; vector_pub.publish(vectSend);

On the listener part: part:
ros::Subscriber vector_sub = n.subscribe("chatter", 1000, coordinatesCb);

ros::Subscriber vector_sub = n.subscribe("chatter", 1000, coordinatesCb); void coordinatesCb(const geometry_msgs::Vector3::ConstPtr& msg) { msg){ float goal_x, goal_y, goal_z; goal_x = msg->x; goal_y = msg->y; goal_z = msg->z; // do whatever you want with it and send to move_base }

Hi, I think the easiest way to do it in your case would be to send either Point, or Vector3
You can send it using:
On the talker part:

ros::Publisher vector_pub = n.advertise<geometry_msgs::vector3>("coordinates", 1); geometry_msgs::Vector3 vectSend; vectSend.x = coordinates.x; vectSend.y = coordinates.y; vectSend.z = coordinates.theta; vector_pub.publish(vectSend);

On the listener part:

ros::Subscriber vector_sub = n.subscribe("chatter", 1000, n.subscribe("coordinates", 1, coordinatesCb); void coordinatesCb(const geometry_msgs::Vector3::ConstPtr& msg){ float goal_x, goal_y, goal_z; goal_x = msg->x; goal_y = msg->y; goal_z = msg->z; // do whatever you want with it and send to move_base