Robowflex  v0.1
Making MoveIt Easy
ur5_ompl_interface.cpp File Reference

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 15 of file ur5_ompl_interface.cpp.

16 {
17  // Startup ROS
18  ROS ros(argc, argv);
19 
20  // Create the default UR5 robot.
21  auto ur5 = std::make_shared<UR5Robot>();
22  ur5->initialize();
23 
24  // Create an empty scene.
25  auto scene = std::make_shared<Scene>(ur5);
26 
27  // Create an OMPL interface planner for the ur5.
28  auto planner = std::make_shared<OMPL::OMPLInterfacePlanner>(ur5);
29  planner->initialize("package://ur5_robotiq85_moveit_config/config/ompl_planning.yaml");
30 
31  // Create a motion planning request with a pose goal.
32  MotionRequestBuilder request(planner, "manipulator");
33  request.setStartConfiguration({0.0677, -0.8235, 0.9860, -0.1624, 0.0678, 0.0});
34 
35  RobotPose pose = RobotPose::Identity();
36  pose.translate(Eigen::Vector3d{-0.268, -0.826, 1.313});
37  Eigen::Quaterniond orn{0, 0, 1, 0};
38 
39  auto sphere = std::make_shared<Geometry>(Geometry::ShapeType::SPHERE, Eigen::Vector3d{0.01, 0, 0});
40  request.setGoalRegion("ee_link", "world", // links
41  pose, sphere, // position
42  orn, {0.01, 0.01, 0.01} // orientation
43  );
44 
45  // Do motion planning!
46  planning_interface::MotionPlanResponse res = planner->plan(scene, request.getRequest());
47  if (res.error_code_.val != moveit_msgs::MoveItErrorCodes::SUCCESS)
48  return 1;
49 
50  return 0;
51 }
A helper class to build motion planning requests for a robowflex::Planner.
Definition: builder.h:34
RAII-pattern for starting up ROS.
Definition: util.h:52
std::decay< decltype(std::declval< moveit::core::Transforms >().getTransform("")) >::type RobotPose
A pose (point in SE(3)) used in various functions. Defined from what MoveIt! uses.
Definition: adapter.h:24
Functions for loading and animating scenes in Blender.
moveit_msgs::MoveItErrorCodes error_code_