Draw coordinate system in Rviz
Hi,
I am trying to visualize camera and laser poses in Rviz. Currently I can draw an arrow pointing in the X direction like you can see on the attached figure. Basically what I would like to do is replace the single green and yellow arrows by an axis similar to the one overlapping the yellow arrow in the figure.
The code that draws the single arrow pointing in the X direction is the following:
for(int n=0;n<lasers.size();n++)
{
{
marker_lasers[n].header.frame_id = "/my_frame3";
marker_lasers[n].header.stamp = ros::Time::now();
std::stringstream ss;
ss << "Laser " << n;
marker_lasers[n].ns = ss.str();
marker_lasers[n].action = visualization_msgs::Marker::ADD;
marker_lasers[n].type = visualization_msgs::Marker::ARROW;
marker_lasers[n].scale.x = 0.2;
marker_lasers[n].scale.y = 0.1;
marker_lasers[n].scale.z = 0.1;
geometry_msgs::Pose laser = lasers[n];
std_msgs::ColorRGBA color;
color = colormap.color(n);
marker_lasers[n].pose.position.x=laser.position.x;
marker_lasers[n].pose.position.y=laser.position.y;
marker_lasers[n].pose.position.z=laser.position.z;
marker_lasers[n].pose.orientation.x=laser.orientation.x;
marker_lasers[n].pose.orientation.y=laser.orientation.y;
marker_lasers[n].pose.orientation.z=laser.orientation.z;
marker_lasers[n].pose.orientation.w=laser.orientation.w;
marker_lasers[n].color=color;
marker_list.update(marker_lasers[n]);
}
}
Thank you for your help,
Dr1T
EDIT: Upon searching a little more I came across this question: http://answers.ros.org/question/66510...
It seems to be exactly the same issue. The selected answer says that I have to create 3 arrow markers for each pose. But this would require quite a bit of changes in code that I am not familiar with.
The second answer seems to be what I want without changing much, could someone give an example of how to implement it (adding a Pose display type and changing its shape to "Axis")?
Rviz has a built in TF display, if you're using TF.
Don't think I am using TF, since the "Frame" filed in the TF display does not have the frame I am using. The current code publishes a single markerarray in a single frame which contains the point clouds and poses for all sensors. Each color represents a different sensor.
Then, I recommend you get familiar with TF and use it properly. Then, this you want to do is going to be much easier and you will have tons of advantages when dealing with your sensor data.
Late update. TF really is the best option, but I ended up creating 3 arrow markers since changing to TF, in this specific case, would require a lot of changes and I didn't have much time to do it. Thanks for your answers.