Class to buffer and publish previous 1-second of motor data. More...
#include <motor_trace_buffer.h>
Public Member Functions | |
void | checkPublish () |
Publishes motor trace if delay time is up. | |
void | flagPublish (const std::string &reason, int level, int delay) |
flags delayed publish of motor trace. | |
bool | initialize (const sr_edc_ethercat_drivers::ActuatorInfo &actuator_info) |
Initializes motor trace publisher. | |
MotorTraceBuffer (unsigned trace_size) | |
void | reset () |
void | sample (const sr_edc_ethercat_drivers::MotorTraceSample &s) |
Adds sample to motor trace. | |
Protected Attributes | |
int | publish_delay_ |
int | publish_level_ |
std::string | publish_reason_ |
unsigned | published_traces_ |
number of times motor trace has been published | |
realtime_tools::RealtimePublisher < sr_edc_ethercat_drivers::MotorTrace > * | publisher_ |
std::vector < sr_edc_ethercat_drivers::MotorTraceSample > | trace_buffer_ |
unsigned | trace_index_ |
index of most recent element in trace vector | |
unsigned | trace_size_ |
size of trace vector |
Class to buffer and publish previous 1-second of motor data.
Data is sampled with each cycle of realtime loop (1kHz) so that there is too much data to be published continuouly. Instead of continuously publishing data, the trace buffers the previous X seconds of samples. Publishing can be triggered as result of event or request.
Definition at line 50 of file motor_trace_buffer.h.
sr_edc_ethercat_drivers::MotorTraceBuffer::MotorTraceBuffer | ( | unsigned | trace_size | ) |
Definition at line 36 of file motor_trace_buffer.cpp.
Publishes motor trace if delay time is up.
Definition at line 75 of file motor_trace_buffer.cpp.
void sr_edc_ethercat_drivers::MotorTraceBuffer::flagPublish | ( | const std::string & | reason, |
int | level, | ||
int | delay | ||
) |
flags delayed publish of motor trace.
New publish will only take precedence of previous publish iff level is higher than previous level
Definition at line 115 of file motor_trace_buffer.cpp.
bool sr_edc_ethercat_drivers::MotorTraceBuffer::initialize | ( | const sr_edc_ethercat_drivers::ActuatorInfo & | actuator_info | ) |
Initializes motor trace publisher.
Definition at line 56 of file motor_trace_buffer.cpp.
Definition at line 46 of file motor_trace_buffer.cpp.
void sr_edc_ethercat_drivers::MotorTraceBuffer::sample | ( | const sr_edc_ethercat_drivers::MotorTraceSample & | s | ) |
Adds sample to motor trace.
Definition at line 133 of file motor_trace_buffer.cpp.
int sr_edc_ethercat_drivers::MotorTraceBuffer::publish_delay_ [protected] |
Definition at line 65 of file motor_trace_buffer.h.
int sr_edc_ethercat_drivers::MotorTraceBuffer::publish_level_ [protected] |
Definition at line 66 of file motor_trace_buffer.h.
std::string sr_edc_ethercat_drivers::MotorTraceBuffer::publish_reason_ [protected] |
Definition at line 67 of file motor_trace_buffer.h.
unsigned sr_edc_ethercat_drivers::MotorTraceBuffer::published_traces_ [protected] |
number of times motor trace has been published
Definition at line 62 of file motor_trace_buffer.h.
realtime_tools::RealtimePublisher<sr_edc_ethercat_drivers::MotorTrace>* sr_edc_ethercat_drivers::MotorTraceBuffer::publisher_ [protected] |
Definition at line 64 of file motor_trace_buffer.h.
std::vector<sr_edc_ethercat_drivers::MotorTraceSample> sr_edc_ethercat_drivers::MotorTraceBuffer::trace_buffer_ [protected] |
Definition at line 63 of file motor_trace_buffer.h.
unsigned sr_edc_ethercat_drivers::MotorTraceBuffer::trace_index_ [protected] |
index of most recent element in trace vector
Definition at line 61 of file motor_trace_buffer.h.
unsigned sr_edc_ethercat_drivers::MotorTraceBuffer::trace_size_ [protected] |
size of trace vector
Definition at line 60 of file motor_trace_buffer.h.