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 FrameworkManager;
22 class cvmatrix;
23 }
24 namespace gui {
25 class Layout;
26 class TabWidget;
27 }
28 }
29 
30 class Bldc_impl;
31 
32 namespace flair {
33 namespace actuator {
38 class Bldc : public core::IODevice {
39  friend class ::Bldc_impl;
40 
41 public:
52  Bldc(const core::IODevice *parent, gui::Layout *layout, std::string name,
53  uint8_t motors_count);
54 
65  Bldc(const core::Object *parent, std::string name, uint8_t motors_count);
66 
71  ~Bldc();
72 
77  void LockUserInterface(void) const;
78 
83  void UnlockUserInterface(void) const;
84 
90  void UseDefaultPlot(gui::TabWidget *tabwidget);
91 
99  core::cvmatrix *Output(void) const;
100 
106  uint8_t MotorsCount(void) const;
107 
113  void SetEnabled(bool status);
114 
120  bool AreEnabled(void) const;
121 
138  void SetPower(int motor_id, float value);
139 
147  gui::Layout *GetLayout(void) const;
148 
154  virtual bool HasSpeedMeasurement(void) const = 0;
155 
161  virtual bool HasCurrentMeasurement(void) const = 0;
162 
163 protected:
164  core::cvmatrix *output;
165 
166 private:
174  void UpdateFrom(const core::io_data *data);
175 
183  virtual void SetMotors(float *values) = 0;
184 
185  class Bldc_impl *pimpl_;
186 };
187 } // end namespace actuator
188 } // end namespace framewor
189 #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:77
Abstract class for input/ouput system.
Definition: IODevice.h:44
namespace of the flair Framework
Definition: Ahrs.h:19
Class defining a matrix of kind CvMat.
Definition: cvmatrix.h:33
void SetPower(int motor_id, float value)
Set motor power.
core::cvmatrix * Output(void) const
Output from motors.
virtual bool HasCurrentMeasurement(void) const =0
Has current measurement.
Abstract class for input/ouput system.
uint8_t MotorsCount(void) const
Motors count.
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:38