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

Revision history [back]

click to hide/show revision 1
initial version

The marker's pose is given by a pose (marker.pose) which is intrepreted relative to the frame that you pass in the header. So as you already have the transformation between the two frames, pass this transform as marker.pose and set the header.frame_id to you first frame:

visualization_msgs::Marker marker;
marker.header.frame_id = "frame1";
marker.type = visualization_msgs::Marker::CYLINDER;
marker.pose.position = [translation of other frame]/2
marker.pose.orientation = orientation of frame2 relative to frame1
marker.scale.x = marker.scale.y = 0.1; // diameter of cylinder
marker.scale.z = translation.z;  
marker.color.a = marker.color.r = 1.0; // red

vis_pub.publish( marker );

The marker's pose is given by a pose (marker.pose) which is intrepreted relative to the frame that you pass in the header. So as you already have the transformation between the two frames, pass this transform as marker.pose and set the header.frame_id to you first frame:

visualization_msgs::Marker marker;
marker.header.frame_id = "frame1";
marker.type = visualization_msgs::Marker::CYLINDER;
marker.pose.position = [translation of other frame]/2
marker.pose.orientation = orientation of frame2 relative to frame1
marker.scale.x = marker.scale.y = 0.1; // diameter of cylinder
marker.scale.z = translation.z;  
marker.color.a = marker.color.r = 1.0; // red

vis_pub.publish( marker );

// thanks for the hint that my first answer was wrong...