Go to the documentation of this file.
17 #include <gtest/gtest.h>
21 template <
typename RNAVCLASS>
39 cerr <<
"**WARNING* Skipping tests since file cannot be found: '"
45 cfg.
write(
"CAbstractPTGBasedReactive",
"holonomic_method", sHoloMethod);
52 world_topleft.
x, world_rightbottom.
x, world_rightbottom.
y,
53 world_topleft.
y, 0.10f );
58 const int xi0 = grid.
x2idx(block_obstacle_topleft.x),
59 xi1 = grid.
x2idx(block_obstacle_rightbottom.x);
60 const int yi0 = grid.
y2idx(block_obstacle_rightbottom.y),
61 yi1 = grid.
y2idx(block_obstacle_topleft.y);
63 for (
int xi = xi0; xi < xi1; xi++)
65 for (
int yi = yi0; yi < yi1; yi++)
81 this->setMinLoggingLevel(
85 void sendNavigationStartEvent()
override {}
86 void sendNavigationEndEvent()
override {}
98 getCurrentPoseAndSpeeds(
99 curPose, curVel, pose_tim, odomPose, pose_frame_id);
118 MyDummyRobotIF robot2nav_if(robot_simul, grid);
120 RNAVCLASS rnav(robot2nav_if,
false );
123 rnav.enableTimeLog(
false);
132 rnav.setLogFileDirectory(sTmpDir);
133 rnav.enableLogFile(
true);
137 rnav.loadConfigFile(cfg);
149 unsigned int MAX_ITERS = 200;
150 for (
unsigned int i = 0; i < MAX_ITERS; i++)
155 rnav.navigationStep();
157 EXPECT_TRUE(rnav.getCurrentState() != CAbstractNavigator::NAV_ERROR);
158 if (rnav.getCurrentState() == CAbstractNavigator::IDLE)
break;
165 EXPECT_TRUE(rnav.getCurrentState() == CAbstractNavigator::IDLE);
180 run_rnav_test<mrpt::nav::CReactiveNavigationSystem>(
186 run_rnav_test<mrpt::nav::CReactiveNavigationSystem>(
192 run_rnav_test<mrpt::nav::CReactiveNavigationSystem>(
193 "reactive2d_config.ini",
"CHolonomicFullEval",
no_obs_trg,
199 run_rnav_test<mrpt::nav::CReactiveNavigationSystem3D>(
205 run_rnav_test<mrpt::nav::CReactiveNavigationSystem3D>(
211 run_rnav_test<mrpt::nav::CReactiveNavigationSystem3D>(
212 "reactive3d_config.ini",
"CHolonomicFullEval",
no_obs_trg,
218 run_rnav_test<mrpt::nav::CReactiveNavigationSystem>(
224 run_rnav_test<mrpt::nav::CReactiveNavigationSystem>(
230 run_rnav_test<mrpt::nav::CReactiveNavigationSystem>(
231 "reactive2d_config.ini",
"CHolonomicFullEval",
with_obs_trg,
237 run_rnav_test<mrpt::nav::CReactiveNavigationSystem3D>(
243 run_rnav_test<mrpt::nav::CReactiveNavigationSystem3D>(
249 run_rnav_test<mrpt::nav::CReactiveNavigationSystem3D>(
250 "reactive3d_config.ini",
"CHolonomicFullEval",
with_obs_trg,
See base class CAbstractPTGBasedReactive for a description and instructions of use.
const TPoint2D no_obs_bottomright(10, -10)
void clear()
Clear the contents of this container.
float maxRange
The maximum range allowed by the device, in meters (e.g.
std::string extractFileDirectory(const std::string &filePath)
Extract the whole path (the directory) of a filename from a complete path plus name plus extension.
const TPoint2D with_obs_trg(9.0, 4.0)
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())
A "CObservation"-derived class that represents a 2D range scan measurement (typically from a laser sc...
A versatile "profiler" that logs the time spent within each pair of calls to enter(X)-leave(X),...
float minDistBetweenLaserPoints
The minimum distance between points (in 3D): If two points are too close, one of them is not inserted...
TargetInfo target
Navigation target.
mrpt::system::TTimeStamp now()
A shortcut for system::getCurrentTime.
float targetAllowedDistance
(Default=0.5 meters) Allowed distance to target in order to end the navigation.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
void discardSavingChanges()
Discard saving (current) changes to physical file upon destruction.
std::string getTempFileName()
Returns the name of a proposed temporary file name.
bool fileExists(const std::string &fileName)
Test if a given file (or directory) exists.
const TPoint2D with_obs_bottomright(30, -10)
uint64_t TTimeStamp
A system independent time type, it holds the the number of 100-nanosecond intervals since January 1,...
The struct for configuring navigation requests.
void run_rnav_test(const std::string &sFilename, const std::string &sHoloMethod, const TPoint2D &nav_target, const TPoint2D &world_topleft, const TPoint2D &world_rightbottom, const TPoint2D &block_obstacle_topleft=TPoint2D(0, 0), const TPoint2D &block_obstacle_rightbottom=TPoint2D(0, 0))
void fill(float default_value=0.5f)
Fills all the cells with a default value.
void setCell(int x, int y, float value)
Change the contents [0,1] of a cell, given its index.
void laserScanSimulator(mrpt::obs::CObservation2DRangeScan &inout_Scan, const mrpt::poses::CPose2D &robotPose, float threshold=0.6f, size_t N=361, float noiseStd=0, unsigned int decimation=1, float angleNoiseStd=mrpt::DEG2RAD(.0)) const
Simulates a laser range scan into the current grid map.
void setSize(float x_min, float x_max, float y_min, float y_max, float resolution, float default_value=0.5f)
Change the size of gridmap, erasing all its previous contents.
float aperture
The "aperture" or field-of-view of the range finder, in radians (typically M_PI = 180 degrees).
CRobot2NavInterface implemented for a simulator object based on mrpt::kinematics::CVehicleSimul_DiffD...
A class used to store a 2D pose, including the 2D coordinate point and a heading (phi) angle.
virtual void loadFromRangeScan(const mrpt::obs::CObservation2DRangeScan &rangeScan, const mrpt::poses::CPose3D *robotPose=nullptr) override
See CPointsMap::loadFromRangeScan()
mrpt::math::TPose2D target_coords
Coordinates of desired target location.
const mrpt::math::TPose2D & getCurrentGTPose() const
Returns the instantaneous, ground truth pose in world coordinates.
int x2idx(float x) const
Transform a coordinate value into a cell index.
A cloud of points in 2D or 3D, which can be built from a sequence of laser scans.
const TPoint2D with_obs_topleft(-10, 10)
See base class CAbstractPTGBasedReactive for a description and instructions of use.
const TPoint2D obs_br(5.0, -2.0)
Simulates the kinematics of a differential-driven planar mobile robot/vehicle, including odometry err...
TInsertionOptions insertionOptions
The options used when inserting observations in the map.
const TPoint2D no_obs_topleft(-10, 10)
This class allows loading and storing values and vectors of different types from "....
A class for storing an occupancy grid map.
GLsizei const GLchar ** string
std::string find_mrpt_shared_dir()
Finds the "[MRPT]/share/mrpt/" directory, if available in the system.
void clear()
Erase all the contents of the map.
mrpt::poses::CPose3D sensorPose
The 6D pose of the sensor on the robot at the moment of starting the scan.
void simulateOneTimeStep(const double dt)
Runs the simulator during "dt" seconds.
const TPoint2D obs_tl(4.0, 2.0)
TEST(CReactiveNavigationSystem, no_obstacle_nav_VFF)
2D twist: 2D velocity vector (vx,vy) + planar angular velocity (omega)
const TPoint2D no_obs_trg(2.0, 0.4)
double DEG2RAD(const double x)
Degrees to radians.
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 | |