17 #include <ompl/geometric/SimpleSetup.h>
18 #include <ompl/geometric/planners/rrt/RRTstar.h>
22 int main(
int argc,
char **argv)
24 auto world = std::make_shared<darts::World>();
27 "package://robowflex_resources/fetch/robots/fetch.urdf",
28 "package://robowflex_resources/fetch/config/fetch.srdf");
31 auto *base_link =
fetch->getFrame(
"base_link");
32 dart::dynamics::PlanarJoint::Properties planar_joint;
33 planar_joint.mName =
"planar_joint";
35 base_link->moveTo<dart::dynamics::PlanarJoint>(
nullptr, planar_joint);
38 fetch->addJointToGroup(
"observation",
"planar_joint");
39 fetch->addJointToGroup(
"observation",
"head_pan_joint");
40 fetch->addJointToGroup(
"observation",
"head_tilt_joint");
42 world->addRobot(
fetch);
45 auto scene = std::make_shared<darts::Structure>(
"object");
46 scene->addGround(-0.01, 10);
50 for (
size_t i = 0; i < nobs; ++i)
52 dart::dynamics::WeldJoint::Properties box_joint;
54 box_joint.mT_ParentBodyToJoint.translation() =
59 for (
size_t i = 0; i < nobs; ++i)
60 for (
size_t j = i + 1; j < nobs; ++j)
63 world->addStructure(
scene);
68 builder.
addGroup(
"fetch",
"observation");
82 auto rrt = std::make_shared<ompl::geometric::RRTstar>(builder.
info);
83 builder.
ss->setPlanner(rrt);
90 ompl::base::PlannerStatus solved = builder.
ss->solve(5.0);
A helper class to setup common OMPL structures for planning.
void setGoal(const ompl::base::GoalPtr &goal)
Set the goal for the problem.
void setup()
Calls setup routines on OMPL structures. Call after all setup is done and builder is initialized.
void setStartConfiguration(const Eigen::Ref< const Eigen::VectorXd > &q)
Set the start configuration from a configuration.
void initialize()
Initialize OMPL structures. Only call this once all constraints, groups, and other parameters have be...
ompl::base::SpaceInformationPtr info
Actual Space Information.
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.
std::shared_ptr< ompl::base::GoalStates > getGoalConfiguration(const Eigen::Ref< const Eigen::VectorXd > &q)
Set the goal configuration from a configuration.
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)
#define RBX_WARN(fmt,...)
Output a warning logging message.
#define RBX_INFO(fmt,...)
Output a info logging message.
double uniformReal(double lower_bound, double upper_bound)
Generate a random real within given bounds: [lower_bound, upper_bound)
RobotPtr loadMoveItRobot(const std::string &name, const std::string &urdf, const std::string &srdf)
Load a robot from a URDF and SRDF (i.e., a MoveIt enabled robot).
std::shared_ptr< dart::dynamics::BoxShape > makeBox(const Eigen::Ref< const Eigen::Vector3d > &v)
Create a box.
std::string format(const std::string &fmt, Args &&... args)
Recursion base case, return string form of formatted arguments.
Main namespace. Contains all library classes and functions.
Functions for loading and animating scenes in Blender.