Quad-SDK
|
A terrain map class built for fast and efficient sampling. More...
#include <fast_terrain_map.h>
Public Member Functions | |
FastTerrainMap () | |
Constructor for FastTerrainMap Class. | |
void | loadData (int x_size, int y_size, std::vector< double > x_data, std::vector< double > y_data, std::vector< std::vector< double > > z_data, std::vector< std::vector< double > > nx_data, std::vector< std::vector< double > > ny_data, std::vector< std::vector< double > > nz_data, std::vector< std::vector< double > > z_data_filt, std::vector< std::vector< double > > nx_data_filt, std::vector< std::vector< double > > ny_data_filt, std::vector< std::vector< double > > nz_data_filt) |
Load data from a grid_map::GridMap object into a FastTerrainMap object. | |
void | loadFlat () |
Load in a default terrain map 10x10m, four corners with flat terrain. | |
void | loadFlatElevated (double height) |
Load in a default terrain map 10x10m, four corners with elevated terrain. | |
void | loadSlope (double grade) |
Load in a default terrain map 10x10m, four corners with sloped terrain. | |
void | loadStep (double height) |
Load in a terrain map with a step at x = 0. | |
void | loadDataFromGridMap (const grid_map::GridMap map) |
Load data from a grid_map::GridMap object into a FastTerrainMap object. | |
bool | isInRange (const double x, const double y) const |
Check if map data is defined at a requested location. | |
double | getGroundHeight (const double x, const double y) const |
Return the ground height at a requested location. | |
std::array< double, 3 > | getSurfaceNormal (const double x, const double y) const |
Return the surface normal at a requested location. | |
double | getGroundHeightFiltered (const double x, const double y) const |
Return the filtered ground height at a requested location. | |
std::array< double, 3 > | getSurfaceNormalFiltered (const double x, const double y) const |
Return the filtered surface normal at a requested location. | |
Eigen::Vector3d | getSurfaceNormalFilteredEigen (const double x, const double y) const |
Return the filtered surface normal at a requested location. | |
Eigen::Vector3d | projectToMap (const Eigen::Vector3d point, const Eigen::Vector3d direction) |
Return the (approximate) intersection of the height map and a vector. Returned point lies exactly on the map but not entirely on the vector. | |
std::vector< double > | getXData () const |
Return the vector of x_data of the map. | |
std::vector< double > | getYData () const |
Return the vector of y_data of the map. | |
bool | isEmpty () const |
Determine if the map is empty. | |
Private Member Functions | |
int | getXIndex (const double x) const |
Return the x index. | |
int | getYIndex (const double y) const |
Return the y index. | |
Private Attributes | |
int | x_size_ = 0 |
The number of elements in the x direction. | |
int | y_size_ = 0 |
The number of elements in the y direction. | |
double | x_diff_ |
Distance between nodes in x. | |
double | y_diff_ |
Distance between nodes in y. | |
std::vector< double > | x_data_ |
The vector of x data. | |
std::vector< double > | y_data_ |
The vector of y data. | |
std::vector< std::vector< double > > | z_data_ |
The nested vector of z data at each [x,y] location. | |
std::vector< std::vector< double > > | nx_data_ |
std::vector< std::vector< double > > | ny_data_ |
std::vector< std::vector< double > > | nz_data_ |
std::vector< std::vector< double > > | z_data_filt_ |
The nested vector of filtered z data at each [x,y] location. | |
std::vector< std::vector< double > > | nx_data_filt_ |
std::vector< std::vector< double > > | ny_data_filt_ |
std::vector< std::vector< double > > | nz_data_filt_ |
A terrain map class built for fast and efficient sampling.
FastTerrainMap is a class built for lightweight and efficient sampling of the terrain for height and slope.
FastTerrainMap::FastTerrainMap | ( | ) |
Constructor for FastTerrainMap Class.
double FastTerrainMap::getGroundHeight | ( | const double | x, |
const double | y | ||
) | const |
Return the ground height at a requested location.
[in] | double | x location |
[in] | double | y location |
double FastTerrainMap::getGroundHeightFiltered | ( | const double | x, |
const double | y | ||
) | const |
Return the filtered ground height at a requested location.
[in] | double | x location |
[in] | double | y location |
std::array< double, 3 > FastTerrainMap::getSurfaceNormal | ( | const double | x, |
const double | y | ||
) | const |
Return the surface normal at a requested location.
[in] | double | x location |
[in] | double | y location |
std::array< double, 3 > FastTerrainMap::getSurfaceNormalFiltered | ( | const double | x, |
const double | y | ||
) | const |
Return the filtered surface normal at a requested location.
[in] | double | x location |
[in] | double | y location |
Eigen::Vector3d FastTerrainMap::getSurfaceNormalFilteredEigen | ( | const double | x, |
const double | y | ||
) | const |
Return the filtered surface normal at a requested location.
[in] | double | x location |
[in] | double | y location |
std::vector< double > FastTerrainMap::getXData | ( | ) | const |
Return the vector of x_data of the map.
|
inlineprivate |
Return the x index.
[in] | x | X location of the point |
std::vector< double > FastTerrainMap::getYData | ( | ) | const |
Return the vector of y_data of the map.
|
inlineprivate |
Return the y index.
[in] | y | Y location of the point |
bool FastTerrainMap::isEmpty | ( | ) | const |
Determine if the map is empty.
bool FastTerrainMap::isInRange | ( | const double | x, |
const double | y | ||
) | const |
Check if map data is defined at a requested location.
[in] | double | x location |
[in] | double | y location |
void FastTerrainMap::loadData | ( | int | x_size, |
int | y_size, | ||
std::vector< double > | x_data, | ||
std::vector< double > | y_data, | ||
std::vector< std::vector< double > > | z_data, | ||
std::vector< std::vector< double > > | nx_data, | ||
std::vector< std::vector< double > > | ny_data, | ||
std::vector< std::vector< double > > | nz_data, | ||
std::vector< std::vector< double > > | z_data_filt, | ||
std::vector< std::vector< double > > | nx_data_filt, | ||
std::vector< std::vector< double > > | ny_data_filt, | ||
std::vector< std::vector< double > > | nz_data_filt | ||
) |
Load data from a grid_map::GridMap object into a FastTerrainMap object.
[in] | int | The number of elements in the x direction |
[in] | int | The number of elements in the xy direction |
[in] | std::vector<double> | The vector of x data |
[in] | std::vector<double> | The vector of y data |
[in] | std::vector<std::vector<double>> | The nested vector of z data at each [x,y] location |
[in] | std::vector<std::vector<double>> | The nested vector of the x component of the gradient at each [x,y] location |
[in] | std::vector<std::vector<double>> | The nested vector of the y component of the gradient at each [x,y] location |
[in] | std::vector<std::vector<double>> | The nested vector of the z component of the gradient at each [x,y] location |
void FastTerrainMap::loadDataFromGridMap | ( | const grid_map::GridMap | map | ) |
Load data from a grid_map::GridMap object into a FastTerrainMap object.
[in] | grid_map::GridMap | object with map data |
void FastTerrainMap::loadFlatElevated | ( | double | height | ) |
Load in a default terrain map 10x10m, four corners with elevated terrain.
[in] | height | Height of elevated terrain |
void FastTerrainMap::loadSlope | ( | double | grade | ) |
Load in a default terrain map 10x10m, four corners with sloped terrain.
[in] | grade | Grade of terrain data (grade = tan(slope)) |
void FastTerrainMap::loadStep | ( | double | height | ) |
Load in a terrain map with a step at x = 0.
[in] | height | Height of step |
Eigen::Vector3d FastTerrainMap::projectToMap | ( | const Eigen::Vector3d | point, |
const Eigen::Vector3d | direction | ||
) |
Return the (approximate) intersection of the height map and a vector. Returned point lies exactly on the map but not entirely on the vector.
[in] | point | The point at which the vector originates |
[in] | direction | The direction along which to project the point |
|
private |
The nested vector of the x component of the gradient at each [x,y] location
|
private |
The nested vector of the x component of the filtered gradient at each [x,y] location
|
private |
The nested vector of the y component of the gradient at each [x,y] location
|
private |
The nested vector of the y component of the filtered gradient at each [x,y] location
|
private |
The nested vector of the z component of the gradient at each [x,y] location
|
private |
The nested vector of the z component of the filtered gradient at each [x,y] location