picknplace_planning.cpp
Go to the documentation of this file.
1 //
2 // Created by yijiangh on 4/3/18.
3 //
4 
6 
7 #include "generate_motion_plan.h"
8 #include "path_transitions.h"
9 #include "common_utils.h"
10 
11 #include <choreo_msgs/SequencedElement.h>
12 
13 #include <ros/console.h>
14 
15 namespace {
16 
17 const static std::string JOINT_TOPIC_NAME =
18  "joint_states"; // ROS topic to subscribe to for current robot state info
19 
20 } // end anon util namespace
21 
23 {
24 
26  choreo_msgs::ProcessPlanning::Request& req,
27  choreo_msgs::ProcessPlanning::Response& res)
28 {
29  // Enable Collision Checks
30  hotend_model_->setCheckCollisions(true);
31 
32  assert(req.as_pnp.sequenced_elements.size() > 0);
33 
34  const static double LINEAR_VEL = 0.5; // (m/s)
35  const static double LINEAR_DISC = 0.003; // meters
36 
37  // TODO: assuming current robot pose is the home pose, this should be read from ros parameter
38  std::vector<double> current_joints = getCurrentJointState(JOINT_TOPIC_NAME);
39 
40  // copy & crop up to the required index
41  assert(req.index > 0 && req.index < req.as_pnp.sequenced_elements.size());
42  choreo_msgs::AssemblySequencePickNPlace as_pnp = req.as_pnp;
43  as_pnp.sequenced_elements = std::vector<choreo_msgs::SequencedElement>(
44  as_pnp.sequenced_elements.begin(), as_pnp.sequenced_elements.begin() + req.index + 1);
45 
46  // TODO: this shouldn't remove collision objs in xacro?
47  // clear existing objs from previous planning
49 
51  req.use_saved_graph,
52  req.file_name,
53  req.clt_rrt_unit_process_timeout,
54  req.clt_rrt_timeout,
55  LINEAR_VEL,
56  LINEAR_DISC,
58  current_joints,
59  as_pnp,
63  res.plan))
64  {
65  return true;
66  }
67  else
68  {
69  return false;
70  }
71 }
72 
73 }// end ff_process_planning ns
bool clearAllCollisionObjects(ros::ServiceClient &planning_scene)
static const std::string JOINT_TOPIC_NAME
std::vector< double > getCurrentJointState(const std::string &topic)
bool generateMotionPlan(const std::string world_frame, const bool use_saved_graph, const std::string &saved_graph_file_name, const double clt_rrt_unit_process_timeout, const double clt_rrt_timeout, const std::string &move_group_name, const std::vector< double > &start_state, const std::vector< choreo_msgs::ElementCandidatePoses > &task_seq, const std::vector< choreo_msgs::WireFrameCollisionObject > &wf_collision_objs, std::vector< descartes_planner::ConstrainedSegment > &segs, descartes_core::RobotModelPtr model, moveit::core::RobotModelConstPtr moveit_model, ros::ServiceClient &planning_scene_diff_client, std::vector< choreo_msgs::UnitProcessPlan > &plans)
bool handlePickNPlacePlanning(choreo_msgs::ProcessPlanning::Request &req, choreo_msgs::ProcessPlanning::Response &res)


choreo_process_planning
Author(s): Yijiang Huang
autogenerated on Thu Jul 18 2019 03:59:02