4 #include <ompl/geometric/planners/rrt/RRTConnect.h>
26 int main(
int argc,
char **argv)
35 auto fetch = std::make_shared<FetchRobot>();
39 scene->fromYAMLFile(
"package://robowflex_library/yaml/test_fetch_wall.yml");
44 auto fetch_dart = std::make_shared<darts::Robot>(
fetch);
45 auto fetch_name = fetch_dart->getName();
46 auto scene_dart = std::make_shared<darts::Structure>(
"scene",
scene);
47 auto ground = std::make_shared<darts::Structure>(
"ground");
48 ground->addGround(-0.2);
51 auto world = std::make_shared<darts::World>();
52 world->addRobot(fetch_dart);
53 world->addStructure(scene_dart);
54 world->addStructure(ground);
66 start_spec.
setFrame(fetch_name,
"wrist_roll_link",
"base_link");
67 start_spec.
setPose(-0.2, 0.6, 0.92,
80 constraint_spec.
setFrame(fetch_name,
"wrist_roll_link",
"base_link");
81 constraint_spec.
setPose(0.3, 0.8, 0.92,
88 auto constraint_tsr = std::make_shared<darts::TSR>(world, constraint_spec);
100 goal_spec.
setFrame(fetch_name,
"wrist_roll_link",
"base_link");
101 goal_spec.
setPose(0.5, 0.6, 0.92,
102 0.5, -0.5, 0.5, 0.5);
104 auto goal_tsr = std::make_shared<darts::TSR>(world, goal_spec);
112 auto rrt = std::make_shared<ompl::geometric::RRTConnect>(builder.
info,
true);
114 builder.
ss->setPlanner(rrt);
118 if (builder.
ss->getOptimizationObjective())
119 builder.
ss->getOptimizationObjective()->setCostThreshold(
127 goal->startSampling();
128 ompl::base::PlannerStatus solved = builder.
ss->solve(60.0);
129 goal->stopSampling();
RAII-pattern for starting up ROS.
A helper class to setup common OMPL structures for planning.
void setGoal(const ompl::base::GoalPtr &goal)
Set the goal for the problem.
void setStartConfigurationFromWorld()
Set the start configuration from the current state of the world.
void addConstraint(const TSRPtr &tsr)
Adds a TSR as a path constraint to the problem.
void setup()
Calls setup routines on OMPL structures. Call after all setup is done and builder is initialized.
void initialize()
Initialize OMPL structures. Only call this once all constraints, groups, and other parameters have be...
ompl::base::SpaceInformationPtr info
Actual Space Information.
TSRGoalPtr getGoalTSR(const TSRPtr &tsr)
Set a TSR as the goal for the planning problem (will create a TSRGoal)
ompl::geometric::PathGeometric getSolutionPath(bool simplify=true, bool interpolate=true) const
Get the solution path from a successful plan.
ompl::geometric::SimpleSetupPtr ss
Simple Setup.
void addGroup(const std::string &robot, const std::string &name, std::size_t cyclic=0)
Add a robot's planning group to the controlled DoF in the state space.
The specification of a TSR.
void setPose(const RobotPose &other)
Set the pose of the TSR.
void setFrame(const std::string &structure, const std::string &target, const std::string &base=magic::ROOT_FRAME)
Set the base and target frame.
void setYPosTolerance(double bound)
Set the Y position tolerance to (-bound, bound).
void setXPosTolerance(double bound)
Setting Position Tolerances.
A Task Space Region (TSR). TSRs are workspace regions that impose a constraints on a robot....
void initialize()
Initialize this TSR. Creates IK node attached to body node in world.
bool solveWorld()
Solve for a satisfying configuration given the current state of the world.
void useGroup(const std::string &name)
Use the joints in a robot's group. Robot used is the target frame's structure.
Open Scene Graph GUI for DART visualization.
void run(std::function< void()> thread={})
Run the GUI. Blocks.
void animatePath(const StateSpacePtr &space, const ompl::geometric::PathGeometric &path, std::size_t times=1, double fps=60, bool block=true)
Animate a motion plan using the world.
int main(int argc, char **argv)
static const std::string GROUP
#define RBX_WARN(fmt,...)
Output a warning logging message.
#define RBX_INFO(fmt,...)
Output a info logging message.
Main namespace. Contains all library classes and functions.
Functions for loading and animating scenes in Blender.