Page 1 of 1

How to get the height of the map?

Posted: Sat Dec 11, 2021 3:27 am
by Jenn77
I am looking for a function or something to get the heights of the map(near the robot). It should be a 2-D matrix with heights as each element. I want to use the matrix to represent the geographic information which the robot is in. Is there any solution to do that? Thanks for answering!

Re: How to get the height of the map?

Posted: Sat Dec 25, 2021 1:14 am
by eduardo98m
I tried this recently and the most successful, way to do this was to use ray testtig in the x, y coordinate you want to know the height of.
The function you will be looking for may be:

Code: Select all

p.rayTest((x, y, z_f),(x, y, z_o)) 
There is also a variant to perform a batch rayTest.

You may also want to check if the ray collides with the terrain ant not the robot. In the case the ray collydes with the robot try castin the ray from below the terrain.