Go to the documentation of this file.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
00037 #ifndef _TRAJECTORY_RECORDER_H_
00038 #define _TRAJECTORY_RECORDER_H_
00039
00040 #include <ros/ros.h>
00041 #include <boost/function.hpp>
00042
00043 #include <trajectory_msgs/JointTrajectory.h>
00044
00045 namespace trajectory_execution_monitor
00046 {
00047
00049 typedef boost::function<bool( const ros::Time& time, const std::map<std::string, double>&,
00050 const std::map<std::string,double>&)> NewStateCallbackFunction;
00051
00053 class TrajectoryRecorder {
00054
00055 public:
00056
00057 TrajectoryRecorder(const std::string& recorder_name) : recorder_name_(recorder_name)
00058 {};
00059
00061 void registerCallback(const std::string& name, const NewStateCallbackFunction& callback) {
00062 callback_map_[name] = callback;
00063 };
00064
00068 void deregisterCallback(const std::string& name) {
00069 callback_map_.erase(name);
00070 };
00071
00074 void delayedDeregisterCallback(const std::string& name) {
00075 deregister_list_.push_back(name);
00076 }
00077
00079 const std::string& getName() const {
00080 return recorder_name_;
00081 }
00082
00083 protected:
00084
00086 void callCallbacks(const ros::Time& time,
00087 const std::map<std::string, double>& joint_positions,
00088 const std::map<std::string, double>& joint_velocities) ;
00089
00090 std::string recorder_name_;
00091 std::map<std::string, NewStateCallbackFunction> callback_map_;
00092 std::vector<std::string> deregister_list_;
00093
00094 };
00095
00096 }
00097
00098 #endif