choreo_process_planning.cpp
Go to the documentation of this file.
1 //
2 // Created by yijiangh on 7/5/17.
3 //
4 
6 
8 
10 
11 // service
12 #include <moveit_msgs/ApplyPlanningScene.h>
13 
14 const static std::string APPLY_PLANNING_SCENE_SERVICE = "apply_planning_scene";
15 
17  const std::string& world_frame, const std::string& hotend_group, const std::string& hotend_tcp, const std::string& hotend_base,
18  const std::string& robot_model_plugin)
19  : plugin_loader_("descartes_core", "descartes_core::RobotModel"),
20  hotend_group_name_(hotend_group)
21 {
22  world_frame_ = world_frame;
23 
24  // Attempt to load and initialize the printing robot model (hotend)
25  hotend_model_ = plugin_loader_.createInstance(robot_model_plugin);
26  if (!hotend_model_)
27  {
28  throw std::runtime_error(std::string("[FF_process_planning] Could not load: ") + robot_model_plugin);
29  }
30 
31  if (!hotend_model_->initialize("robot_description", hotend_group, hotend_base, hotend_tcp))
32  {
33  throw std::runtime_error("[FF_process_planning]: Unable to initialize descartes robot model");
34  }
35 
36  // Load the moveit model
38  moveit_model_ = robot_model_loader.getModel();
39 
40  if (moveit_model_.get() == NULL)
41  {
42  throw std::runtime_error("[FF_process_planning] Could not load moveit robot model");
43  }
44 
46  nh_.serviceClient<moveit_msgs::ApplyPlanningScene>(APPLY_PLANNING_SCENE_SERVICE);
47 }
48 
50  choreo_msgs::ProcessPlanning::Request& req,
51  choreo_msgs::ProcessPlanning::Response& res)
52 {
53  if(choreo::ASSEMBLY_TYPE_SPATIAL_EXTRUSION == req.assembly_type)
54  {
55  return handlePrintPlanning(req, res);
56  }
57 
58  if(choreo::ASSEMBLY_TYPE_PICKNPLACE == req.assembly_type)
59  {
60  return handlePickNPlacePlanning(req, res);
61  }
62 
63  ROS_ERROR("process planning: unknown / unsupported assembly type.");
64  return false;
65 }
bool handleProcessPlanning(choreo_msgs::ProcessPlanning::Request &req, choreo_msgs::ProcessPlanning::Response &res)
#define NULL
ServiceClient serviceClient(const std::string &service_name, bool persistent=false, const M_string &header_values=M_string())
pluginlib::ClassLoader< descartes_core::RobotModel > plugin_loader_
static const std::string ASSEMBLY_TYPE_PICKNPLACE
ProcessPlanningManager(const std::string &world_frame, const std::string &hotend_group, const std::string &hotend_tcp, const std::string &hotend_base, const std::string &robot_model_plugin)
static const std::string ASSEMBLY_TYPE_SPATIAL_EXTRUSION
bool handlePrintPlanning(choreo_msgs::ProcessPlanning::Request &req, choreo_msgs::ProcessPlanning::Response &res)
static const std::string APPLY_PLANNING_SCENE_SERVICE
const robot_model::RobotModelPtr & getModel() const
#define ROS_ERROR(...)
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