24 CReactiveNavigationSystem3D::TPTGmultilevel::TPTGmultilevel()
28 CReactiveNavigationSystem3D::TPTGmultilevel::~TPTGmultilevel()
30 for (
size_t i=0;i<PTGs.size();i++)
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 ASSERT_EQUAL_(__A, __B)
void clear()
Erase all the contents of the map.
uint64_t TTimeStamp
A system independent time type, it holds the the number of 100-nanosecond intervals since January 1...
virtual void loadConfigFile(const mrpt::utils::CConfigFileBase &c) MRPT_OVERRIDE
Loads all params from a file.
void setHeight(size_t level, double h)
void insertAnotherMap(const CPointsMap *otherMap, const mrpt::poses::CPose3D &otherPose)
Insert the contents of another map into this one with some geometric transformation, without fusing close points.
bool implementSenseObstacles(mrpt::system::TTimeStamp &obs_timestamp) MRPT_OVERRIDE
Return false on any fatal error.
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...
void resize(size_t num_levels)
virtual void STEP1_InitPTGs() MRPT_OVERRIDE
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
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.
size_t verticesCount() const
Returns the vertices count in the polygon:
mrpt::maps::CSimplePointsMap m_WS_Obstacles_unsorted
The unsorted set of obstacles from the sensors.
mrpt::math::CVectorFloat robotShape_y
The robot shape in WS. Used by PTGs derived from mrpt::nav::CPTG_RobotShape_Polygonal.
Base class for all PTGs using a 2D circular robot shape model.
A 3D robot shape stored as a "sliced" stack of 2D polygons, used for CReactiveNavigationSystem3D Depe...
#define THROW_EXCEPTION(msg)
#define MRPT_LOG_DEBUG_FMT(_FMT_STRING,...)
TRobotShape m_robotShape
The robot 3D shape model.
mrpt::utils::CTimeLogger m_timelogger
A complete time logger.
const mrpt::math::CPolygon & polygon(size_t level) const
bool m_enableConsoleOutput
Enables / disables the console debug output.
Clearance information for one particular PTG and one set of obstacles.
A class for storing, saving and loading a reactive navigation log record for the CReactiveNavigationS...
void setRadius(size_t level, double r)
void clear()
Clear the contents of this container.
mrpt::utils::CTimeLogger m_timlog_delays
Time logger to collect delay-related stats.
mrpt::math::CVectorFloat robotShape_x
This class allows loading and storing values and vectors of different types from a configuration text...
This is the base class for any user-defined PTG.
This base provides a set of functions for maths stuff.
#define MRPT_SAVE_CONFIG_VAR_COMMENT(variableName, __comment)
#define MRPT_LOG_WARN(_STRING)
std::vector< TPTGmultilevel > m_ptgmultilevel
The set of PTG-transformations to be used: indices are [ptg_index][height_index]. ...
#define MRPT_LOG_INFO(_STRING)
Base class for all PTGs using a 2D polygonal robot shape model.
Base class for reactive navigator systems based on TP-Space, with an arbitrary holonomic reactive met...
void setRobotShapeRadius(const double robot_radius)
Robot shape must be set before initialization, either from ctor params or via this method...
std::string BASE_IMPEXP format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
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)...
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...
GLsizei const GLchar ** string
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
std::string ptg_cache_files_directory
(Default: ".")
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 global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
virtual void saveConfigFile(mrpt::utils::CConfigFileBase &c) const MRPT_OVERRIDE
Saves all current options to a config file.
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...
A safe way to call enter() and leave() of a mrpt::utils::CTimeLogger upon construction and destructio...
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.
A class used to store a 2D pose, including the 2D coordinate point and a heading (phi) angle...
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
TAbstractPTGNavigatorParams params_abstract_ptg_navigator
CRobot2NavInterface & m_robot
The navigator-robot interface.
void changeRobotShape(TRobotShape robotShape)
Change the robot shape, which is taken into account for collision grid building.
#define MRPT_LOG_INFO_FMT(_FMT_STRING,...)
double leave(const char *func_name)
End of a named section.
double ref_distance
Maximum distance up to obstacles will be considered (D_{max} in papers).
const double & getRadius(size_t level) const
GLenum GLsizei GLenum format
void inverseComposePoint(const TPoint2D g, TPoint2D &l) const
virtual ~CReactiveNavigationSystem3D()
Destructor.
mrpt::maps::CSimplePointsMap WS_Obstacles
The pure virtual interface between a real or simulated robot and any CAbstractNavigator-derived class...
void enter(const char *func_name)
Start of a named section.
void AddVertex(double x, double y)
Add a new vertex to polygon.
bool m_PTGsMustBeReInitialized
const double & getHeight(size_t level) const
virtual void loadConfigFile(const mrpt::utils::CConfigFileBase &c) MRPT_OVERRIDE
Loads all params from a file.
CReactiveNavigationSystem3D(CRobot2NavInterface &react_iterf_impl, bool enableConsoleOutput=true, bool enableLogFile=false, const std::string &logFileDirectory=std::string("./reactivenav.logs"))
See docs in ctor of base class.
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...
void preDestructor()
To be called during children destructors to assure thread-safe destruction, and free of shared object...
double robotShape_radius
The circular robot radius. Used by PTGs derived from mrpt::nav::CPTG_RobotShape_Circular.