ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

How to delete markers from a ros3djs viewer?

asked 2021-06-12 15:46:43 -0600

Py gravatar image

Could anyone share an example of how to delete markers in a ros3djs viewer?

From the docs here I can see that a method is available called eraseIntMarker() however I cannot work out how to use it. In particular, it expects the marker name to be provided but I’m am not sure how to specify this. For example, I publish my marker using the following code snippet but a marker name is not specified as such - just a topic.

let imClient = new ROS3D.InteractiveMarkerClient({
                ros : this.ros,
                tfClient : tfClient,
                topic : '/my_interactive_marker_topic',
                camera : viewer.camera,
                rootObject : viewer.selectableObjects
            });

Does this mean that I specify imClient as the name or do I extract the individual namespace and marker_id and provide that to the function somehow?

I’m really unsure how to go about this so it’d be great to see a code snippet.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2022-04-21 09:55:10 -0600

rafRobot gravatar image

I have created this function to delete PointCloud2

removeObject3D(object3D) {
    if (this.viewer === undefined)
        return -1;

    if (object3D.points.object === undefined)
        return 2;

    let parentScene = object3D.points.object.parent;
    //this.viewer.scene.remove(parentScene);
    this.viewer.scene.children = this.viewer.scene.children.filter(function(value, index, arr){ 
        return value.uuid !== parentScene.uuid;
    });

    return 1;
}

It is working by searching for the scene that his the parent of the PointCloud2 object then we remove this scene from the main scene's childs.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2021-06-12 15:46:43 -0600

Seen: 399 times

Last updated: Jun 12 '21