How to view several markers on web GUI using ros3djs?
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?
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:
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. InRViz
, 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 theRViz
GUI for visualisation. However, this is not the case when viewing the markers throughros3dlib
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 tomap
and then work out and specify the marker pose in this frame. However, I'm unsure ...(more)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.