ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
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',
});
for(var j=cloudClient.points.sn.children.length-1; j>=0; j--){
cloudClient.points.sn.remove(cloudClient.points.sn.children[j]);
}
viewer.scene.remove(cloudClient.points.sn);
2 | No.2 Revision |
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=cloudClient.points.sn.children.length-1; j>=0; j=cloudClient.points.sn.children.length; j>0; j--){
cloudClient.points.sn.remove(cloudClient.points.sn.children[j]);
cloudClient.points.sn.remove(cloudClient.points.sn.children[j-1]);
viewer.scene.remove(cloudClient.points.sn);
}
viewer.scene.remove(cloudClient.points.sn);
}