yarp-devices
CommandBuffer.hpp
1 // -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-
2 
3 #ifndef __COMMAND_BUFFER_HPP__
4 #define __COMMAND_BUFFER_HPP__
5 
6 #include <mutex>
7 
8 namespace roboticslab
9 {
10 
16 {
17 public:
18  void accept(double command);
19  double interpolate();
20  double getStoredCommand(double * timestamp = nullptr) const;
21  void reset(double initialCommand);
22 
23 private:
24  double storedCommand {0.0};
25  double interpolationResult {0.0};
26  double commandPeriod {0.0};
27  double commandTimestamp {0.0};
28  double interpolationTimestamp {0.0};
29  mutable std::mutex mutex;
30 };
31 
32 } // namespace roboticslab
33 
34 #endif // __COMMAND_BUFFER_HPP__
A buffer for periodic commands implementing linear interpolation.
Definition: CommandBuffer.hpp:16
The main, catch-all namespace for Robotics Lab UC3M.
Definition: groups.dox:6