Robowflex  v0.1
Making MoveIt Easy
wam7_test.cpp
Go to the documentation of this file.
1 /** \author Bryce Willey */
2 
8 
9 using namespace robowflex;
10 
11 int main(int argc, char **argv)
12 {
13  // Startup ROS
14  ROS ros(argc, argv);
15 
16  // Create a WAM7 robot, specifying all necessary files.
17  auto wam7 = std::make_shared<Robot>("wam7");
18  wam7->initialize("package://barrett_model/robots/wam_7dof_wam_bhand.urdf.xacro", // urdf
19  "package://barrett_wam_moveit_config/config/wam7_hand.srdf", // srdf
20  "package://barrett_wam_moveit_config/config/joint_limits.yaml", // joint limits
21  "package://barrett_wam_moveit_config/config/kinematics.yaml" // kinematics
22  );
23 
24  // Load kinematics for the WAM7 arm.
25  wam7->loadKinematics("arm");
26 
27  // Create an empty scene.
28  auto scene = std::make_shared<Scene>(wam7);
29 
30  // Create the default OMPL planner with path simplification disabled, with the WAM7 planning
31  // configuration.
32  auto planner = std::make_shared<OMPL::OMPLPipelinePlanner>(wam7);
33 
34  OMPL::Settings settings;
35  settings.simplify_solutions = false;
36  planner->initialize("package://barrett_wam_moveit_config/config/ompl_planning.yaml", // planner config
37  settings);
38 
39  // Create a motion planning request with a joint position goal.
40  MotionRequestBuilder request(planner, "arm");
41  request.setStartConfiguration({0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0});
42  request.setGoalConfiguration({0.0, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0});
43  request.setConfig("BKPIECE");
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
bool setConfig(const std::string &requested_config)
Set the planning configuration to use for the motion planning request. Attempts to match requested_co...
Definition: builder.cpp:114
void setStartConfiguration(const std::vector< double > &joints)
Set the start configuration from a vector joints. All joints are assumed to be specified and in the d...
Definition: builder.cpp:189
planning_interface::MotionPlanRequest & getRequest()
Get a reference to the currently built motion planning request.
Definition: builder.cpp:493
void setGoalConfiguration(const std::vector< double > &joints)
Set the goal configuration from a vector joints. All joints are assumed to be specified and in the de...
Definition: builder.cpp:372
Settings descriptor for settings provided by the default MoveIt! OMPL planning pipeline.
bool simplify_solutions
Whether or not planner should simplify solutions.
RAII-pattern for starting up ROS.
Definition: util.h:52
Main namespace. Contains all library classes and functions.
Definition: scene.cpp:25
Functions for loading and animating scenes in Blender.
moveit_msgs::MoveItErrorCodes error_code_
int main(int argc, char **argv)
Definition: wam7_test.cpp:11