24 CReactiveNavigationSystem3D::TPTGmultilevel::TPTGmultilevel()
28 CReactiveNavigationSystem3D::TPTGmultilevel::~TPTGmultilevel()
30 for (
size_t i=0;i<PTGs.size();i++)
39 CReactiveNavigationSystem3D::CReactiveNavigationSystem3D(
41 bool enableConsoleOutput,
67 for (
unsigned int i=0; i<robotShape.
size(); i++)
97 unsigned int num_levels;
98 vector <float> xaux,yaux;
101 num_levels =
c.read_int(
s,
"HEIGHT_LEVELS", 1,
true);
103 for (
unsigned int i=1;i<=num_levels;i++)
107 c.read_vector(
s,
format(
"LEVEL%d_VECTORX",i), vector<float> (0), xaux,
false);
108 c.read_vector(
s,
format(
"LEVEL%d_VECTORY",i), vector<float> (0), yaux,
false);
109 ASSERT_(xaux.size() == yaux.size());
110 for (
unsigned int j=0;j<xaux.size();j++)
118 unsigned int num_ptgs =
c.read_int(
s,
"PTG_COUNT", 1,
true);
124 for (
unsigned int j=1; j<=num_ptgs; j++)
209 for (
size_t i=0;i<nSlices;i++)
215 const float *xs,*ys,*zs;
219 for (
size_t j=0; j<nPts; j++)
222 for (
size_t idxH=0;idxH<nSlices;++idxH)
232 if (xs[j]>-OBS_MAX_XY && xs[j]<OBS_MAX_XY && ys[j]>-OBS_MAX_XY && ys[j]<OBS_MAX_XY)
249 const size_t ptg_idx,
250 std::vector<double> &out_TPObstacles,
253 const bool eval_clearance)
263 const float *xs,*ys,*zs;
266 for (
size_t obs=0;obs<nObs;obs++)
269 rel_pose_PTG_origin_wrt_sense.
composePoint(xs[obs], ys[obs], ox, oy);
270 m_ptgmultilevel[ptg_idx].PTGs[j]->updateTPObstacle(ox, oy, out_TPObstacles);
271 if (eval_clearance) {
272 m_ptgmultilevel[ptg_idx].PTGs[j]->updateClearance(ox, oy, out_clearance);
327 MRPT_LOG_WARN(
"checkCollisionWithLatestObstacles() skipped: no previous obstacles.");
332 MRPT_LOG_WARN(
"checkCollisionWithLatestObstacles() skipped: no PTGs.");
336 for (
size_t idxH = 0; idxH < nSlices; ++idxH)
339 const float *xs, *ys, *zs;
342 for (
size_t i = 0; i < 1 ; i++)
348 const double R = ptg->getMaxRobotRadius();
349 for (
size_t obs = 0; obs < nObs; obs++)
351 const double gox = xs[obs], goy = ys[obs];
355 if (lo.
x >= -
R && lo.
x <=
R &&
356 lo.
y >= -
R && lo.
y <=
R &&
357 ptg->isPointInsideRobotShape(lo.
x, lo.
y)
#define MRPT_SAVE_CONFIG_VAR_COMMENT(variableName, __comment)
#define MRPT_LOG_WARN(_STRING)
#define MRPT_LOG_DEBUG_FMT(_FMT_STRING,...)
#define MRPT_LOG_INFO_FMT(_FMT_STRING,...)
#define MRPT_LOG_INFO(_STRING)
void clear()
Erase all the contents of the map.
void getPointsBuffer(size_t &outPointsCount, const float *&xs, const float *&ys, const float *&zs) const
Provides a direct access to points buffer, or NULL if there is no points in the map.
void insertAnotherMap(const CPointsMap *otherMap, const mrpt::poses::CPose3D &otherPose)
Insert the contents of another map into this one with some geometric transformation,...
size_t verticesCount() const
Returns the vertices count in the polygon:
void AddVertex(double x, double y)
Add a new vertex to polygon.
CRobot2NavInterface & m_robot
The navigator-robot interface.
mrpt::utils::CTimeLogger m_timlog_delays
Time logger to collect delay-related stats.
Base class for reactive navigator systems based on TP-Space, with an arbitrary holonomic reactive met...
bool m_enableConsoleOutput
Enables / disables the console debug output.
void preDestructor()
To be called during children destructors to assure thread-safe destruction, and free of shared object...
TAbstractPTGNavigatorParams params_abstract_ptg_navigator
bool m_PTGsMustBeReInitialized
virtual void loadConfigFile(const mrpt::utils::CConfigFileBase &c) MRPT_OVERRIDE
Loads all params from a file.
mrpt::utils::CTimeLogger m_timelogger
A complete time logger.
A class for storing, saving and loading a reactive navigation log record for the CReactiveNavigationS...
mrpt::math::CVectorFloat robotShape_x
mrpt::math::CVectorFloat robotShape_y
The robot shape in WS. Used by PTGs derived from mrpt::nav::CPTG_RobotShape_Polygonal.
double robotShape_radius
The circular robot radius. Used by PTGs derived from mrpt::nav::CPTG_RobotShape_Circular.
mrpt::maps::CSimplePointsMap WS_Obstacles
Base class for all PTGs using a 2D circular robot shape model.
void setRobotShapeRadius(const double robot_radius)
Robot shape must be set before initialization, either from ctor params or via this method.
Base class for all PTGs using a 2D polygonal robot shape model.
void setRobotShape(const mrpt::math::CPolygon &robotShape)
Robot shape must be set before initialization, either from ctor params or via this method.
This is the base class for any user-defined PTG.
static CParameterizedTrajectoryGenerator * CreatePTG(const std::string &ptgClassName, const mrpt::utils::CConfigFileBase &cfg, const std::string &sSection, const std::string &sKeyPrefix)
The class factory for creating a PTG from a list of parameters in a section of a given config file (p...
virtual ~CReactiveNavigationSystem3D()
Destructor.
std::vector< TPTGmultilevel > m_ptgmultilevel
The set of PTG-transformations to be used: indices are [ptg_index][height_index].
virtual bool checkCollisionWithLatestObstacles(const mrpt::math::TPose2D &relative_robot_pose) const MRPT_OVERRIDE
Checks whether the robot shape, when placed at the given pose (relative to the current pose),...
TRobotShape m_robotShape
The robot 3D shape model.
bool implementSenseObstacles(mrpt::system::TTimeStamp &obs_timestamp) MRPT_OVERRIDE
Return false on any fatal error.
mrpt::maps::CSimplePointsMap m_WS_Obstacles_unsorted
The unsorted set of obstacles from the sensors.
virtual void loadConfigFile(const mrpt::utils::CConfigFileBase &c) MRPT_OVERRIDE
Loads all params from a file.
virtual void saveConfigFile(mrpt::utils::CConfigFileBase &c) const MRPT_OVERRIDE
Saves all current options to a config file.
virtual void loggingGetWSObstaclesAndShape(CLogFileRecord &out_log) MRPT_OVERRIDE
Generates a pointcloud of obstacles, and the robot shape, to be saved in the logging record for the c...
void STEP3_WSpaceToTPSpace(const size_t ptg_idx, std::vector< double > &out_TPObstacles, mrpt::nav::ClearanceDiagram &out_clearance, const mrpt::math::TPose2D &rel_pose_PTG_origin_wrt_sense, const bool eval_clearance) MRPT_OVERRIDE
Builds TP-Obstacles from Workspace obstacles for the given PTG.
virtual void STEP1_InitPTGs() MRPT_OVERRIDE
void changeRobotShape(TRobotShape robotShape)
Change the robot shape, which is taken into account for collision grid building.
std::vector< mrpt::maps::CSimplePointsMap > m_WS_Obstacles_inlevels
One point cloud per 2.5D robot-shape-slice, coordinates relative to the robot local frame.
The pure virtual interface between a real or simulated robot and any CAbstractNavigator-derived class...
virtual bool senseObstacles(mrpt::maps::CSimplePointsMap &obstacles, mrpt::system::TTimeStamp ×tamp)=0
Return the current set of obstacle points, as seen from the local coordinate frame of the robot.
Clearance information for one particular PTG and one set of obstacles.
A class used to store a 2D pose, including the 2D coordinate point and a heading (phi) angle.
void composePoint(double lx, double ly, double &gx, double &gy) const
An alternative, slightly more efficient way of doing with G and L being 2D points and P this 2D pose...
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
This class allows loading and storing values and vectors of different types from a configuration text...
void enter(const char *func_name)
Start of a named section.
double leave(const char *func_name)
End of a named section.
GLenum GLsizei GLenum format
GLsizei const GLchar ** string
uint64_t TTimeStamp
A system independent time type, it holds the the number of 100-nanosecond intervals since January 1,...
#define ASSERT_EQUAL_(__A, __B)
#define THROW_EXCEPTION(msg)
This base provides a set of functions for maths stuff.
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values,...
void clear()
Clear the contents of this container.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
std::string BASE_IMPEXP format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
void inverseComposePoint(const TPoint2D g, TPoint2D &l) const
std::string ptg_cache_files_directory
(Default: ".")
double ref_distance
Maximum distance up to obstacles will be considered (D_{max} in papers).
A 3D robot shape stored as a "sliced" stack of 2D polygons, used for CReactiveNavigationSystem3D Depe...
void setRadius(size_t level, double r)
const double & getRadius(size_t level) const
void resize(size_t num_levels)
const double & getHeight(size_t level) const
const mrpt::math::CPolygon & polygon(size_t level) const
void setHeight(size_t level, double h)
A safe way to call enter() and leave() of a mrpt::utils::CTimeLogger upon construction and destructio...