RoboJackets / urc-software

Primary codebase for the RoboNav team's URC rover.
https://robojackets.org/teams/robonav/
MIT License
8 stars 1 forks source link

Gather Elevation Map Data #99

Closed anshgandhi4 closed 5 months ago

anshgandhi4 commented 1 year ago

Get good quality elevation map for URC area.

rhkoulen commented 1 year ago

This is a good source for elevation data: https://gis.utah.gov/data/elevation-and-terrain/2018-lidar-southern-utah/ It has 0.25 sqm. pixel resolution (each pixel corresponds to a 0.5x0.5m square). Each data point has vertical accuracy ±0.1m. To download the data:

It will be zipped in GeoTiff format. This is a rastered image file format. You can technically extract data directly, but there is a more practical way to retrieve the raw data:

I'm not sure what the x and y values are yet. They're definitely in meters, which is probably sufficient for generating the costmap, but we want to have some sense of x-y to coordinates, so we can initialize the pose of the rover.

rhkoulen commented 1 year ago

We already have the set of elevation points (see Issue #99) and NumPy has a vectorized framework to convert discretized elevation data to slope data.

granularity = 0.5 # our current best data has an axis granularity of 0.5 meters
elevation = np.array() # parse the .xyz elevation data into a NumPy array
x_grad, y_grad = np.gradient(elevation)
x_grad, y_grad = x_grad / granularity, y_grad / granularity
slope = np.sqrt(np.power(x_grad, 2) + np.power(y_grad, 2))
# Square root is not necessary. The sqrt just makes it a real slope value.
# We may even want to transform these values during testing depending on the behavior of the robot.
# Just make sure any transformations are monotone.

Because it's vectorized, this will be faster than any kernelization I would write. We can just use a ROS Python node to parse this data and create the static layer of the 2D costmap. I'm pretty sure we can just directly parse this data into the static layer. But how would that parsing look like? How is the static layer used? How can we use the 2D costmap to make a planned path? If we ever use vision, how do we import that dynamic obstacle layer into this costmap?

rhkoulen commented 1 year ago

costmap_2d subscribes to a topic called "map" which takes an OccupancyGrid message. At 3.1.2 here, this allows us to initialize the costmap from a user-generated static map.