Go to the documentation of this file.
20 : m_robotShape(), m_robotMaxRadius(.01)
50 const double BADNUM = std::numeric_limits<double>::max();
52 for (
unsigned int nPt = 0;; ++nPt)
57 const double ptx = cfg.
read_double(sSection, sPtx, BADNUM,
false);
58 const double pty = cfg.
read_double(sSection, sPty, BADNUM,
false);
59 if (ptx == BADNUM && pty == BADNUM)
break;
61 (ptx != BADNUM && pty != BADNUM),
62 "Error: mismatch between number of pts in {x,y} defining robot "
80 const int WN = 25, WV = 30;
89 "Robot polygonal shape, `x` [m].");
92 "Robot polygonal shape, `y` [m].");
105 for (
int i = 0; i < N; i++)
113 shap_x[0], shap_y[0], shap_z[0], shap_x[1], shap_y[1], shap_z[1]);
114 for (
int i = 0; i <= shap_x.size(); i++)
116 const int idx = i % shap_x.size();
153 const double x,
const double y)
const
159 const double ox,
const double oy)
const
void loadShapeFromConfigFile(const mrpt::config::CConfigFileBase &source, const std::string §ion)
T hypot_fast(const T x, const T y)
Faster version of std::hypot(), to use when overflow is not an issue and we prefer fast code.
void write(const std::string §ion, const std::string &name, enum_t value, const int name_padding_width=-1, const int value_padding_width=-1, const std::string &comment=std::string())
Column vector, like Eigen::MatrixX*, but automatically initialized to zeros since construction.
virtual void internal_processNewRobotShape()=0
Will be called whenever the robot shape is set / updated.
void AddVertex(double x, double y)
Add a new vertex to polygon.
A set of independent lines (or segments), one line with its own start and end positions (X,...
double read_double(const std::string §ion, const std::string &name, double defaultValue, bool failIfNotFound=false) const
bool contains(const TPoint2D &point) const
Check whether a point is inside (or within geometryEpsilon of a polygon edge).
mrpt::math::CPolygon m_robotShape
void setRobotShape(const mrpt::math::CPolygon &robotShape)
Robot shape must be set before initialization, either from ctor params or via this method.
double getMaxRobotRadius() const override
Returns an approximation of the robot radius.
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...
void add_robotShape_to_setOfLines(mrpt::opengl::CSetOfLines &gl_shape, const mrpt::poses::CPose2D &origin=mrpt::poses::CPose2D()) const override
Auxiliary function for rendering.
Virtual base class for "archives": classes abstracting I/O streams.
void saveToConfigFile(mrpt::config::CConfigFileBase &cfg, const std::string &sSection) const override
This method saves the options to a ".ini"-like file or memory-stored string list.
void appendLine(const mrpt::math::TSegment3D &sgm)
Appends a line to the set.
void appendLineStrip(float x, float y, float z)
Appends a line whose starting point is the end point of the last line (similar to OpenGL's GL_LINE_ST...
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.
void keep_max(T &var, const K test_val)
If the second argument is above the first one, set the first argument to this higher value.
A class used to store a 2D pose, including the 2D coordinate point and a heading (phi) angle.
CPTG_RobotShape_Polygonal()
virtual double evalClearanceToRobotShape(const double ox, const double oy) const override
Evals the clearance from an obstacle (ox,oy) in coordinates relative to the robot center.
void internal_shape_loadFromStream(mrpt::serialization::CArchive &in)
void loadDefaultParams() override
Loads a set of default parameters; provided exclusively for the PTG-configurator tool.
#define ASSERTMSG_(f, __ERROR_MSG)
Defines an assertion mechanism.
A wrapper of a TPolygon2D class, implementing CSerializable.
#define ASSERT_ABOVEEQ_(__A, __B)
bool isPointInsideRobotShape(const double x, const double y) const override
Returns true if the point lies within the robot shape.
virtual ~CPTG_RobotShape_Polygonal()
GLsizei const GLchar ** string
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
void internal_shape_saveToStream(mrpt::serialization::CArchive &out) const
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 | |