Rviz Triangle List bad rendering
Problem
I want to visualize some planes in rviz. For this purpose, I separated each plane in triangles and used the triangle list marker in rviz. Unfortunately, the rendering ist buggy. Has anyone an idea?
Front view
Side View
Code snippet 1
visualization_msgs::MarkerArray ma_;
ros::Publisher marker_array_pub_;
marker_array_pub_ = nh_.advertise<visualization_msgs::MarkerArray>("just_marker_array", 10);
Code snippet 2
//slice = plane
for (int actualslice = 0; actualslice < numofslices; actualslice++)
{
...
ma_.markers.resize(actualslice + 1);
ma_.markers[actualslice].header.frame_id = "/map";
ma_.markers[actualslice].header.stamp = ros::Time::now();
ma_.markers[actualslice].ns = "slices";
ma_.markers[actualslice].id = actualslice;
ma_.markers[actualslice].type = visualization_msgs::Marker::TRIANGLE_LIST;
ma_.markers[actualslice].action = visualization_msgs::Marker::ADD;
ma_.markers[actualslice].lifetime = ros::Duration(1);
ma_.markers[actualslice].pose.position.x = 0.0;
ma_.markers[actualslice].pose.position.y = 0.0;
ma_.markers[actualslice].pose.position.z = 0.0;
ma_.markers[actualslice].pose.orientation.x = 0.0;
ma_.markers[actualslice].pose.orientation.y = 0.0;
ma_.markers[actualslice].pose.orientation.z = 0.0;
ma_.markers[actualslice].pose.orientation.w = 1.0;
ma_.markers[actualslice].scale.x = 1.0;
ma_.markers[actualslice].scale.y = 1.0;
ma_.markers[actualslice].scale.z = 1.0;
ma_.markers[actualslice].color.r = 1.0;
ma_.markers[actualslice].color.g = 0.0;
ma_.markers[actualslice].color.b = 0.0;
ma_.markers[actualslice].color.a = 1.0;
//pointsVector3d contains all points of the actual plane
// e.g. pointsVector3d.size() = 141
// that means that the actual plane consists of 47 triangles (141/3)
for(int i = 0; i < pointsVector3d.size(); i++)
{
ma_.markers[actualslice].points.push_back(pointsVector3d.at(i));
}
}
Code snippet 3
marker_array_pub_.publish(ma_);
Could you please describe what rendering you would expect? I'm not sure why you think the visualization would be buggy here. It would probably also help if you provide a bagfile of the respective message.
Perhaps related: #q246651. And there are more Q&As about triangle lists in RViz.
Thanks for your support.
@mgruhler I would expext a bit more three dimensionaltity in the visualization. Actual you cant even see where one plane starts and where one ends.
@gvdhoorn Unfortnutalty none of the mentioned solutions improves the visualization
@Menz great that you've found a way to work around your issue. I just want to note that this is not a bug, but merely the way that the triangle rendering is implemented.