Ask Your Question
0

Rviz Triangle List bad rendering

asked 2020-10-03 13:17:15 -0500

Menz gravatar image

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

image description

Side View

image description

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_);
edit retag flag offensive close merge delete

Comments

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.

mgruhler gravatar image mgruhler  ( 2020-10-05 01:24:11 -0500 )edit

Perhaps related: #q246651. And there are more Q&As about triangle lists in RViz.

gvdhoorn gravatar image gvdhoorn  ( 2020-10-05 05:47:38 -0500 )edit

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 gravatar image Menz  ( 2020-10-10 06:50:17 -0500 )edit

@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.

mgruhler gravatar image mgruhler  ( 2020-10-12 02:01:25 -0500 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2020-10-10 06:50:02 -0500

Menz gravatar image

I “solved” the problem now with
https://github.com/mogumbo/rviz_lighting and black lines around the surfaces. It’s not perfect but now the visualization is useable.

image description

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2020-10-03 12:50:08 -0500

Seen: 164 times

Last updated: Oct 10 '20