Go to the documentation of this file.
31 #include <mrpt/examples_config.h>
34 MRPT_EXAMPLES_BASE_DIRECTORY +
35 string(
"../share/mrpt/datasets/2006-MalagaCampus.gridmap.gz"));
48 printf(
"Loading gridmap...");
62 std::deque<TPoint2D> thePath;
69 cout <<
"Origin: " << origin << endl;
70 cout <<
"Target: " << target << endl;
72 cout <<
"Searching path...";
77 gridmap, origin, target, thePath, notFound, 100.0f );
79 double t = tictac.
Tac();
80 cout <<
"Done in " <<
t * 1000 <<
" ms" << endl;
82 printf(
"Path found: %s\n", notFound ?
"NO" :
"YES");
83 printf(
"Path has %u steps\n", (
unsigned)thePath.size());
94 it != thePath.end(); ++it)
100 gridmap.
x2idx(origin.x()),
102 TColor(0x20, 0x20, 0x20),
'+', 10);
104 gridmap.
x2idx(target.x()),
106 TColor(0x50, 0x50, 0x50),
'x', 10);
109 cout <<
"Saving output to: " << dest << endl;
110 img.saveToFile(dest);
113 #if MRPT_HAS_WXWIDGETS
115 win.showImage(
img.scaleHalf().scaleHalf());
121 int main(
int argc,
char** argv)
130 cout <<
"MRPT exception caught: " << e.what() << endl;
135 printf(
"Another exception!!");
const Scalar * const_iterator
Searches for collision-free path in 2D occupancy grids for holonomic circular robots.
A high-performance stopwatch, with typical resolution of nanoseconds.
void getAsImage(mrpt::img::CImage &img, bool verticalFlip=false, bool forceRGB=false, bool tricolor=false) const
Returns the grid as a 8-bit graylevel image, where each pixel is a cell (output image is RGB only if ...
#define THROW_EXCEPTION_FMT(_FORMAT_STRING,...)
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
bool fileExists(const std::string &fileName)
Test if a given file (or directory) exists.
float getXMax() const
Returns the "x" coordinate of right side of grid map.
double Tac() noexcept
Stops the stopwatch.
unsigned int getSizeY() const
Returns the vertical size of grid map in cells count.
float getYMax() const
Returns the "y" coordinate of bottom side of grid map.
int round(const T value)
Returns the closer integer (int) to x.
mrpt::gui::CDisplayWindow3D::Ptr win
A class used to store a 2D pose, including the 2D coordinate point and a heading (phi) angle.
int x2idx(float x) const
Transform a coordinate value into a cell index.
float getYMin() const
Returns the "y" coordinate of top side of grid map.
void Tic() noexcept
Starts the stopwatch.
This class creates a window as a graphical user interface (GUI) for displaying images to the user.
A class for storing images as grayscale or RGB bitmaps.
string myGridMap(MRPT_EXAMPLES_BASE_DIRECTORY+string("../share/mrpt/datasets/2006-MalagaCampus.gridmap.gz"))
CArchiveStreamBase< STREAM > archiveFrom(STREAM &s)
Helper function to create a templatized wrapper CArchive object for a: MRPT's CStream,...
float getResolution() const
Returns the resolution of the grid map.
float getXMin() const
Returns the "x" coordinate of left side of grid map.
This base provides a set of functions for maths stuff.
A class for storing an occupancy grid map.
GLsizei const GLchar ** string
float robotRadius
The aproximate robot radius used in the planification.
void computePath(const mrpt::maps::COccupancyGridMap2D &theMap, const mrpt::poses::CPose2D &origin, const mrpt::poses::CPose2D &target, std::deque< mrpt::math::TPoint2D > &path, bool ¬Found, float maxSearchPathLength=-1) const
This method compute the optimal path for a circular robot, in the given occupancy grid map,...
This namespace provides a OS-independent interface to many useful functions: filenames manipulation,...
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 | |