Robotics StackExchange | Archived questions

Add created mesh to visual via visual plugin

Hello dear Gazebo Community,

I am new to Gazebo and am trying to write a visual plugin which should change this visual. Everytime when a callback function gets called then the visual should be updated (the visual gets a new mesh - a polyline - attached to it and the previous one should be deleted). I am generating the mesh by the function createextrudedPolyline and I can attach this mesh to my visual. But I can't see any changes or in other words the created mesh does not appear in the scene although the scene graph tells me that the mesh is attached to my visual. Do I have to add a material to my generated mesh or why is it not shown in the scene? What are the further steps to use the create mesh and is it created correctly here?
Please help me. Thank you.

Here is a snippet of my code:
```
void cbgetvisualmsg(ConstVisualPtr &msg){

// generating new mesh (polylines contains the vertex data) common::MeshManager::Instance()->CreateExtrudedPolyline("VisualPolyName", polylines, 1.0);
// attach it to my visual
this->visual->InsertMesh("VisualPolyName");
Ogre::MovableObject * MO = this->visual->AttachMesh("VisualPolyName");
this->visual->SetVisible(true);
this->visual->Update();
} ```

Asked by SneakPete on 2021-07-14 03:30:08 UTC

Comments

Answers