Flair
Framework Libre Air
Bldc.h
Go to the documentation of this file.
1 // %flair:license{
2 // This file is part of the Flair framework distributed under the
3 // CECILL-C License, Version 1.0.
4 // %flair:license}
13 #ifndef BLDC_H
14 #define BLDC_H
15 
16 #include <IODevice.h>
17 #include <stdint.h>
18 
19 namespace flair {
20 namespace core {
21 class Matrix;
22 }
23 namespace gui {
24 class Layout;
25 class TabWidget;
26 }
27 }
28 
29 class Bldc_impl;
30 
31 namespace flair {
32 namespace actuator {
37 class Bldc : public core::IODevice {
38  friend class ::Bldc_impl;
39 
40 public:
51  Bldc(const core::IODevice *parent, gui::Layout *layout, std::string name,
52  uint8_t motors_count);
53 
64  Bldc(const core::Object *parent, std::string name, uint8_t motors_count);
65 
70  ~Bldc();
71 
76  void LockUserInterface(void) const;
77 
82  void UnlockUserInterface(void) const;
83 
89  void UseDefaultPlot(gui::TabWidget *tabwidget);
90 
98  core::Matrix *Output(void) const;
99 
105  uint8_t MotorsCount(void) const;
106 
112  void SetEnabled(bool status);
113 
119  bool AreEnabled(void) const;
120 
137  void SetPower(int motor_id, float value);
138 
146  gui::Layout *GetLayout(void) const;
147 
153  virtual bool HasSpeedMeasurement(void) const = 0;
154 
160  virtual bool HasCurrentMeasurement(void) const = 0;
161 
162 protected:
163  core::Matrix *output;
164 
165 private:
173  void UpdateFrom(const core::io_data *data);
174 
182  virtual void SetMotors(float *values) = 0;
183 
184  class Bldc_impl *pimpl_;
185 };
186 } // end namespace actuator
187 } // end namespace flair
188 #endif // BLDC_H
Abstract class for data types.
Definition: io_data.h:94
void UnlockUserInterface(void) const
Unlock user interface.
Base class for all Framework's classes.
Definition: Object.h:83
Abstract class for input/ouput system.
Definition: IODevice.h:45
namespace of the flair Framework
Definition: Ahrs.h:19
void SetPower(int motor_id, float value)
Set motor power.
virtual bool HasCurrentMeasurement(void) const =0
Has current measurement.
Abstract class for input/ouput system.
uint8_t MotorsCount(void) const
Motors count.
core::Matrix * Output(void) const
Output from motors.
Bldc(const core::IODevice *parent, gui::Layout *layout, std::string name, uint8_t motors_count)
Constructor.
void LockUserInterface(void) const
Lock user interface.
Abstract class to display a layout on the ground station.
Definition: Layout.h:33
void SetEnabled(bool status)
Enable motors.
Class displaying a QTabWidget on the ground station.
Definition: TabWidget.h:29
virtual bool HasSpeedMeasurement(void) const =0
Has speed measurement.
~Bldc()
Destructor.
void UseDefaultPlot(gui::TabWidget *tabwidget)
Use default plot.
bool AreEnabled(void) const
Are motors enabled?
gui::Layout * GetLayout(void) const
Layout.
Base class for brushless motors drivers.
Definition: Bldc.h:37
Class defining a matrix.
Definition: Matrix.h:31