ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
For this,
you have to define all the variables in the message type and publish it.
Example Here is sample code snippet, you may have to extend it if I have missed any.
Assuming the the variables x,y,z represent the 3D position.
geometry_msgs::PoseWithCovarianceStampedConstPtr& msg;
msg->pose.pose.position.x = x;
msg->pose.pose.position.y = y;
msg->pose.pose.position.z = z
;
Assuming that convert the 3D angles into quarternion representation gives (theta1, theta2, theta3, theta4)
msg->pose.pose.orientation.x = theta1;
msg->pose.pose.orientation.y = theta2;
msg->pose.pose.orientation.z = theta3;
msg->pose.pose.orientation.w = theta4;
Then you have properly assign a header to this msg
msg->header = another_time_Stamped_msg.header;
or create a header by assigning a time and a frame id, for example
msg->header.frame_id = "\my_frame_id";
msg->header.stamp = ros::Time current_time;
I hope this solves the issue.