mdrwiega / depth_nav_tools

A set of tools for mobile robot navigation with the depth sensor
http://wiki.ros.org/depth_nav_tools
Other
56 stars 40 forks source link

Distance to ground calculation #24

Closed nakai-omer closed 1 year ago

nakai-omer commented 1 year ago

Hi,

I would be happy to get a little explanation on the following distance to ground calculation:

dist_to_ground_[i] = sensor_mount_height_ * sin(M_PI / 2 - delta_row_[i]) /
        cos(M_PI / 2 - delta_row_[i] - alpha);

Shouldn't the sin also decrease the alpha? If so, wouldn't it be easier to have:

dist_to_ground_[i] = sensor_mount_height_ * tan(M_PI / 2 - delta_row_[i] - alpha);
mdrwiega commented 1 year ago

Hi,

I think the original formula is right. Please check the below drawing for the case when $\delta$ is equal to half of FOV.

kinect_floor

Assuming that:

Then, the threshold value dist_to_ground (d) can be calculated as $$d= l \cdot sin(\alpha + \gamma ) = \dfrac{h}{cos(\gamma)} \cdot sin(\alpha + \gamma ) = h \cdot \dfrac{sin(\pi/2 - \delta + \alpha)}{cos(\pi/2 - \delta)}$$

The sign near $\delta$ was changed in the code because as I remember the sensor I used returned it with a minus.

You can find more details in the following paper: A set of depth sensor processing ROS tools for wheeled mobile robot navigation .

nakai-omer commented 1 year ago

@mdrwiega amazing thank you very much for the detailed answer