00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #ifndef MOVE_ARM_WAREHOUSE_LOGGER_H_
00039 #define MOVE_ARM_WAREHOUSE_LOGGER_H_
00040
00041 #include <mongo_ros/message_collection.h>
00042
00043 #include <arm_navigation_msgs/PlanningScene.h>
00044 #include <arm_navigation_msgs/MotionPlanRequest.h>
00045 #include <arm_navigation_msgs/ArmNavigationErrorCodes.h>
00046 #include <trajectory_msgs/JointTrajectory.h>
00047 #include <head_monitor_msgs/HeadMonitorFeedback.h>
00048
00049 namespace move_arm_warehouse
00050 {
00051
00052 class MoveArmWarehouseLoggerReader {
00053
00054 public:
00055
00056 MoveArmWarehouseLoggerReader();
00057
00058 ~MoveArmWarehouseLoggerReader();
00059
00060 const std::string& getHostname() const {
00061 return hostname_;
00062 }
00063
00067
00068 void pushPlanningSceneToWarehouseWithoutId(const arm_navigation_msgs::PlanningScene& planning_scene,
00069 unsigned int& id);
00070
00071 void pushPlanningSceneToWarehouse(const arm_navigation_msgs::PlanningScene& planning_scene,
00072 const unsigned int ID);
00073
00074 void pushMotionPlanRequestToWarehouse(const unsigned int planning_id,
00075 const unsigned int mpr_id,
00076 const std::string& stage_name,
00077 const arm_navigation_msgs::MotionPlanRequest& motion_plan_request);
00078
00079 void pushJointTrajectoryToWarehouse(const unsigned int id,
00080 const std::string& trajectory_source,
00081 const ros::Duration& production_time,
00082 const trajectory_msgs::JointTrajectory& trajectory,
00083 const trajectory_msgs::JointTrajectory& trajectory_control_error,
00084 const unsigned int ID,
00085 const unsigned int motion_plan_ID,
00086 const arm_navigation_msgs::ArmNavigationErrorCodes& error_code);
00087
00088 void pushOutcomeToWarehouse(const unsigned int id,
00089 const std::string& pipeline_stage,
00090 const arm_navigation_msgs::ArmNavigationErrorCodes& error_codes);
00091
00092 void pushPausedStateToWarehouse(const unsigned int id,
00093 const head_monitor_msgs::HeadMonitorFeedback& feedback);
00094
00098
00099 void getAvailablePlanningSceneList(const std::string& hostname,
00100 std::vector<unsigned int>& planning_scene_ids_,
00101 std::vector<ros::Time>& creation_times);
00102
00103 bool getPlanningScene(const std::string& hostname,
00104 const unsigned int& id,
00105 arm_navigation_msgs::PlanningScene& planning_scene,
00106 std::string& hostname_out);
00107
00108 bool getAssociatedOutcomes(const std::string& hostname,
00109 const unsigned int planning_scene_id,
00110 std::vector<std::string>& pipeline_names,
00111 std::vector<arm_navigation_msgs::ArmNavigationErrorCodes>& error_codes);
00112
00113 bool getAssociatedMotionPlanRequestsStageNames(const std::string& hostname,
00114 const unsigned int id,
00115 std::vector<std::string>& stage_names);
00116
00117 bool getAssociatedMotionPlanRequest(const std::string& hostname,
00118 const unsigned int planning_scene_id,
00119 const unsigned int motion_plan_id,
00120 arm_navigation_msgs::MotionPlanRequest& request);
00121
00122 bool getAssociatedMotionPlanRequests(const std::string& hostname,
00123 const unsigned int planning_scene_id,
00124 std::vector<unsigned int>& IDs,
00125 std::vector<std::string>& stage_names,
00126 std::vector<arm_navigation_msgs::MotionPlanRequest>& requests);
00127
00128 bool getAssociatedJointTrajectorySources(const std::string& hostname,
00129 const unsigned int planning_scene_id,
00130 const unsigned int motion_request_id,
00131 std::vector<unsigned int>& ids,
00132 std::vector<std::string>& trajectory_sources);
00133
00134 bool getAssociatedJointTrajectory(const std::string& hostname,
00135 const unsigned int planning_scene_id,
00136 const unsigned int motion_plan_id,
00137 const unsigned int trajectory_id,
00138 ros::Duration& processing_time,
00139 trajectory_msgs::JointTrajectory& joint_trajectory,
00140 trajectory_msgs::JointTrajectory& trajectory_control_error);
00141
00142 bool getAssociatedJointTrajectories(const std::string& hostname,
00143 const unsigned int planning_scene_id,
00144 const unsigned int motion_plan_id,
00145 std::vector<trajectory_msgs::JointTrajectory>& trajectories,
00146 std::vector<trajectory_msgs::JointTrajectory>& trajectory_control_errors,
00147 std::vector<std::string>& sources,
00148 std::vector<unsigned int>& IDs,
00149 std::vector<ros::Duration>& durations,
00150 std::vector<int32_t>& error_codes);
00151
00152 bool getAssociatedPausedStates(const std::string& hostname,
00153 const unsigned int planning_scene_id,
00154 std::vector<ros::Time>& paused_times);
00155
00156 bool getAssociatedPausedState(const std::string& hostname,
00157 const unsigned int planning_scene_id,
00158 const ros::Time& paused_time,
00159 head_monitor_msgs::HeadMonitorFeedback& paused_state);
00160
00161 bool hasPlanningScene(const std::string& hostname,
00162 const unsigned int id);
00163
00164 bool removePlanningSceneAndAssociatedDataFromWarehouse(const std::string& hostname,
00165 const unsigned int id);
00166
00167 unsigned int determineNextPlanningSceneId();
00168
00169 protected:
00170
00171 mongo_ros::Metadata initializeMetadataWithHostname();
00172
00173 void addPlanningSceneTimeToMetadata(const arm_navigation_msgs::PlanningScene& planning_scene, mongo_ros::Metadata& metadata);
00174 void addPlanningSceneIdToMetadata(const unsigned int& id,
00175 mongo_ros::Metadata& metadata);
00176
00177
00178 mongo_ros::Query makeQueryForPlanningSceneTime(const ros::Time& time);
00179 mongo_ros::Query makeQueryForPlanningSceneId(const unsigned int id);
00180
00181
00182 std::string jointTrajectoryToString(const trajectory_msgs::JointTrajectory& trajectory);
00183 void stringToJointTrajectory(const std::string& trajectory, trajectory_msgs::JointTrajectory& joint_trajectory);
00184
00185 mongo_ros::MessageCollection<arm_navigation_msgs::PlanningScene>* planning_scene_collection_;
00186 mongo_ros::MessageCollection<arm_navigation_msgs::MotionPlanRequest>* motion_plan_request_collection_;
00187 mongo_ros::MessageCollection<trajectory_msgs::JointTrajectory>* trajectory_collection_;
00188 mongo_ros::MessageCollection<arm_navigation_msgs::ArmNavigationErrorCodes>* outcome_collection_;
00189 mongo_ros::MessageCollection<head_monitor_msgs::HeadMonitorFeedback>* paused_state_collection_;
00190
00191 std::string hostname_;
00192
00193 };
00194
00195 }
00196 #endif