MRSL Motion Primitive Library  1.2
A motion primitive library for generating trajectory for mobile robots
Public Member Functions | Public Attributes | List of all members
MPL::env_base< Dim > Class Template Reference

Base environment class. More...

#include <env_base.h>

Inheritance diagram for MPL::env_base< Dim >:
MPL::env_map< Dim >

Public Member Functions

 env_base ()
 Simple constructor.
 
virtual bool is_goal (const Waypoint< Dim > &state) const
 Check if state hit the goal region, use L-1 norm.
 
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.
 
virtual void set_prior_trajectory (const Trajectory< Dim > &traj)
 Set prior trajectory.
 
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
 
virtual void set_potential_weight (decimal_t w)
 set weight for cost in time, usually no need to change
 
virtual void set_gradient_weight (decimal_t w)
 set weight for cost in time, usually no need to change
 
virtual void set_potential_map (const std::vector< int8_t > &map)
 set weight for cost in time, usually no need to change
 
virtual void set_gradient_map (const vec_E< Vecf< Dim >> &map)
 set weight for cost in time, 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 void info ()
 Print out params.
 
virtual bool is_free (const Vecf< Dim > &pt) const
 Check if a point is in free space.
 
virtual bool is_free (const Primitive< Dim > &pr) const
 Check if a primitive is in free space.
 
virtual decimal_t calculate_intrinsic_cost (const Primitive< Dim > &pr) const
 
decimal_t get_dt () const
 Retrieve dt.
 
virtual 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...
 
std::vector< bool > get_search_region () const
 Get the valid region.
 

Public Attributes

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< VecDfU_
 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
 

Detailed Description

template<int Dim>
class MPL::env_base< Dim >

Base environment class.

Member Function Documentation

◆ get_heur()

template<int Dim>
virtual decimal_t MPL::env_base< Dim >::get_heur ( const Waypoint< Dim > &  state) const
inlinevirtual

Heuristic function.

Parameters
Waypointcurrent state coord
tcurrent state time

◆ get_succ()

template<int Dim>
virtual void MPL::env_base< Dim >::get_succ ( const Waypoint< Dim > &  curr,
vec_E< Waypoint< Dim >> &  succ,
std::vector< decimal_t > &  succ_cost,
std::vector< int > &  action_idx 
) const
inlinevirtual

Get successor.

Parameters
currThe node to expand
succThe array stores valid successors
succ_costThe array stores cost along valid edges
action_idxThe array stores corresponding idx of control for each successor

Reimplemented in MPL::env_map< Dim >.


The documentation for this class was generated from the following file: