MRSL Motion Primitive Library
1.2
A motion primitive library for generating trajectory for mobile robots
|
Voxel map environment. More...
#include <env_map.h>
Public Member Functions | |
env_map (std::shared_ptr< MapUtil< Dim >> map_util) | |
Constructor with map util as input. | |
bool | is_goal (const Waypoint< Dim > &state) const |
Check if state hit the goal region, use L-1 norm. | |
bool | is_free (const Vecf< Dim > &pt) const |
Check if a point is in free space. | |
bool | is_free (const Primitive< Dim > &pr) const |
Check if the primitive is in free space. More... | |
decimal_t | traverse_primitive (const Primitive< Dim > &pr) const |
Accumulate the cost along the primitive. More... | |
void | get_succ (const Waypoint< Dim > &curr, vec_E< Waypoint< Dim >> &succ, std::vector< decimal_t > &succ_cost, std::vector< int > &action_idx) const |
Get successor. More... | |
void | set_gradient_map (const vec_E< Vecf< Dim >> &map) |
Set gradient map. | |
void | set_gradient_weight (decimal_t w) |
Set gradient weight. | |
void | set_potential_map (const std::vector< int8_t > &map) |
Set potential map. | |
void | set_potential_weight (decimal_t w) |
Set potential weight. | |
void | set_prior_trajectory (const Trajectory< Dim > &traj) |
Set prior trajectory. | |
decimal_t | traverse_trajectory (const Trajectory< Dim > &traj) const |
traverse trajectory | |
void | info () |
Print out params. | |
![]() | |
env_base () | |
Simple constructor. | |
virtual decimal_t | get_heur (const Waypoint< Dim > &state) const |
Heuristic function. More... | |
virtual decimal_t | cal_heur (const Waypoint< Dim > &state, const Waypoint< Dim > &goal) const |
calculate the cost from state to goal | |
Veci< Dim > | round (const Vecf< Dim > &vec, decimal_t res) const |
Replace the original cast function. | |
std::string | to_string (const Veci< Dim > &vec) const |
Convert a vec to a string. | |
void | forward_action (const Waypoint< Dim > &curr, int action_id, Primitive< Dim > &pr) const |
Recover trajectory. | |
void | set_u (const vec_E< VecDf > &U) |
Set control input. | |
void | set_v_max (decimal_t v) |
Set max vel in each axis. | |
void | set_a_max (decimal_t a) |
Set max acc in each axis. | |
void | set_j_max (decimal_t j) |
Set max acc in each axis. | |
void | set_yaw_max (decimal_t yaw) |
Set max acc in each axis. | |
void | set_dt (decimal_t dt) |
Set dt for primitive. | |
void | set_tol_pos (decimal_t pos) |
Set distance tolerance for goal region. | |
void | set_tol_vel (decimal_t vel) |
Set velocity tolerance for goal region. | |
void | set_tol_acc (decimal_t acc) |
Set acceleration tolerance for goal region. | |
void | set_tol_yaw (decimal_t yaw) |
Set acceleration tolerance for goal region. | |
void | set_w (decimal_t w) |
set weight for cost in time, usually no need to change | |
void | set_wyaw (decimal_t wyaw) |
set weight for cost in yaw, usually no need to change | |
void | set_t_max (int t) |
Set max time. | |
bool | set_goal (const Waypoint< Dim > &state) |
Set goal state. | |
void | set_search_region (const std::vector< bool > &search_region) |
Set valid search region (tunnel constraint) | |
void | set_heur_ignore_dynamics (bool ignore) |
Set heur_ignore_dynamics. | |
virtual decimal_t | calculate_intrinsic_cost (const Primitive< Dim > &pr) const |
decimal_t | get_dt () const |
Retrieve dt. | |
std::vector< bool > | get_search_region () const |
Get the valid region. | |
Protected Attributes | |
std::shared_ptr< MapUtil< Dim > > | map_util_ |
Collision checking util. | |
std::vector< int8_t > | potential_map_ |
Potential map, optional. | |
vec_E< Vecf< Dim > > | gradient_map_ |
Gradient map, optional. | |
decimal_t | potential_weight_ {0.1} |
Weight of potential value. | |
decimal_t | gradient_weight_ {0.0} |
Weight of gradient value. | |
Additional Inherited Members | |
![]() | |
bool | heur_ignore_dynamics_ {true} |
if enabled, ignore dynamics when calculate heuristic | |
decimal_t | w_ {10.0} |
weight of time cost | |
decimal_t | wyaw_ {1.0} |
weight of yaw | |
decimal_t | tol_pos_ {0.5} |
tolerance of position for goal region, 0.5 is the default | |
decimal_t | tol_vel_ {-1.0} |
tolerance of velocity for goal region, 0 means no tolerance | |
decimal_t | tol_acc_ {-1.0} |
tolerance of acceleration for goal region, 0 means no tolerance | |
decimal_t | tol_yaw_ {-1.0} |
tolerance of yaw for goal region, 0 means no tolerance | |
decimal_t | v_max_ {-1.0} |
max velocity | |
decimal_t | a_max_ {-1.0} |
max acceleration | |
decimal_t | j_max_ {-1.0} |
max jerk | |
decimal_t | yaw_max_ {-1.0} |
max yaw | |
decimal_t | t_max_ {std::numeric_limits<decimal_t>::infinity()} |
max time | |
decimal_t | dt_ {1.0} |
duration of primitive | |
vec_E< VecDf > | U_ |
Array of constant control input. | |
Waypoint< Dim > | goal_node_ |
Goal node. | |
vec_E< std::pair< Waypoint< Dim >, decimal_t > > | prior_traj_ |
Prior trajectory. | |
std::vector< bool > | search_region_ |
Valid search region (tunnel constraint) | |
vec_Vecf< Dim > | expanded_nodes_ |
expanded nodes for debug | |
vec_E< Primitive< Dim > > | expanded_edges_ |
expanded edges for debug | |
Voxel map environment.
|
inlinevirtual |
Get successor.
curr | The node to expand |
succ | The array stores valid successors |
succ_cost | The array stores cost along valid edges |
action_idx | The array stores corresponding idx of control input for each successor |
When goal is outside, extra step is needed for finding optimal trajectory. Only return the primitive satisfies valid dynamic constriants (include the one hits obstacles).
Reimplemented from MPL::env_base< Dim >.
|
inlinevirtual |
Check if the primitive is in free space.
Sample points along the primitive, and check each point for collision; the number of sampling is calculated based on the maximum velocity and resolution of the map.
Reimplemented from MPL::env_base< Dim >.
|
inline |
Accumulate the cost along the primitive.
Sample points along the primitive, and sum up the cost of each point; number of sampling is calculated based on the maximum velocity and resolution of the map.
If the potential map has been set, it also uses the potential values; otherwise, the accumulated value will be zero for collision-free primitive and infinity for others.