Skip to content

Commit 1e4e5bc

Browse files
yi213-roboticmamoll
authored andcommitted
Add BLITstar
1 parent 950724f commit 1e4e5bc

File tree

11 files changed

+3859
-7
lines changed

11 files changed

+3859
-7
lines changed

demos/OptimalPlanning.cpp

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#include "ompl/util/Console.h"
4444

4545
// The supported optimal planners, in alphabetical order
46+
#include <ompl/geometric/planners/lazyinformedtrees/BLITstar.h>
4647
#include <ompl/geometric/planners/informedtrees/AITstar.h>
4748
#include <ompl/geometric/planners/informedtrees/BITstar.h>
4849
#include <ompl/geometric/planners/informedtrees/EITstar.h>
@@ -74,6 +75,7 @@ enum optimalPlanner
7475
PLANNER_AITSTAR,
7576
PLANNER_BFMTSTAR,
7677
PLANNER_BITSTAR,
78+
PLANNER_BLITSTAR,
7779
PLANNER_CFOREST,
7880
PLANNER_EITSTAR,
7981
PLANNER_EIRMSTAR,
@@ -129,6 +131,7 @@ class ValidityChecker : public ob::StateValidityChecker
129131

130132
// Distance formula between two points, offset by the circle's
131133
// radius
134+
return ((x >= 1.4 && x <= 1.5 && y >= 0.6 && y <=1.4) || ( y >= 1.3 && y <= 1.4 && x>= 0.6 && x<= 1.4)) ? 0.0 : 0.1;
132135
return sqrt((x - 0.5) * (x - 0.5) + (y - 0.5) * (y - 0.5)) - 0.25;
133136
}
134137
};
@@ -164,6 +167,11 @@ ob::PlannerPtr allocatePlanner(ob::SpaceInformationPtr si, optimalPlanner planne
164167
return std::make_shared<og::BITstar>(si);
165168
break;
166169
}
170+
case PLANNER_BLITSTAR:
171+
{
172+
return std::make_shared<og::BLITstar>(si);
173+
break;
174+
}
167175
case PLANNER_CFOREST:
168176
{
169177
return std::make_shared<og::CForest>(si);
@@ -243,11 +251,16 @@ void plan(double runTime, optimalPlanner plannerType, planningObjective objectiv
243251
auto space(std::make_shared<ob::RealVectorStateSpace>(2));
244252

245253
// Set the bounds of space to be in [0,1].
246-
space->setBounds(0.0, 1.0);
254+
//space->setBounds(0.0, 1.0);
247255

256+
ob::RealVectorBounds bounds(2);
257+
bounds.setLow(0, 0); // Lower bound for x-dimension
258+
bounds.setHigh(0, 2); // Upper bound for x-dimension
259+
bounds.setLow(1, 0); // Lower bound for y-dimension
260+
bounds.setHigh(1, 2); // Upper bound for y-dimension
248261
// Construct a space information instance for this state space
262+
space->setBounds(bounds);
249263
auto si(std::make_shared<ob::SpaceInformation>(space));
250-
251264
// Set the object used to check which states in the space are valid
252265
si->setStateValidityChecker(std::make_shared<ValidityChecker>(si));
253266

@@ -262,8 +275,8 @@ void plan(double runTime, optimalPlanner plannerType, planningObjective objectiv
262275
// Set our robot's goal state to be the top-right corner of the
263276
// environment, or (1,1).
264277
ob::ScopedState<> goal(space);
265-
goal->as<ob::RealVectorStateSpace::StateType>()->values[0] = 1.0;
266-
goal->as<ob::RealVectorStateSpace::StateType>()->values[1] = 1.0;
278+
goal->as<ob::RealVectorStateSpace::StateType>()->values[0] = 1.8;
279+
goal->as<ob::RealVectorStateSpace::StateType>()->values[1] = 1.8;
267280

268281
// Create a problem instance
269282
auto pdef(std::make_shared<ob::ProblemDefinition>(si));
@@ -438,10 +451,10 @@ bool argParse(int argc, char **argv, double *runTimePtr, optimalPlanner *planner
438451
desc.add_options()("help,h", "produce help message")(
439452
"runtime,t", bpo::value<double>()->default_value(1.0),
440453
"(Optional) Specify the runtime in seconds. Defaults to 1 and "
441-
"must be greater than 0.")("planner,p", bpo::value<std::string>()->default_value("RRTstar"),
454+
"must be greater than 0.")("planner,p", bpo::value<std::string>()->default_value("BLITstar"),
442455
"(Optional) Specify the optimal planner to use, defaults to RRTstar if not given. "
443456
"Valid options are AITstar, "
444-
"BFMTstar, BITstar, CForest, EITstar, EIRMstar, FMTstar, InformedRRTstar, PRMstar, RRTstar, "
457+
"BFMTstar, BITstar, BLITstar, CForest, EITstar, EIRMstar, FMTstar, InformedRRTstar, PRMstar, RRTstar, "
445458
"and SORRTstar.") // Alphabetical order
446459
("objective,o", bpo::value<std::string>()->default_value("PathLength"),
447460
"(Optional) Specify the optimization objective, defaults to PathLength if not given. Valid options are "
@@ -509,6 +522,10 @@ bool argParse(int argc, char **argv, double *runTimePtr, optimalPlanner *planner
509522
{
510523
*plannerPtr = PLANNER_BITSTAR;
511524
}
525+
else if (boost::iequals("BLITstar", plannerStr))
526+
{
527+
*plannerPtr = PLANNER_BLITSTAR;
528+
}
512529
else if (boost::iequals("CForest", plannerStr))
513530
{
514531
*plannerPtr = PLANNER_CFOREST;

py-bindings/headers_geometric.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ src/ompl/geometric/planners/rrt/InformedRRTstar.h
3333
src/ompl/geometric/planners/rrt/SORRTstar.h
3434
src/ompl/geometric/planners/rrt/STRRTstar.h
3535
src/ompl/geometric/planners/informedtrees/BITstar.h
36+
src/ompl/geometric/planners/lazyinformedtrees/BLITstar.h
3637
src/ompl/geometric/planners/informedtrees/ABITstar.h
3738
src/ompl/geometric/planners/informedtrees/AITstar.h
3839
src/ompl/geometric/planners/informedtrees/EITstar.h

src/ompl/base/OptimizationObjective.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ namespace ompl
101101
/** \brief Check whether the the cost \e c1 is considered better than the cost \e c2. By default, this
102102
* returns true if if c1 is less than c2. */
103103
virtual bool isCostBetterThan(Cost c1, Cost c2) const;
104+
105+
virtual bool isCostLargerThan(Cost c1, Cost c2) const;
104106

105107
/** \brief Compare whether cost \e c1 and cost \e c2 are equivalent. By default defined as
106108
* !isCostBetterThan(c1, c2) && !isCostBetterThan(c2, c1), as if c1 is not better than c2, and c2 is not

src/ompl/base/src/OptimizationObjective.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,12 @@ void ompl::base::OptimizationObjective::setCostThreshold(Cost c)
6969

7070
bool ompl::base::OptimizationObjective::isCostBetterThan(Cost c1, Cost c2) const
7171
{
72-
return c1.value() < c2.value();
72+
return c1.value() + 0.000001 < c2.value();
73+
}
74+
75+
bool ompl::base::OptimizationObjective::isCostLargerThan(Cost c1, Cost c2) const
76+
{
77+
return c1.value() > c2.value()+ 0.000001;
7378
}
7479

7580
bool ompl::base::OptimizationObjective::isCostEquivalentTo(Cost c1, Cost c2) const

0 commit comments

Comments
 (0)