choreo_core_service.h
Go to the documentation of this file.
1 #ifndef FRAMEFAB_CORE_SERVICE_H
2 #define FRAMEFAB_CORE_SERVICE_H
3 
4 #include <ros/ros.h>
5 
6 // served service
7 #include <choreo_msgs/ElementNumberRequest.h>
8 #include <choreo_msgs/VisualizeSelectedPath.h>
9 #include <choreo_msgs/GetAvailableProcessPlans.h>
10 #include <choreo_msgs/OutputProcessPlans.h>
11 #include <choreo_msgs/QueryComputationRecord.h>
12 
13 // msgs
14 #include <choreo_msgs/ChoreoParameters.h>
15 #include <choreo_msgs/ModelInputParameters.h>
16 #include <choreo_msgs/TaskSequenceInputParameters.h>
17 #include <choreo_msgs/RobotInputParameters.h>
18 #include <choreo_msgs/OutputSaveDirInputParameters.h>
19 #include <choreo_msgs/ElementCandidatePoses.h>
20 #include <choreo_msgs/UnitProcessPlan.h>
21 
22 // actions
23 #include <choreo_msgs/TaskSequenceProcessingAction.h>
24 #include <choreo_msgs/TaskSequencePlanningAction.h>
25 #include <choreo_msgs/ProcessPlanningAction.h>
26 #include <choreo_msgs/ProcessExecutionAction.h>
27 #include <choreo_msgs/SimulateMotionPlanAction.h>
30 
31 // helper functions
33 
34 // visualizer
36 
37 // TODO: we should avoid using this kind of "alias". It decrease code's readability.
39 {
40  std::vector<choreo_msgs::UnitProcessPlan> plans;
41 };
42 
43 // this package is the central monitoring node that connects
44 // Choreo's specialized packages together. It receives requests from UI
45 // package and dispatch / receive computation request to responsible packages.
46 
48 {
49  public:
51 
52  bool init();
53  void run();
54 
55  private:
56  bool loadModelInputParameters(const std::string &filename);
57  void saveModelInputParameters(const std::string &filename);
58  bool loadTaskSequenceInputParameters(const std::string& filename);
59  void saveTaskSequenceInputParameters(const std::string& filename);
60  bool loadRobotInputParameters(const std::string& filename);
61  void saveRobotInputParameters(const std::string& filename);
62  bool loadOutputSaveDirInputParameters(const std::string& filename);
63  void saveOutputSaveDirInputParameters(const std::string& filename);
64  int checkSavedLadderGraphSize(const std::string& filename);
65 
66  // Service callbacks
67  bool choreoParametersServerCallback(choreo_msgs::ChoreoParameters::Request& req,
68  choreo_msgs::ChoreoParameters::Response& res);
69 
70  // reponding to <path selection> (until which index we compute)
71  // and <plan selection> element number query in UI
72  bool elementNumberRequestServerCallback(choreo_msgs::ElementNumberRequest::Request& req,
73  choreo_msgs::ElementNumberRequest::Response& res);
74 
75  // visualize selected assembly sequence and grasp (w or w/o end effector)
76  bool visualizeSelectedPathServerCallback(choreo_msgs::VisualizeSelectedPath::Request& req,
77  choreo_msgs::VisualizeSelectedPath::Response& res);
78 
79  bool getAvailableProcessPlansCallback(choreo_msgs::GetAvailableProcessPlans::Request& req,
80  choreo_msgs::GetAvailableProcessPlans::Response& res);
81 
82  bool outputProcessPlansCallback(choreo_msgs::OutputProcessPlans::Request& req,
83  choreo_msgs::OutputProcessPlans::Response& res);
84 
85  bool queryComputationResultCallback(choreo_msgs::QueryComputationRecord::Request& req,
86  choreo_msgs::QueryComputationRecord::Response& res);
87 
88  // Action callbacks
89  void taskSequenceProcessingActionCallback(const choreo_msgs::TaskSequenceProcessingGoalConstPtr &goal);
90  void taskSequencePlanningActionCallback(const choreo_msgs::TaskSequencePlanningGoalConstPtr &goal);
91  void processPlanningActionCallback(const choreo_msgs::ProcessPlanningGoalConstPtr &goal);
92  void simulateMotionPlansActionCallback(const choreo_msgs::SimulateMotionPlanGoalConstPtr& goal_in);
93 
94  // Process Planning - these process planning related
95  // methods are defined in src/choreo_core_service_process_planning.cpp
96  bool generateMotionLibrary(
97  const int selected_path_index,
99 
100  // call task sequence planner to request collision objects
101  // and then call process planner node to trigger process planning
102  // TODO:
103  ProcessPlanResult generateProcessPlan(const int& index);
104 
105  // immediate plan & execution for resetting the robot
106  bool moveToTargetJointPose(std::vector<double> joint_pose);
107 
108  // TODO: complete this
109  void adjustSimSpeed(double sim_speed);
110 
111  bool generatePicknPlaceMotionLibrary();
112 
113  private:
114  // Services offered by this class
121 
122  // Services subscribed to by this class
128 
129  // Actions offered by this class
132  choreo_msgs::TaskSequenceProcessingFeedback task_sequence_processing_feedback_;
133  choreo_msgs::TaskSequenceProcessingResult task_sequence_processing_result_;
134 
136  choreo_msgs::TaskSequencePlanningFeedback task_sequence_planning_feedback_;
137  choreo_msgs::TaskSequencePlanningResult task_sequence_planning_result_;
138 
140  choreo_msgs::ProcessPlanningFeedback process_planning_feedback_;
141  choreo_msgs::ProcessPlanningResult process_planning_result_;
142 
144 
145 
146 
147 
148 
149 
150 
151 
152 
153  choreo_msgs::SimulateMotionPlanFeedback simulate_motion_plan_feedback_;
154  choreo_msgs::SimulateMotionPlanResult simulate_motion_plan_result_;
155 
156  // Actions subscribed to by this class
158 
159  // Visualizer for imported geometry, assembly sequence, and grasps
161 
162  // TODO: should remove this
163  // working environment collision objects
164  std::vector<moveit_msgs::CollisionObject> env_objs_;
165 
166  // formulated task sequence results, parsed from task sequence processor
167  std::vector<choreo_msgs::ElementCandidatePoses> task_sequence_;
168 
169  // TODO: parsed assembly seqence
170  choreo_msgs::AssemblySequencePickNPlace as_pnp_;
171 
172  // Trajectory library
176 
177  // Parameters
178  choreo_msgs::ModelInputParameters model_input_params_;
179  choreo_msgs::TaskSequenceInputParameters task_sequence_input_params_;
180  choreo_msgs::RobotInputParameters robot_input_params_;
181  choreo_msgs::OutputSaveDirInputParameters output_save_dir_input_params_;
182 
183  choreo_msgs::ModelInputParameters default_model_input_params_;
184  choreo_msgs::TaskSequenceInputParameters default_task_sequence_input_params_;
185  choreo_msgs::RobotInputParameters default_robot_input_params_;
186  choreo_msgs::OutputSaveDirInputParameters default_output_save_dir_input_params_;
187 
188  // Parameter loading and saving
190  std::string save_location_;
191  std::string param_cache_prefix_;
192  std::string world_frame_;
193 
194  std::string assembly_type_;
195 };
196 
197 #endif
ros::ServiceClient task_sequence_processing_srv_client_
choreo_msgs::TaskSequencePlanningFeedback task_sequence_planning_feedback_
filename
choreo_msgs::RobotInputParameters default_robot_input_params_
choreo_msgs::TaskSequenceInputParameters default_task_sequence_input_params_
std::vector< choreo_msgs::UnitProcessPlan > plans
choreo_msgs::OutputSaveDirInputParameters output_save_dir_input_params_
ros::ServiceClient move_to_pose_client_
ros::ServiceServer choreo_parameters_server_
ros::ServiceClient process_planning_client_
std::vector< moveit_msgs::CollisionObject > env_objs_
choreo_core_service::TrajectoryLibrary trajectory_library_
ros::ServiceClient output_processing_client_
choreo_msgs::TaskSequencePlanningResult task_sequence_planning_result_
choreo_msgs::TaskSequenceProcessingFeedback task_sequence_processing_feedback_
choreo_msgs::OutputSaveDirInputParameters default_output_save_dir_input_params_
actionlib::SimpleActionServer< choreo_msgs::SimulateMotionPlanAction > simulate_motion_plan_server_
choreo_msgs::TaskSequenceProcessingResult task_sequence_processing_result_
unsigned int index
ros::ServiceClient task_sequence_planning_srv_client_
choreo_msgs::RobotInputParameters robot_input_params_
choreo_msgs::ModelInputParameters model_input_params_
choreo_visual_tools::ChoreoVisualTools visual_tools_
choreo_msgs::TaskSequenceInputParameters task_sequence_input_params_
ros::ServiceServer element_number_sequest_server_
actionlib::SimpleActionClient< choreo_msgs::ProcessExecutionAction > choreo_exe_client_
actionlib::SimpleActionServer< choreo_msgs::ProcessPlanningAction > process_planning_server_
ros::ServiceServer query_computation_result_server_
choreo_msgs::SimulateMotionPlanFeedback simulate_motion_plan_feedback_
res
choreo_msgs::ProcessPlanningFeedback process_planning_feedback_
actionlib::SimpleActionServer< choreo_msgs::TaskSequenceProcessingAction > task_sequence_processing_server_
actionlib::SimpleActionServer< choreo_msgs::TaskSequencePlanningAction > task_sequence_planning_server_
ros::ServiceServer get_available_process_plans_server_
choreo_msgs::ModelInputParameters default_model_input_params_
choreo_msgs::ProcessPlanningResult process_planning_result_
ros::ServiceServer output_process_plans_server_
choreo_msgs::SimulateMotionPlanResult simulate_motion_plan_result_
std::vector< choreo_msgs::ElementCandidatePoses > task_sequence_
void run(ClassLoader *loader)
ros::ServiceServer visualize_selected_path_server_
std::string param_cache_prefix_
choreo_msgs::AssemblySequencePickNPlace as_pnp_


choreo_core
Author(s): Yijiang Huang
autogenerated on Thu Jul 18 2019 03:59:38