choreo_process_planning_node.cpp
Go to the documentation of this file.
1 //
2 // Created by yijiangh on 6/18/17.
3 //
4 
5 // Process Services
7 
8 // srv
9 #include <choreo_msgs/ProcessPlanning.h>
10 
11 #include <ros/ros.h>
12 
13 // Globals
14 const static std::string PROCESS_PLANNING_SERVICE = "process_planning";
15 const static std::string MOVE_TO_TARGET_POSE_SERVICE = "move_to_target_pose";
16 
17 namespace
18 {
19 }// anon util namespace
20 
21 int main(int argc, char** argv)
22 {
23  ros::init(argc, argv, "choreo_process_planning");
24 
25  // TODO: these parmaters' names are misleading, should be more app-neutral
26  // Load local parameters
27  ros::NodeHandle nh, pnh("~");
28  std::string world_frame, hotend_group, hotend_tcp, hotend_base, robot_model_plugin;
29  pnh.param<std::string>("world_frame", world_frame, "");
30  pnh.param<std::string>("hotend_group", hotend_group, ""); // planning group name
31  pnh.param<std::string>("hotend_tcp", hotend_tcp, ""); // tool frame name
32  pnh.param<std::string>("hotend_base", hotend_base, ""); // work object/reference frame name
33  pnh.param<std::string>("robot_model_plugin", robot_model_plugin, "");
34 
35  // IK Plugin parameter must be specified
36  if (robot_model_plugin.empty())
37  {
38  ROS_ERROR_STREAM("[process planning] MUST SPECIFY PARAMETER 'robot_model_plugin' for choreo_process_planning node");
39  return -1;
40  }
41 
43 
44  // Creates a planning manager that will create the appropriate planning classes and perform
45  // all required initialization. It exposes member functions to handle each kind of processing
46  // event.
47  ProcessPlanningManager manager(world_frame, hotend_group, hotend_tcp, world_frame, robot_model_plugin);
48 
49  // Plumb in the appropriate ros services
50  ros::ServiceServer pp_server = nh.advertiseService(
51  PROCESS_PLANNING_SERVICE, &ProcessPlanningManager::handleProcessPlanning, &manager);
52 
53  ros::ServiceServer move_to_target_pose_server = nh.advertiseService(
54  MOVE_TO_TARGET_POSE_SERVICE, &ProcessPlanningManager::handleMoveToTargetPosePlanAndExecution, &manager);
55 
56  // Serve and wait for shutdown
57  ROS_INFO_STREAM("[PP] process planning server online");
58  ros::spin();
59 
60  return 0;
61 }
int main(int argc, char **argv)
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
ServiceServer advertiseService(const std::string &service, bool(T::*srv_func)(MReq &, MRes &), T *obj)
ROSCPP_DECL void spin(Spinner &spinner)
bool param(const std::string &param_name, T &param_val, const T &default_val) const
static const std::string PROCESS_PLANNING_SERVICE
#define ROS_INFO_STREAM(args)
static const std::string MOVE_TO_TARGET_POSE_SERVICE
#define ROS_ERROR_STREAM(args)


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