motor_trace_buffer.h
Go to the documentation of this file.
1 
26 #ifndef SR_EDC_ETHERCAT_DRIVERS_MOTOR_TRACE_BUFFER_H
27 #define SR_EDC_ETHERCAT_DRIVERS_MOTOR_TRACE_BUFFER_H
28 
29 #include <sr_edc_ethercat_drivers/MotorTraceSample.h>
30 #include <sr_edc_ethercat_drivers/ActuatorInfo.h>
31 #include <sr_edc_ethercat_drivers/MotorTrace.h>
32 
34 #include <boost/thread/condition.hpp> // Missing from realtime_publisher : wg-ros-pkg Ticket #4682
35 #include <boost/utility.hpp>
36 #include <string>
37 #include <vector>
38 
40 {
50  private boost::noncopyable
51 {
52 public:
53  explicit MotorTraceBuffer(unsigned trace_size);
54 
55  bool initialize(const sr_edc_ethercat_drivers::ActuatorInfo &actuator_info);
56 
57  void flagPublish(const std::string &reason, int level, int delay);
58 
59  void checkPublish();
60 
61  void sample(const sr_edc_ethercat_drivers::MotorTraceSample &s);
62 
63  void reset();
64 
65 protected:
66  unsigned trace_size_; // !< size of trace vector
67  unsigned trace_index_; // !< index of most recent element in trace vector
68  unsigned published_traces_; // !< number of times motor trace has been published
69  std::vector<sr_edc_ethercat_drivers::MotorTraceSample> trace_buffer_;
73  std::string publish_reason_;
74 };
75 } // namespace sr_edc_ethercat_drivers
76 
77 #endif // SR_EDC_ETHERCAT_DRIVERS_MOTOR_TRACE_BUFFER_H
XmlRpcServer s
void flagPublish(const std::string &reason, int level, int delay)
flags delayed publish of motor trace.
Class to buffer and publish previous 1-second of motor data.
void sample(const sr_edc_ethercat_drivers::MotorTraceSample &s)
Adds sample to motor trace.
bool initialize(const sr_edc_ethercat_drivers::ActuatorInfo &actuator_info)
Initializes motor trace publisher.
realtime_tools::RealtimePublisher< sr_edc_ethercat_drivers::MotorTrace > * publisher_
void checkPublish()
Publishes motor trace if delay time is up.
std::vector< sr_edc_ethercat_drivers::MotorTraceSample > trace_buffer_


sr_edc_ethercat_drivers
Author(s): Ugo Cupcic, Yann Sionneau, Toni Oliver
autogenerated on Tue Oct 13 2020 04:02:02