# Calculating the distance between two planes in rviz

Hello everyone, I am working on a project to calculate the distance between the vehicle's base and the ground. I am working on Ubuntu 11.10 with ROS-electric(with PCL) and using Asus xtion pro live RGB-D sensor. I have successfully filtered two planes. Necessary for the foot placement of a humanoid robot. Here is the video: http://www.youtube.com/watch?v=6x4PLk89mig . Is there an easy way to calculate the distance between these two planes rather than me plugging in formula(or developing a ROS node) to calculate the distance between the planes.

thanks, karthik.

edit retag close merge delete

Sort by » oldest newest most voted

You've already written a ROS node in C++ to find the two planes, right? You can do the calculation in that same node using C++.

What specifically do you want to calculate? The vertical distance between planes? Or the distance between the closest two points on the planes? Or something else? Either of these could be calculated using PCL/Eigen

Also, electric is a pretty old version of ROS, you may want to upgrade to fuerte or groovy if you can :-)

more the distance between two planes is always zero unless they are parallel. so i assume in your case the two planes are parallel. the mathematical expression of a plane is ax+by+cz+d=0. if two planes are parallel, they should have the same coefficients a, b and c. so let's say plane 1 is: ax+by+cz+d1=0, plane 2 is: ax+by+cz+d2=0. in this case the distance between these two planes is: abs(d1-d2)/sqrt(a * a+b * b+c * c). if you are using PCL to fit the plane, you will get four coefficient for a plane, which just correspond to a, b, c and d as mentioned above.

more