blmc_drivers
spi_motor_board.hpp
Go to the documentation of this file.
1 
13 #pragma once
14 
16 #include "real_time_tools/thread.hpp"
17 #include "real_time_tools/threadsafe/threadsafe_timeseries.hpp"
18 
20 
21 namespace blmc_drivers
22 {
23 
25 {
26 
27 public:
41  SpiMotorBoard(std::shared_ptr<SpiBus> spi_bus, const size_t udriver_id);
42 
48 
57  virtual std::shared_ptr<const MotorInterface::ScalarTimeseries>
58  get_measurement(const int& index) const ;
59 
64  virtual std::shared_ptr<const MotorBoardInterface::StatusTimeseries>
65  get_status() const;
66 
75  virtual std::shared_ptr<const MotorInterface::ScalarTimeseries>
76  get_control(const int& index) const;
77 
82  virtual std::shared_ptr<const MotorBoardInterface::CommandTimeseries>
83  get_command() const;
84 
89  virtual std::shared_ptr<const MotorInterface::ScalarTimeseries>
90  get_sent_control(const int& index) const;
91 
96  virtual std::shared_ptr<const MotorBoardInterface::CommandTimeseries>
97  get_sent_command() const;
98 
107  virtual void set_control(const double& control, const int& index);
108 
113  virtual void set_command(const MotorBoardCommand& command);
114 
121  virtual void send_if_input_changed();
122 
126  bool is_ready();
127 
128 private:
137  std::shared_ptr<SpiBus> spi_bus_;
138 
144  size_t udriver_id_;
145 };
146 
147 }
virtual std::shared_ptr< const MotorInterface::ScalarTimeseries > get_control(const int &index) const
input logs
Definition: spi_motor_board.cpp:59
virtual std::shared_ptr< const MotorBoardInterface::CommandTimeseries > get_command() const
Get the commands to be send.
Definition: spi_motor_board.cpp:66
MotorBoardInterface declares an API to inacte with a MotorBoard.
Definition: motor_board.hpp:209
This namespace is the standard namespace of the package.
Definition: const_torque_control.cpp:12
bool is_ready()
return s only once board and motors are ready.
This MotorBoardCommand class is a data structurs that defines a command.
Definition: motor_board.hpp:30
virtual void set_command(const MotorBoardCommand &command)
set_command save the command internally.
Definition: spi_motor_board.cpp:95
Interface for the main board designed by Thomas Floyols https://github.com/open-dynamic-robot-initiat...
virtual std::shared_ptr< const MotorInterface::ScalarTimeseries > get_measurement(const int &index) const
Output and status.
Definition: spi_motor_board.cpp:42
~SpiMotorBoard()
Destroy the SpiMotorBoard object.
Definition: spi_motor_board.cpp:33
virtual void set_control(const double &control, const int &index)
Setters.
Definition: spi_motor_board.cpp:88
size_t udriver_id_
udriver_id_ is the index of the udriver controlled by the master board.
Definition: spi_motor_board.hpp:144
std::shared_ptr< SpiBus > spi_bus_
Communication related attributes.
Definition: spi_motor_board.hpp:137
virtual void send_if_input_changed()
Actually send the commands and the controls.
Definition: spi_motor_board.cpp:100
SpiMotorBoard(std::shared_ptr< SpiBus > spi_bus, const size_t udriver_id)
Construct a new SpiMotorBoard object.
Definition: spi_motor_board.cpp:25
virtual std::shared_ptr< const MotorBoardInterface::StatusTimeseries > get_status() const
Get the status of the motor board.
Definition: spi_motor_board.cpp:49
virtual std::shared_ptr< const MotorBoardInterface::CommandTimeseries > get_sent_command() const
Get the sent commands.
Definition: spi_motor_board.cpp:79
virtual std::shared_ptr< const MotorInterface::ScalarTimeseries > get_sent_control(const int &index) const
Get the sent controls.
Definition: spi_motor_board.cpp:72
Definition: spi_motor_board.hpp:24