Ask Your Question

publishing "0" points in a point cloud

asked 2014-10-05 08:35:55 -0500

Garrick gravatar image

hi all. basically my problem is with clearing a costmap when using a point cloud to add obstacles to it.

the video above pretty much shows what's going on. i just put a couple of points in a straight line (ultimately the point cloud will come from a camera, but this indicates the problem i am having).

it's not clearing. i think i've set the clearing distance fine. i'll post it once i boot up ubuntu.

i'm thinking it may be because i need to publish "0" points to clear the line i'm making. otherwise there's really nothing to clear the costmap. i'm not too sure what value i should use for these "0" points -- i tried 0 and they actually came up as obstacles too when put into the costmap.

if anyone can help with this i'll be extremely grateful...

thank you for your time.

edit retag flag offensive close merge delete


So I guess you are using a voxel map as costmap? What do you mean exactly by camera?

AReimann gravatar image AReimann  ( 2014-10-12 22:20:42 -0500 )edit

i think i was using a voxel layer instead of an obstacle layer. do you think this will make a difference with the clearing? the camera will ultimately generate the poincloud. but in the video i just put a line of points. this is solved using the cloud->laser but i will now try with an obstacle layer

Garrick gravatar image Garrick  ( 2014-10-12 22:39:52 -0500 )edit

Shouldn't make a difference. By camera I was more thinking about if it is a depth camera or something else which can only output "valid" points, so not out of measurement range etc. See answer,

AReimann gravatar image AReimann  ( 2014-10-12 22:53:55 -0500 )edit

3 Answers

Sort by ยป oldest newest most voted

answered 2014-10-05 11:46:53 -0500

paulbovbel gravatar image

updated 2014-10-05 14:42:19 -0500

I'm not entirely sure what you mean by

i just put a couple of points in a straight line

but I think I understand where the confusion is coming from. When the costmap receives the cloud, each point in your pointcloud will be processed as an observation. If marking is enabled, the costmap will then mark an obstacle at the point. If clearing is enabled, it will raytrace clear space inbetween the robot and the point. So if you send an empty pointcloud, nothing at all will happen, because you have no observations. Similarly, a lack of points along a direction does not automatically clear the space either. This may not be obvious from the documentation, so it helps to dig into the source when something isn't clear.

You may think 'no points means no obstacles', however the pointcloud doesn't actually contain any information about how much space it contains, only the points that are present. An empty cloud may also represent a sensor malfuntion, or a blind spot in the sensor's FOV, so the costmap can't assume clear space and clear the obstacles.

The way I got around this issue is to convert the pointcloud into a laserscan, with max_sensor_range along rays where no point is detected. This is essentially you doing your own raytracing. Sadly, the pointcloud_to_laserscan package that used to do this doesn't exist anymore (used to be in the original turtlebot repo), but I've added it back to perception_pcl. These changes aren't released into ROS yet, so you can clone and compile the pointcloud_to_laserscan package yourself.

edit flag offensive delete link more


ah. thanks Paul. that makes sense now.

Garrick gravatar image Garrick  ( 2014-10-05 14:40:33 -0500 )edit

Paul. Have you tested that code? the node starts up fine but when I echo the laser scan topic it dies with this error:

process[pointcloud_to_laserscan-1]: started with pid [8313] pointcloud_to_laserscan: /usr/include/boost/smart_ptr/shared_ptr.hpp:653: typename boost::detail::sp_member_access<t>::t

Garrick gravatar image Garrick  ( 2014-10-08 05:23:09 -0500 )edit

ype boost::shared_ptr<t>::operator->() const [with T = const pcl::PointCloud<pcl::pointxyz>; typename boost::detail::sp_member_access<t>::type = const pcl::PointCloud<pcl::pointxyz>*]: Assertion `px != 0' failed.

Garrick gravatar image Garrick  ( 2014-10-08 05:24:07 -0500 )edit

Thanks, think I found the problem, fixed. If you have any issues, please open a ticket on github.

paulbovbel gravatar image paulbovbel  ( 2014-10-08 11:57:45 -0500 )edit

thanks heaps Paul. I'll test it tomorrow.

Garrick gravatar image Garrick  ( 2014-10-09 08:22:17 -0500 )edit

answered 2014-10-12 22:52:13 -0500

AReimann gravatar image

updated 2014-10-13 10:12:25 -0500

l0g1x gravatar image

Obstacles get cleared between the camera and a measurement point. Every measurement point with a "normal" value (includes 0 and everything except infinity and NaN) is an obstacle. So what you did is basically say there is an obstacle at each point in front of the robot and its value (which can mean e.g. color) is 0.

Depending on what kind of "camera" you will be using later, set the points and their values as following:

  • Depth camera which also can return measurements like out of range, too close, invalid etc: The best thing is to put the values as described in REP 117 ( ). In case of out of range detections put the infinity value at the point of the measurement ray where the ray leaves the measurement range. This way everything from the camera position to the end of measurement range will be cleared. (code: )

  • "Visual camera" (stereo camera?) which _always_ outputs valid measurement points: Just input your point cloud with the points you get from the camera. The space between the camera position and the points in the pointcloud get cleared.

In both cases check if the settings of the obstacle cloud are set to clearing (It can be clearing and markign at the same time, )

edit flag offensive delete link more

answered 2014-10-05 10:29:19 -0500

l0g1x gravatar image

When you add a sensor source to your common cost map parameters, you should have the clearing option (within defining one of your sensor inputs) set to true. This will allow you to not have to send a 0 point pointcloud because it will take care of clearing the cost map for you.

edit flag offensive delete link more


Also, from your video, it seems like the cost map is constantly marking a area right in front of you, double check to see if your camera isn't catching a edge of your robot

l0g1x gravatar image l0g1x  ( 2014-10-05 10:31:46 -0500 )edit

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: 2014-10-05 08:35:55 -0500

Seen: 1,625 times

Last updated: Oct 13 '14