Gazebo | Ignition | Community
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

[ignition][Fortress] Problem in rendering created entities in GUI scene

I am currently writing a system plugin for integrating an efficient lidar simulator. I don't know how to visualize the points in gazebo GUI that im getting as an output.

I have tried:

  1. in ignition::gazebo::ISystemConfigure Configure function using the server ECM creating an entity and adding Visual, Name, Pose, Geometry components (geometry using sdf::Geometry element defined as in code block below ) - the entity is displayed in the entity tree in the GUI, but the visual is not being rendered in the scene.

  2. using a GUI rendering Plugin from rendering plugins tutorial, where I also couldn't get entities to be properly rendered in the GUI scene. I tried to use there the Marker class (code block below)

  3. using gazebo services guided by the entity creation tutorial, but i think it would be slow compared to the Pre and PostUpdate functions inside the gazebo system plugin. Another problem with this is that one of the posibilities of visualizing the points would be to create a mesh inside the PreUpdate and the services only (to my knowleadge) support meshes by sdf URI tag, and creating a file every time i use ray tracing would be too slow

ECM code block:

rgl_visual = _ecm.CreateEntity();
sdf::Geometry sdf_geometry;
sdf_geometry.SetType(sdf::GeometryType::BOX);
sdf::Box box;
box.SetSize(ignition::math::Vector3d(1, 1, 1));
sdf_geometry.SetBoxShape(box);
auto component_geometry = ignition::gazebo::components::Geometry(sdf_geometry);
_ecm.CreateComponent(rgl_visual, component_geometry);
_ecm.CreateComponent(rgl_visual, ignition::gazebo::components::Visual());
_ecm.CreateComponent(rgl_visual, ignition::gazebo::components::Name("rgl_visual"));
_ecm.CreateComponent(rgl_visual, ignition::gazebo::components::Pose(ignition::math::Pose3d(4, 0, 0, 0, 0, 0)));
_ecm.SetParentEntity(rgl_visual, WORLD_ENTITY_ID);
_eventMgr.Emit<ignition::gazebo::events::SceneUpdate>();

GUI rendering plugin code block:

void RenderingGuiPlugin::PerformRenderingOperations()
{
  if (!this->dirty)
  {
    return;
  }

  if (nullptr == this->scene)
  {
    this->FindScene();
  }

  if (nullptr == this->scene)
    return;

  auto marker = scene->CreateMarker();
  marker->SetType(ignition::rendering::MarkerType::MT_POINTS);
  marker->AddPoint(2, 2, 2, ignition::math::Color::Red);
  marker->SetLifetime(20s);

  this->dirty = false;
}

If u have any links to documentation / tutorials regarding points visualization or server-client gazebo entity synchronization, please add them in the comments :)