Go to the documentation of this file.00001
00027 #ifndef SRH_ETHERCAT_HARDWARE_MOTOR_TRACE_H
00028 #define SRH_ETHERCAT_HARDWARE_MOTOR_TRACE_H
00029
00030 #include <sr_edc_ethercat_drivers/MotorTraceSample.h>
00031 #include <sr_edc_ethercat_drivers/ActuatorInfo.h>
00032 #include <sr_edc_ethercat_drivers/MotorTrace.h>
00033
00034 #include <realtime_tools/realtime_publisher.h>
00035 #include <boost/thread/condition.hpp>
00036 #include <boost/utility.hpp>
00037 #include <string>
00038
00039 namespace sr_edc_ethercat_drivers
00040 {
00041
00050 class MotorTraceBuffer : private boost::noncopyable
00051 {
00052 public:
00053 MotorTraceBuffer(unsigned trace_size);
00054 bool initialize(const sr_edc_ethercat_drivers::ActuatorInfo &actuator_info);
00055 void flagPublish(const std::string &reason, int level, int delay);
00056 void checkPublish();
00057 void sample(const sr_edc_ethercat_drivers::MotorTraceSample &s);
00058 void reset();
00059 protected:
00060 unsigned trace_size_;
00061 unsigned trace_index_;
00062 unsigned published_traces_;
00063 std::vector<sr_edc_ethercat_drivers::MotorTraceSample> trace_buffer_;
00064 realtime_tools::RealtimePublisher<sr_edc_ethercat_drivers::MotorTrace> *publisher_;
00065 int publish_delay_;
00066 int publish_level_;
00067 std::string publish_reason_;
00068 };
00069
00070
00071 };
00072
00073 #endif //SRH_ETHERCAT_HARDWARE_MOTOR_TRACE_H