Base class for reactive navigator systems based on TP-Space, with an arbitrary holonomic reactive method running on it and any number of PTGs for transforming the navigation space.
Both, the holonomic method and the PTGs can be customized by the apropriate user derived classes.
How to use:
For working examples, refer to the source code of the apps:
Publications:
Definition at line 46 of file CAbstractPTGBasedReactive.h.
#include <mrpt/nav/reactive/CAbstractPTGBasedReactive.h>
Classes | |
struct | THolonomicMovement |
The structure used for storing a movement generated by a holonomic-method. More... | |
struct | TInfoPerPTG |
struct | TNavigationParamsPTG |
The struct for configuring navigation requests to CAbstractPTGBasedReactive and derived classes. More... | |
Public Types | |
enum | TState { IDLE =0 , NAVIGATING , SUSPENDED , NAV_ERROR } |
The different states for the navigation system. More... | |
Public Member Functions | |
CAbstractPTGBasedReactive (CReactiveInterfaceImplementation &react_iterf_impl, bool enableConsoleOutput=true, bool enableLogFile=false) | |
Constructor. | |
virtual | ~CAbstractPTGBasedReactive () |
void | initialize () |
Must be called for loading collision grids, or the first navigation command may last a long time to be executed. | |
void | setHolonomicMethod (THolonomicMethod method, const mrpt::utils::CConfigFileBase &cfgBase) |
Selects which one from the set of available holonomic methods will be used into transformed TP-Space, and sets its configuration from a configuration file. | |
void | loadHolonomicMethodConfig (const mrpt::utils::CConfigFileBase &ini, const std::string §ion) |
Just loads the holonomic method params from the given config source. | |
virtual void | navigate (const TNavigationParams *params) |
Start navigation: | |
void | getLastLogRecord (CLogFileRecord &o) |
Provides a copy of the last log record with information about execution. | |
void | enableKeepLogRecords (bool enable=true) |
Enables keeping an internal registry of navigation logs that can be queried with getLastLogRecord() | |
void | enableLogFile (bool enable) |
Enables/disables saving log files. | |
void | enableTimeLog (bool enable=true) |
Enables/disables the detailed time logger (default:disabled upon construction) When enabled, a report will be dumped to std::cout upon destruction. | |
const mrpt::utils::CTimeLogger & | getTimeLogger () const |
Gives access to a const-ref to the internal time logger. | |
virtual size_t | getPTG_count () const =0 |
Returns the number of different PTGs that have been setup. | |
virtual CParameterizedTrajectoryGenerator * | getPTG (size_t i)=0 |
Gets the i'th PTG. | |
void | cancel () |
Cancel current navegacion. | |
void | resume () |
Continues with suspended navigation. | |
void | navigationStep () |
This method must be called periodically in order to effectively run the navigation. | |
virtual void | suspend () |
Suspend current navegation. | |
TState | getCurrentState () const |
Returns the current navigator state. | |
Static Public Member Functions | |
static void | printf_debug (const char *frmt,...) |
Sends a formated text to "debugOut" if not NULL, or to cout otherwise. | |
Protected Member Functions | |
void | performNavigationStep () |
The main method for the navigator. | |
void | doEmergencyStop (const char *msg) |
Stops the robot and set navigation state to error. | |
virtual void | STEP1_CollisionGridsBuilder ()=0 |
virtual bool | STEP2_SenseObstacles ()=0 |
Return false on any fatal error. | |
virtual void | STEP3_WSpaceToTPSpace (const size_t ptg_idx, std::vector< float > &out_TPObstacles)=0 |
Builds TP-Obstacles from Workspace obstacles for the given PTG. | |
virtual void | loggingGetWSObstaclesAndShape (CLogFileRecord &out_log)=0 |
Generates a pointcloud of obstacles, and the robot shape, to be saved in the logging record for the current timestep. | |
void | STEP5_PTGEvaluator (THolonomicMovement &holonomicMovement, const std::vector< float > &in_TPObstacles, const mrpt::math::TPose2D &WS_Target, const mrpt::math::TPoint2D &TP_Target, CLogFileRecord::TInfoPerPTG &log) |
Scores holonomicMovement. | |
virtual void | STEP7_GenerateSpeedCommands (const THolonomicMovement &in_movement) |
void | preDestructor () |
To be called during children destructors to assure thread-safe destruction, and free of shared objects. | |
Protected Attributes | |
std::vector< CAbstractHolonomicReactiveMethod * > | m_holonomicMethod |
The holonomic navigation algorithm (one object per PTG, so internal states are maintained) | |
mrpt::utils::CStream * | m_logFile |
The current log file stream, or NULL if not being used. | |
bool | m_enableKeepLogRecords |
See enableKeepLogRecords. | |
CLogFileRecord | lastLogRecord |
The last log. | |
float | last_cmd_v |
float | last_cmd_w |
float | new_cmd_v |
float | new_cmd_w |
Speed actual and last commands: | |
bool | navigationEndEventSent |
Will be false until the navigation end is sent, and it is reset with each new command. | |
synch::CCriticalSection | m_critZoneLastLog |
synch::CCriticalSection | m_critZoneNavigating |
Critical zones. | |
bool | m_enableConsoleOutput |
Enables / disables the console debug output. | |
bool | m_init_done |
Whether loadConfigFile() has been called or not. | |
mrpt::utils::CTicTac | timerForExecutionPeriod |
std::string | ptg_cache_files_directory |
(Default: ".") | |
std::string | robotName |
Robot name. | |
float | refDistance |
"D_{max}" in papers. | |
float | colGridRes |
CollisionGrid resolution. | |
float | robotMax_V_mps |
Max. linear speed (m/s) | |
float | robotMax_W_degps |
Max. angular speed (deg/s) | |
float | SPEEDFILTER_TAU |
Time constant for the low-pass filter applied to the speed commands. | |
std::vector< float > | weights |
length: 6 [0,5] | |
float | secureDistanceStart |
In normalized distances, the start and end of a ramp function that scales the velocity output from the holonomic navigator: | |
float | secureDistanceEnd |
float | DIST_TO_TARGET_FOR_SENDING_EVENT |
float | meanExecutionPeriod |
Runtime estimation of execution period of the method. | |
mrpt::utils::CTimeLogger | m_timelogger |
A complete time logger. | |
float | badNavAlarm_minDistTarget |
For sending an alarm (error event) when it seems that we are not approaching toward the target in a while... | |
mrpt::system::TTimeStamp | badNavAlarm_lastMinDistTime |
float | badNavAlarm_AlarmTimeout |
bool | m_collisionGridsMustBeUpdated |
TState | m_navigationState |
Current internal state of navigator: | |
TNavigationParams * | m_navigationParams |
Current navigation parameters. | |
CReactiveInterfaceImplementation & | m_robot |
The navigator-robot interface. | |
Variables for CReactiveNavigationSystem::performNavigationStep | |
mrpt::utils::CTicTac | totalExecutionTime |
mrpt::utils::CTicTac | executionTime |
mrpt::utils::CTicTac | tictac |
float | meanExecutionTime |
float | meanTotalExecutionTime |
Private Member Functions | |
void | deleteHolonomicObjects () |
Delete m_holonomicMethod. | |
Private Attributes | |
bool | m_closing_navigator |
Signal that the destructor has been called, so no more calls are accepted from other threads. | |
std::vector< TInfoPerPTG > | m_infoPerPTG |
Temporary buffers for working with each PTG during a navigationStep() | |
TState | m_lastNavigationState |
Last internal state of navigator: | |
|
inherited |
The different states for the navigation system.
Enumerator | |
---|---|
IDLE | |
NAVIGATING | |
SUSPENDED | |
NAV_ERROR |
Definition at line 145 of file CAbstractReactiveNavigationSystem.h.
mrpt::nav::CAbstractPTGBasedReactive::CAbstractPTGBasedReactive | ( | CReactiveInterfaceImplementation & | react_iterf_impl, |
bool | enableConsoleOutput = true , |
||
bool | enableLogFile = false |
||
) |
Constructor.
[in] | react_iterf_impl | An instance of an object that implement all the required interfaces to read from and control a robot. |
[in] | enableConsoleOutput | Can be set to false to reduce verbosity. |
[in] | enableLogFile | Set to true to enable creation of navigation log files, useful for inspection and debugging. |
|
virtual |
|
inherited |
Cancel current navegacion.
|
private |
Delete m_holonomicMethod.
|
protected |
Stops the robot and set navigation state to error.
|
inline |
Enables keeping an internal registry of navigation logs that can be queried with getLastLogRecord()
Definition at line 106 of file CAbstractPTGBasedReactive.h.
void mrpt::nav::CAbstractPTGBasedReactive::enableLogFile | ( | bool | enable | ) |
Enables/disables saving log files.
|
inline |
Enables/disables the detailed time logger (default:disabled upon construction) When enabled, a report will be dumped to std::cout upon destruction.
Definition at line 115 of file CAbstractPTGBasedReactive.h.
References MRPT_UNUSED_PARAM.
|
inlineinherited |
Returns the current navigator state.
Definition at line 154 of file CAbstractReactiveNavigationSystem.h.
void mrpt::nav::CAbstractPTGBasedReactive::getLastLogRecord | ( | CLogFileRecord & | o | ) |
Provides a copy of the last log record with information about execution.
o | An object where the log will be stored into. |
|
pure virtual |
Gets the i'th PTG.
Implemented in mrpt::nav::CReactiveNavigationSystem, and mrpt::nav::CReactiveNavigationSystem3D.
|
pure virtual |
Returns the number of different PTGs that have been setup.
Implemented in mrpt::nav::CReactiveNavigationSystem, and mrpt::nav::CReactiveNavigationSystem3D.
|
inline |
Gives access to a const-ref to the internal time logger.
Definition at line 121 of file CAbstractPTGBasedReactive.h.
void mrpt::nav::CAbstractPTGBasedReactive::initialize | ( | ) |
Must be called for loading collision grids, or the first navigation command may last a long time to be executed.
Internally, it just calls STEP1_CollisionGridsBuilder().
void mrpt::nav::CAbstractPTGBasedReactive::loadHolonomicMethodConfig | ( | const mrpt::utils::CConfigFileBase & | ini, |
const std::string & | section | ||
) |
Just loads the holonomic method params from the given config source.
|
protectedpure virtual |
Generates a pointcloud of obstacles, and the robot shape, to be saved in the logging record for the current timestep.
Implemented in mrpt::nav::CReactiveNavigationSystem, and mrpt::nav::CReactiveNavigationSystem3D.
|
virtual |
Start navigation:
[in] | params | Pointer to structure with navigation info (its contents will be copied, so the original can be freely destroyed upon return.) |
Implements mrpt::nav::CAbstractReactiveNavigationSystem.
|
inherited |
This method must be called periodically in order to effectively run the navigation.
|
protectedvirtual |
The main method for the navigator.
Implements mrpt::nav::CAbstractReactiveNavigationSystem.
|
protected |
To be called during children destructors to assure thread-safe destruction, and free of shared objects.
|
staticinherited |
Sends a formated text to "debugOut" if not NULL, or to cout otherwise.
Referenced by mrpt::math::CLevenbergMarquardtTempl< VECTORTYPE, USERPARAM >::execute().
|
inherited |
Continues with suspended navigation.
void mrpt::nav::CAbstractPTGBasedReactive::setHolonomicMethod | ( | THolonomicMethod | method, |
const mrpt::utils::CConfigFileBase & | cfgBase | ||
) |
Selects which one from the set of available holonomic methods will be used into transformed TP-Space, and sets its configuration from a configuration file.
|
protectedpure virtual |
Implemented in mrpt::nav::CReactiveNavigationSystem, and mrpt::nav::CReactiveNavigationSystem3D.
|
protectedpure virtual |
Return false on any fatal error.
Implemented in mrpt::nav::CReactiveNavigationSystem, and mrpt::nav::CReactiveNavigationSystem3D.
|
protectedpure virtual |
Builds TP-Obstacles from Workspace obstacles for the given PTG.
"out_TPObstacles" is already initialized to the proper length and maximum collision-free distance for each "k" trajectory index. Distances are in "pseudo-meters". They will be normalized automatically to [0,1] upon return.
Implemented in mrpt::nav::CReactiveNavigationSystem, and mrpt::nav::CReactiveNavigationSystem3D.
|
protected |
Scores holonomicMovement.
|
protectedvirtual |
|
virtualinherited |
Suspend current navegation.
|
protected |
Definition at line 199 of file CAbstractPTGBasedReactive.h.
|
protected |
Definition at line 198 of file CAbstractPTGBasedReactive.h.
|
protected |
For sending an alarm (error event) when it seems that we are not approaching toward the target in a while...
Definition at line 197 of file CAbstractPTGBasedReactive.h.
|
protected |
CollisionGrid resolution.
Definition at line 167 of file CAbstractPTGBasedReactive.h.
|
protected |
Definition at line 192 of file CAbstractPTGBasedReactive.h.
|
protected |
Definition at line 208 of file CAbstractPTGBasedReactive.h.
|
protected |
Definition at line 155 of file CAbstractPTGBasedReactive.h.
|
protected |
Definition at line 155 of file CAbstractPTGBasedReactive.h.
|
protected |
The last log.
Definition at line 154 of file CAbstractPTGBasedReactive.h.
|
private |
Signal that the destructor has been called, so no more calls are accepted from other threads.
Definition at line 243 of file CAbstractPTGBasedReactive.h.
|
protected |
Definition at line 201 of file CAbstractPTGBasedReactive.h.
|
protected |
Definition at line 157 of file CAbstractPTGBasedReactive.h.
|
protected |
Critical zones.
Definition at line 157 of file CAbstractPTGBasedReactive.h.
|
protected |
Enables / disables the console debug output.
Definition at line 159 of file CAbstractPTGBasedReactive.h.
|
protected |
See enableKeepLogRecords.
Definition at line 153 of file CAbstractPTGBasedReactive.h.
|
protected |
The holonomic navigation algorithm (one object per PTG, so internal states are maintained)
Definition at line 151 of file CAbstractPTGBasedReactive.h.
|
private |
Temporary buffers for working with each PTG during a navigationStep()
Definition at line 255 of file CAbstractPTGBasedReactive.h.
|
protected |
Whether loadConfigFile() has been called or not.
Definition at line 160 of file CAbstractPTGBasedReactive.h.
|
privateinherited |
Last internal state of navigator:
Definition at line 157 of file CAbstractReactiveNavigationSystem.h.
|
protected |
The current log file stream, or NULL if not being used.
Definition at line 152 of file CAbstractPTGBasedReactive.h.
|
protectedinherited |
Current navigation parameters.
Definition at line 164 of file CAbstractReactiveNavigationSystem.h.
|
protectedinherited |
Current internal state of navigator:
Definition at line 163 of file CAbstractReactiveNavigationSystem.h.
|
protectedinherited |
The navigator-robot interface.
Definition at line 167 of file CAbstractReactiveNavigationSystem.h.
|
protected |
A complete time logger.
Definition at line 194 of file CAbstractPTGBasedReactive.h.
|
protected |
Runtime estimation of execution period of the method.
Definition at line 193 of file CAbstractPTGBasedReactive.h.
|
protected |
Definition at line 209 of file CAbstractPTGBasedReactive.h.
|
protected |
Definition at line 209 of file CAbstractPTGBasedReactive.h.
|
protected |
Will be false until the navigation end is sent, and it is reset with each new command.
Definition at line 156 of file CAbstractPTGBasedReactive.h.
|
protected |
Definition at line 155 of file CAbstractPTGBasedReactive.h.
|
protected |
Speed actual and last commands:
Definition at line 155 of file CAbstractPTGBasedReactive.h.
|
protected |
(Default: ".")
Definition at line 164 of file CAbstractPTGBasedReactive.h.
|
protected |
"D_{max}" in papers.
Definition at line 166 of file CAbstractPTGBasedReactive.h.
|
protected |
Max. linear speed (m/s)
Definition at line 168 of file CAbstractPTGBasedReactive.h.
|
protected |
Max. angular speed (deg/s)
Definition at line 169 of file CAbstractPTGBasedReactive.h.
|
protected |
Robot name.
Definition at line 165 of file CAbstractPTGBasedReactive.h.
|
protected |
Definition at line 189 of file CAbstractPTGBasedReactive.h.
|
protected |
In normalized distances, the start and end of a ramp function that scales the velocity output from the holonomic navigator:
Definition at line 189 of file CAbstractPTGBasedReactive.h.
|
protected |
Time constant for the low-pass filter applied to the speed commands.
Definition at line 170 of file CAbstractPTGBasedReactive.h.
|
protected |
Definition at line 208 of file CAbstractPTGBasedReactive.h.
|
protected |
Definition at line 161 of file CAbstractPTGBasedReactive.h.
|
protected |
Definition at line 208 of file CAbstractPTGBasedReactive.h.
|
protected |
length: 6 [0,5]
Definition at line 171 of file CAbstractPTGBasedReactive.h.
Page generated by Doxygen 1.9.6 for MRPT 1.4.0 SVN: at Wed Mar 22 04:35:51 UTC 2023 |