EasyNav Plugins
Loading...
Searching...
No Matches
easynav::navmap Namespace Reference

Classes

class  AMCLLocalizer
 A localization method implementing a simplified AMCL (Adaptive Monte Carlo Localization) approach. More...
class  AStarPlanner
 A planner implementing the A* algorithm on a ::navmap::NavMap grid. More...
class  InflationFilter
struct  LoadParameters
class  NavMapFilter
class  NavMapMapsManager
 A plugin-based map manager using the SimpleMap data structure. More...
class  ObstacleFilter
struct  Particle
 Structure representing a single particle in the AMCL algorithm. More...
class  PerceptionModel
struct  SaveParameters
struct  ScoreAgg
struct  SensorBundle

Typedefs

using ProgressCallback = std::function<void(float)>

Enumerations

enum  LOAD_MAP_STATUS { LOAD_MAP_SUCCESS , MAP_DOES_NOT_EXIST , INVALID_MAP_METADATA , INVALID_MAP_DATA }
enum class  MapMode { Trinary , Scale , Raw }

Functions

void checkSaveParameters (SaveParameters &save_parameters)
 Checks map saving parameters for consistency.
tf2::Matrix3x3 computeCovariance (const std::vector< Particle > &particles, std::size_t start, std::size_t count, const tf2::Vector3 &mean)
tf2::Vector3 computeMean (const std::vector< Particle > &particles, std::size_t start, std::size_t count)
double computeYawVariance (const std::vector< Particle > &particles, std::size_t start, std::size_t count)
std::string expand_user_home_dir_if_needed (std::string yaml_filename, std::string home_dir)
 Expand ~/ to home user dir.
double extractYaw (const tf2::Transform &T)
std::string get_home_dir ()
std::optional< tf2::Quaternion > get_latest_imu_quat (const NavState &nav_state)
std::shared_ptr< Bonxai::ProbabilisticMapinflate_map (const std::shared_ptr< Bonxai::ProbabilisticMap > &src, double sigma, double p_min, ProgressCallback progress=nullptr)
void loadMapFromFile (const LoadParameters &load_parameters, nav_msgs::msg::OccupancyGrid &map)
 Load the image from map file and generate an OccupancyGrid.
LOAD_MAP_STATUS loadMapFromYaml (const std::string &yaml_file, nav_msgs::msg::OccupancyGrid &map)
 Load the map YAML, image from map file and generate an OccupancyGrid.
LoadParameters loadMapYaml (const std::string &yaml_filename)
 Load and parse the given YAML file.
MapMode map_mode_from_string (std::string map_mode_name)
 Convert the name of a map mode to a MapMode enum.
const char * map_mode_to_string (MapMode map_mode)
 Convert a MapMode enum to the name of the map mode.
geometry_msgs::msg::Quaternion orientationAroundZAxis (double angle)
 Get a geometry_msgs Quaternion from a yaw angle.
bool saveMapToFile (const nav_msgs::msg::OccupancyGrid &map, const SaveParameters &save_parameters)
 Write OccupancyGrid map to file.
void tryWriteMapToFile (const nav_msgs::msg::OccupancyGrid &map, const SaveParameters &save_parameters)
 Tries to write map data into a file.
template<typename T>
yaml_get_value (const YAML::Node &node, const std::string &key)
 Get the given subnode value.

Typedef Documentation

◆ ProgressCallback

using ProgressCallback = std::function<void(float)>

Enumeration Type Documentation

◆ LOAD_MAP_STATUS

Enumerator
LOAD_MAP_SUCCESS 
MAP_DOES_NOT_EXIST 
INVALID_MAP_METADATA 
INVALID_MAP_DATA 

◆ MapMode

enum class MapMode
strong
Enumerator
Trinary 

Together with associated threshold values (occupied and free): lightness >= occupied threshold - Occupied (100) ... (anything in between) - Unknown (-1) lightness <= free threshold - Free (0).

Scale 

Together with associated threshold values (occupied and free): alpha < 1.0 - Unknown (-1) lightness >= occ_th - Occupied (100) ... (linearly interpolate to) lightness <= free_th - Free (0).

Raw 

Lightness = 0 - Free (0) ... (linearly interpolate to) Lightness = 100 - Occupied (100) Lightness >= 101 - Unknown.

Function Documentation

◆ checkSaveParameters()

void checkSaveParameters ( SaveParameters & save_parameters)

Checks map saving parameters for consistency.

Parameters
save_parametersMap saving parameters. NOTE: save_parameters could be updated during function execution.
Exceptions
std::exceptionin case of inconsistent parameters

◆ computeCovariance()

tf2::Matrix3x3 computeCovariance ( const std::vector< Particle > & particles,
std::size_t start,
std::size_t count,
const tf2::Vector3 & mean )

◆ computeMean()

tf2::Vector3 computeMean ( const std::vector< Particle > & particles,
std::size_t start,
std::size_t count )

◆ computeYawVariance()

double computeYawVariance ( const std::vector< Particle > & particles,
std::size_t start,
std::size_t count )

◆ expand_user_home_dir_if_needed()

std::string expand_user_home_dir_if_needed ( std::string yaml_filename,
std::string home_dir )

Expand ~/ to home user dir.

Parameters
yaml_filenameName of input YAML file.
home_dirExpanded ~/home dir or empty string if HOME not set
Returns
Expanded string or input string if ~/ not expanded

◆ extractYaw()

double extractYaw ( const tf2::Transform & T)

◆ get_home_dir()

std::string get_home_dir ( )

◆ get_latest_imu_quat()

std::optional< tf2::Quaternion > get_latest_imu_quat ( const NavState & nav_state)

◆ inflate_map()

std::shared_ptr< Bonxai::ProbabilisticMap > inflate_map ( const std::shared_ptr< Bonxai::ProbabilisticMap > & src,
double sigma,
double p_min,
ProgressCallback progress = nullptr )

◆ loadMapFromFile()

void loadMapFromFile ( const LoadParameters & load_parameters,
nav_msgs::msg::OccupancyGrid & map )

Load the image from map file and generate an OccupancyGrid.

Parameters
load_parametersParameters of loading map
mapOutput loaded map
Exceptions
std::exception

◆ loadMapFromYaml()

LOAD_MAP_STATUS loadMapFromYaml ( const std::string & yaml_file,
nav_msgs::msg::OccupancyGrid & map )

Load the map YAML, image from map file and generate an OccupancyGrid.

Parameters
yaml_fileName of input YAML file
mapOutput loaded map
Returns
status of map loaded

◆ loadMapYaml()

LoadParameters loadMapYaml ( const std::string & yaml_filename)

Load and parse the given YAML file.

Parameters
yaml_filenameName of the map file passed though parameter
Returns
Map loading parameters obtained from YAML file
Exceptions
YAML::Exception

◆ map_mode_from_string()

MapMode map_mode_from_string ( std::string map_mode_name)

Convert the name of a map mode to a MapMode enum.

Parameters
map_mode_nameName of the map mode
Exceptions
std::invalid_argumentif the name does not name a map mode
Returns
map mode corresponding to the string

◆ map_mode_to_string()

const char * map_mode_to_string ( MapMode map_mode)

Convert a MapMode enum to the name of the map mode.

Parameters
map_modeMode for the map
Returns
String identifier of the given map mode
Exceptions
std::invalid_argumentif the given value is not a defined map mode

◆ orientationAroundZAxis()

geometry_msgs::msg::Quaternion orientationAroundZAxis ( double angle)

Get a geometry_msgs Quaternion from a yaw angle.

Parameters
angleYaw angle to generate a quaternion from
Returns
geometry_msgs Quaternion

◆ saveMapToFile()

bool saveMapToFile ( const nav_msgs::msg::OccupancyGrid & map,
const SaveParameters & save_parameters )

Write OccupancyGrid map to file.

Parameters
mapOccupancyGrid map data
save_parametersMap saving parameters.
Returns
true or false

◆ tryWriteMapToFile()

void tryWriteMapToFile ( const nav_msgs::msg::OccupancyGrid & map,
const SaveParameters & save_parameters )

Tries to write map data into a file.

Parameters
mapOccupancy grid data
save_parametersMap saving parameters
Exceptions
std::exceptionin case of problem

◆ yaml_get_value()

template<typename T>
T yaml_get_value ( const YAML::Node & node,
const std::string & key )

Get the given subnode value.

The only reason this function exists is to wrap the exceptions in slightly nicer error messages, including the name of the failed key

Exceptions
YAML::Exception