How to view several markers on web GUI using ros3djs?

asked 2021-03-30 04:03:31 -0600

Py gravatar image

I'd like to be able to view several markers on a web GUI using ros3djs. I have found that when I use the following code snippet the markers disappear and only 1 is viewed at a time:

let markerClient = new ROS3D.MarkerClient({
    ros : this.ros,
    tfClient : tfClient,
    topic : '/visualization_marker',
    rootObject : viewer.scene
});

To try and solve this, I've used a MarkerArrayClient instead (see below). However, this has the same behaviour and only displays one marker on my web GUI at a time rather than all the markers in the array.

let markerArrayClient = new ROS3D.MarkerArrayClient({
    ros : this.ros,
    tfClient : tfClient,
    topic : '/visualization_marker_array',
    rootObject : viewer.scene
});

Any idea how to solve this?

edit retag flag offensive close merge delete

Comments

We are doing it basically exactly like you are and it is working. I don't see anything wrong with your code.

So to double-check:

  • Are you publishing the markers in the Array one by one or all at once?
  • Do the markers have different IDs?
  • Could you provide a short bagfile of the two topics? This would help a lot with debugging.
mgruhler gravatar image mgruhler  ( 2021-03-30 07:11:53 -0600 )edit

Markers are being published one by one and I have verified they have unique IDs. I've been debugging and found that problem originates from the marker frame, which is set to base_link, and the marker pose, which is the same for each marker. This allows a marker to be placed relative to my robots position in the map very easily. In RViz, this is displayed as I'd like, i.e. a marker is placed at the robots position when some data is received and this persists in the RViz GUI for visualisation. However, this is not the case when viewing the markers through ros3dlib as they do not persist as they just overwrite the last one. To solve, it looks to me like I can either set the marker frame to map and then work out and specify the marker pose in this frame. However, I'm unsure ...(more)

Py gravatar image Py  ( 2021-03-30 08:12:04 -0600 )edit

Anyone got any more ideas on this? I've posted this question to provide more info and try to get to the bottom of this.

Py gravatar image Py  ( 2021-04-20 03:37:22 -0600 )edit