Go to the documentation of this file.
24 CReactiveNavigationSystem3D::TPTGmultilevel::TPTGmultilevel() {}
26 CReactiveNavigationSystem3D::TPTGmultilevel::~TPTGmultilevel()
28 for (
size_t i = 0; i < PTGs.size(); i++)
delete PTGs[i];
35 CReactiveNavigationSystem3D::CReactiveNavigationSystem3D(
37 bool enableLogToFile,
const std::string& logFileDirectory)
39 react_iterf_impl, enableConsoleOutput, enableLogToFile,
60 for (
unsigned int i = 0; i < robotShape.
size(); i++)
76 HEIGHT_LEVELS,
"Number of robot vertical sections");
92 unsigned int num_levels;
93 vector<float> xaux, yaux;
96 num_levels =
c.read_int(
s,
"HEIGHT_LEVELS", 1,
true);
98 for (
unsigned int i = 1; i <= num_levels; i++)
101 i - 1,
c.read_float(
s,
format(
"LEVEL%d_HEIGHT", i), 1.0,
true));
103 i - 1,
c.read_float(
s,
format(
"LEVEL%d_RADIUS", i), 0.5,
false));
105 s,
format(
"LEVEL%d_VECTORX", i), vector<float>(0), xaux,
false);
107 s,
format(
"LEVEL%d_VECTORY", i), vector<float>(0), yaux,
false);
108 ASSERT_(xaux.size() == yaux.size());
109 for (
unsigned int j = 0; j < xaux.size(); j++)
117 unsigned int num_ptgs =
c.read_int(
s,
"PTG_COUNT", 1,
true);
123 for (
unsigned int j = 1; j <= num_ptgs; j++)
128 "[loadConfigFile] Generating PTG#%u at level %u...", j, i);
130 c.read_string(
s,
format(
"PTG%d_TYPE", j),
"",
true);
133 sPTGName,
c,
s,
format(
"PTG%d_", j));
139 " Robot height sections = %u\n",
164 "[loadConfigFile] Initializing PTG#%u.%u... (`%s`)", j, i,
185 "%s/ReacNavGrid_%03u_L%02u.dat.gz",
224 const float *xs, *ys, *zs;
228 for (
size_t j = 0; j < nPts; j++)
231 for (
size_t idxH = 0; idxH < nSlices; ++idxH)
233 if (zs[j] < 0.01)
break;
242 if (xs[j] > -OBS_MAX_XY && xs[j] < OBS_MAX_XY &&
243 ys[j] > -OBS_MAX_XY && ys[j] < OBS_MAX_XY)
245 xs[j], ys[j], zs[j]);
260 const size_t ptg_idx, std::vector<double>& out_TPObstacles,
263 const bool eval_clearance)
271 rel_pose_PTG_origin_wrt_sense_);
276 const float *xs, *ys, *zs;
279 for (
size_t obs = 0; obs < nObs; obs++)
283 xs[obs], ys[obs], ox, oy);
285 ox, oy, out_TPObstacles);
289 ox, oy, out_clearance);
348 for (
size_t idxH = 0; idxH < nSlices; ++idxH)
351 const float *xs, *ys, *zs;
360 const double R = ptg->getMaxRobotRadius();
361 for (
size_t obs = 0; obs < nObs; obs++)
363 const double gox = xs[obs], goy = ys[obs];
367 if (lo.
x >= -
R && lo.
x <=
R && lo.
y >= -
R && lo.
y <=
R &&
368 ptg->isPointInsideRobotShape(lo.
x, lo.
y))
Base class for all PTGs using a 2D polygonal robot shape model.
Base class for all PTGs using a 2D circular robot shape model.
A class for storing, saving and loading a reactive navigation log record for the CReactiveNavigationS...
GLenum GLsizei GLenum format
#define MRPT_LOG_INFO_FMT(_FMT_STRING,...)
mrpt::system::CTimeLogger m_timelogger
A complete time logger.
const double & getRadius(size_t level) const
void clear()
Clear the contents of this container.
void insertAnotherMap(const CPointsMap *otherMap, const mrpt::poses::CPose3D &otherPose)
Insert the contents of another map into this one with some geometric transformation,...
Base class for reactive navigator systems based on TP-Space, with an arbitrary holonomic reactive met...
#define MRPT_LOG_INFO(_STRING)
#define MRPT_SAVE_CONFIG_VAR_COMMENT(variableName, __comment)
double ref_distance
Maximum distance up to obstacles will be considered (D_{max} in papers).
mrpt::math::TPoint2D inverseComposePoint(const TPoint2D g) const
#define ASSERT_EQUAL_(__A, __B)
Assert comparing two values, reporting their actual values upon failure.
mrpt::math::CVectorFloat robotShape_x
The robot shape in WS.
void setRobotShapeRadius(const double robot_radius)
Robot shape must be set before initialization, either from ctor params or via this method.
void AddVertex(double x, double y)
Add a new vertex to polygon.
double robotShape_radius
The circular robot radius.
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::config::CConfigFileBase &c) const override
Saves all current options to a config file.
The pure virtual interface between a real or simulated robot and any CAbstractNavigator-derived class...
#define THROW_EXCEPTION(msg)
#define ASSERT_(f)
Defines an assertion mechanism.
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
void resize(size_t num_levels)
void enter(const char *func_name)
Start of a named section.
void changeRobotShape(TRobotShape robotShape)
Change the robot shape, which is taken into account for collision grid building.
#define MRPT_LOG_DEBUG_FMT(_FMT_STRING,...)
Use: MRPT_LOG_DEBUG_FMT("i=%u", i);
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...
double leave(const char *func_name)
End of a named section.
uint64_t TTimeStamp
A system independent time type, it holds the the number of 100-nanosecond intervals since January 1,...
bool m_PTGsMustBeReInitialized
virtual ~CReactiveNavigationSystem3D()
Destructor.
This class allows loading and storing values and vectors of different types from a configuration text...
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
virtual void loggingGetWSObstaclesAndShape(CLogFileRecord &out_log) override
Generates a pointcloud of obstacles, and the robot shape, to be saved in the logging record for the c...
A class used to store a 2D pose, including the 2D coordinate point and a heading (phi) angle.
Clearance information for one particular PTG and one set of obstacles.
virtual void loadConfigFile(const mrpt::config::CConfigFileBase &c) override
Loads all params from a file.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
const mrpt::math::CPolygon & polygon(size_t level) const
CRobot2NavInterface & m_robot
The navigator-robot interface.
size_t verticesCount() const
Returns the vertices count in the polygon:
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.
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) override
Transform the obstacle into TP-Obstacles in TP-Spaces.
virtual bool checkCollisionWithLatestObstacles(const mrpt::math::TPose2D &relative_robot_pose) const override
Checks whether the robot shape, when placed at the given pose (relative to the current pose),...
std::vector< TPTGmultilevel > m_ptgmultilevel
The set of PTG-transformations to be used: indices are [ptg_index][height_index].
bool m_enableConsoleOutput
Enables / disables the console debug output.
mrpt::maps::CSimplePointsMap WS_Obstacles
The WS-Obstacles.
TRobotShape m_robotShape
The robot 3D shape model.
const double & getHeight(size_t level) const
A safe way to call enter() and leave() of a mrpt::system::CTimeLogger upon construction and destructi...
std::string ptg_cache_files_directory
(Default: ".")
void getPointsBuffer(size_t &outPointsCount, const float *&xs, const float *&ys, const float *&zs) const
Provides a direct access to points buffer, or nullptr if there is no points in the map.
static CParameterizedTrajectoryGenerator * CreatePTG(const std::string &ptgClassName, const mrpt::config::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...
mrpt::math::CVectorFloat robotShape_y
bool implementSenseObstacles(mrpt::system::TTimeStamp &obs_timestamp) override
Return false on any fatal error.
void setHeight(size_t level, double h)
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.
mrpt::maps::CSimplePointsMap m_WS_Obstacles_unsorted
The unsorted set of obstacles from the sensors.
void preDestructor()
To be called during children destructors to assure thread-safe destruction, and free of shared object...
TAbstractPTGNavigatorParams params_abstract_ptg_navigator
This base provides a set of functions for maths stuff.
mrpt::system::CTimeLogger m_timlog_delays
Time logger to collect delay-related stats.
GLsizei const GLchar ** string
virtual void STEP1_InitPTGs() override
void clear()
Erase all the contents of the map.
virtual void loadConfigFile(const mrpt::config::CConfigFileBase &c) override
Loads all params from a file.
void setRadius(size_t level, double r)
This is the base class for any user-defined PTG.
This namespace provides a OS-independent interface to many useful functions: filenames manipulation,...
A 3D robot shape stored as a "sliced" stack of 2D polygons, used for CReactiveNavigationSystem3D Depe...
Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST | |