Ask Your Question

How to remove the existing point cloud from viewer created using ros3djs

asked 2018-09-26 00:42:47 -0500

sharath gravatar image

I have multiple sub-clouds created after processing the parent cloud. The sub-clouds are being sent over the topics to be displayed on the 3D viewer in a browser using ros3djs, roslibjs. Since, the number of sub-clouds keeps varying i'll have to remove few clouds after unsubscription of topics.There is no function/option to remove an existing cloud from the viewer after unsubscription. Does anyone know how to do it?

I've tried the option of clearing all the objects in the viewer using "viewer.scene.children = [];" but it also removes other things like the co-ordinate frame, markers which i would like to retain.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2019-02-11 03:08:17 -0500

sharath gravatar image

updated 2019-02-11 03:13:17 -0500

Clearing an existing point cloud from the viewer can be done by first removing the children of points scene associated with the point cloud and then removing points scene from the 3D viewer.

var viewer = new ROS3D.Viewer({ 
  divID : 'webViewer',
  width : 800,
  height : 600,
  antialias : true,
tfClient = new ROSLIB.TFClient({
  ros : ros,
  angularThres : 0.01,
  transThres : 0.01,
  rate : 10.0,
  fixedFrame : '/camera_link'
var cloudClient = new ROS3D.PointCloud2({
  ros: ros,
  tfClient: tfClient,
  rootObject: viewer.scene,
  topic: '/point_cloud_topic',
function removeCloud(){
  for(var; j>0; j--){[j-1]);
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2018-09-26 00:42:47 -0500

Seen: 393 times

Last updated: Feb 11 '19