19 auto world = std::make_shared<darts::World>();
22 "package://fetch_description/robots/fetch.urdf",
23 "package://fetch_moveit_config/config/fetch.srdf");
24 auto start = fetch1->getSkeleton()->getState();
26 auto scene = std::make_shared<darts::Structure>(
"object");
28 dart::dynamics::FreeJoint::Properties joint;
30 joint.mT_ParentBodyToJoint.translation() = Eigen::Vector3d(0.5, 0, 0.3);
33 world->addRobot(fetch1);
34 world->addStructure(
scene);
42 ik_spec.
setFrame(
"fetch1",
"wrist_roll_link");
43 auto ik_tsr = std::make_shared<darts::TSR>(world, ik_spec);
44 ik_tsr->useGroup(
"arm_with_torso");
48 options_ik.
name =
"arm_ik";
49 options_ik.
size = 0.4;
51 options_ik.
pose = fetch1->getFrame(
"wrist_roll_link")->getWorldTransform();
54 auto &spec = ik_tsr->getSpecification();
55 spec.setPose(
frame->getWorldTransform());
68 look_spec.
setFrame(
"fetch1",
"head_camera_link");
69 auto look_tsr = std::make_shared<darts::TSR>(world, look_spec);
70 look_tsr->initialize();
73 options_look.
name =
"head_look";
74 options_look.
pose = fetch1->getFrame(
"head_camera_link")->getWorldTransform();
75 options_look.
pose.translation()[1] += 0.5;
77 options_look.
linear[0] =
false;
78 options_look.
linear[1] =
false;
79 options_look.
linear[2] =
false;
81 options_look.
planar[0] =
false;
82 options_look.
planar[1] =
false;
83 options_look.
planar[2] =
false;
86 auto &spec = look_tsr->getSpecification();
87 spec.setPose(
frame->getWorldTransform());
88 look_tsr->updatePose();
91 look_tsr->solveWorld();
97 window.
getWidget()->addCheckbox(
"Enable IK", ik);
102 window.
getWidget()->addButton(
"Pick/Place", [&] {
104 fetch1->reparentFreeFrame(
cube,
"wrist_roll_link");
112 window.
getWidget()->addText(
"Press button to reset robot state!");
113 window.
getWidget()->addButton(
"Reset", [&] {
117 fetch1->getSkeleton()->setState(start);
118 ik_ret.target->setTransform(fetch1->getFrame(
"wrist_roll_link")->getWorldTransform());
119 auto tf = fetch1->getFrame(
"head_camera_link")->getWorldTransform();
120 tf.translation()[1] += 0.5;
121 look_ret.target->setTransform(tf);
The specification of a TSR.
void setFrame(const std::string &structure, const std::string &target, const std::string &base=magic::ROOT_FRAME)
Set the base and target frame.
Open Scene Graph GUI for DART visualization.
WindowWidgetPtr getWidget()
Get the IMGUI configurable widget.
void run(std::function< void()> thread={})
Run the GUI. Blocks.
InteractiveReturn createInteractiveMarker(const InteractiveOptions &options)
Create a new interactive marker in the GUI.
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.
Main namespace. Contains all library classes and functions.
Functions for loading and animating scenes in Blender.
Options for creating an interactive marker.
std::string name
Name of marker.
bool rotation[3]
Rotation ring controls enabled.
Eigen::Isometry3d pose
Relative pose of marker.
InteractiveCallback callback
Callback function on motion.
double size
Size of marker.
double thickness
Thickness of marker arrows.
bool linear[3]
Linear position controls enabled.
bool planar[3]
Planar translation controls enabled.