28 auto fetch = std::make_shared<FetchRobot>();
29 fetch->initialize(
false);
33 scene->fromYAMLFile(
"package://robowflex_tesseract/scenes/table/scene.yaml");
36 scene->attachObject(*
fetch->getScratchState(),
"Can1");
39 auto planner = std::make_shared<TrajOptPlanner>(
fetch,
GROUP);
40 planner->initialize(
"torso_lift_link",
"gripper_link");
43 planner->options.num_waypoints = 8;
44 planner->setInitType(trajopt::InitInfo::Type::JOINT_INTERPOLATED);
48 const auto &request = std::make_shared<MotionRequestBuilder>(
fetch);
49 request->fromYAMLFile(
"package://robowflex_tesseract/scenes/table/request.yaml");
52 const auto &rviz = std::make_shared<IO::RVIZHelper>(
fetch);
53 rviz->updateScene(
scene);
54 rviz->visualizeState(request->getStartConfiguration());
57 RBX_INFO(
"Press Enter to run the planner and returning its first solution");
61 planner->options.return_first_sol =
true;
64 auto res = planner->plan(
scene, request->getRequest());
65 if (res.error_code_.val == moveit_msgs::MoveItErrorCodes::SUCCESS)
66 rviz->updateTrajectory(res);
68 rviz->visualizeState(request->getGoalConfiguration());
71 RBX_INFO(
"Press Enter to run the planner with a time bound but returning as soon as it finds the first "
78 planner->options.return_first_sol =
false;
79 planner->options.return_after_timeout =
false;
82 request->getRequest().allowed_planning_time = 3.0;
85 res = planner->plan(
scene, request->getRequest());
86 if (res.error_code_.val == moveit_msgs::MoveItErrorCodes::SUCCESS)
87 rviz->updateTrajectory(res);
89 rviz->visualizeState(request->getGoalConfiguration());
92 RBX_INFO(
"Press Enter to run the planner for the whole time budget");
96 planner->options.return_first_sol =
false;
97 planner->options.return_after_timeout =
true;
100 request->getRequest().allowed_planning_time = 3.0;
103 res = planner->plan(
scene, request->getRequest());
104 if (res.error_code_.val == moveit_msgs::MoveItErrorCodes::SUCCESS)
105 rviz->updateTrajectory(res);
107 rviz->visualizeState(request->getGoalConfiguration());
RAII-pattern for starting up ROS.
static const std::string GROUP
#define RBX_INFO(fmt,...)
Output a info logging message.
Functions for loading and animating scenes in Blender.