source: flair-dev/trunk/include/FlairSensorActuator/Bldc.h @ 68

Last change on this file since 68 was 68, checked in by Sanahuja Guillaume, 3 years ago

maj for armv5te

File size: 3.6 KB
Line 
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}
5/*!
6 * \file Bldc.h
7 * \brief Base class for brushless motors drivers
8 * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
9 * \date 2013/11/14
10 * \version 4.0
11 */
12
13#ifndef BLDC_H
14#define BLDC_H
15
16#include <IODevice.h>
17#include <stdint.h>
18
19namespace flair {
20namespace core {
21class Matrix;
22}
23namespace gui {
24class Layout;
25class TabWidget;
26}
27}
28
29class Bldc_impl;
30
31namespace flair {
32namespace actuator {
33/*! \class Bldc
34*
35* \brief Base class for brushless motors drivers
36*/
37class Bldc : public core::IODevice {
38  friend class ::Bldc_impl;
39
40public:
41  /*!
42  * \brief Constructor
43  *
44  * Construct a Bldc.
45  *
46  * \param parent parent
47  * \param layout layout
48  * \param name name
49  * \param motors_count number of motors
50  */
51  Bldc(const core::IODevice *parent, gui::Layout *layout, std::string name,
52       uint8_t motors_count);
53
54  /*!
55  * \brief Constructor
56  *
57  * Construct a Bldc. \n
58  * This contructor must only be called for a simulated device.
59  *
60  * \param parent parent
61  * \param name name
62  * \param motors_count number of motors
63  */
64  Bldc(const core::Object *parent, std::string name, uint8_t motors_count);
65
66  /*!
67  * \brief Destructor
68  *
69  */
70  ~Bldc();
71
72  /*!
73  * \brief Lock user interface
74  *
75  */
76  void LockUserInterface(void) const;
77
78  /*!
79  * \brief Unlock user interface
80  *
81  */
82  void UnlockUserInterface(void) const;
83
84  /*!
85  * \brief Use default plot
86  *
87  * \param tabwidget TabWidget to draw plots
88  */
89  void UseDefaultPlot(gui::TabWidget *tabwidget);
90
91  /*!
92  * \brief Output from motors
93  *
94  * First column is real speed if available, secund column is current if
95  *available
96  *
97  */
98  core::Matrix *Output(void) const;
99
100  /*!
101  * \brief Motors count
102  *
103  * \return number of motors
104  */
105  uint8_t MotorsCount(void) const;
106
107  /*!
108  * \brief Enable motors
109  *
110  * \param true to enable all motors
111  */
112  void SetEnabled(bool status);
113
114  /*!
115  * \brief Are motors enabled?
116  *
117  * \return true if motors are enabled
118  */
119  bool AreEnabled(void) const;
120
121  /*!
122  * \brief Set motor power
123  *
124  * Changes the power (from 0 to 1) of a specific motor. \n
125  * By default power is set to 1 for each motor which has no effect. \n
126  * A value <1 will decrease the power of a motor sent to the reimplemented Bldc
127  *class through SetMotors. \n
128  * The power value is applied after applying saturation between min value and
129  *max value.
130  * So the resulting value cannot be higher than max value
131  * but it can be lower than min value.
132  *
133  * \param motor_id id of the motor
134  * \param value power value (from 0 to 1)
135  *
136  */
137  void SetPower(int motor_id, float value);
138
139  /*!
140  * \brief Layout
141  *
142  * This the same Layout as passed to the constructor
143  *
144  * \return a Layout
145  */
146  gui::Layout *GetLayout(void) const;
147
148  /*!
149  * \brief Has speed measurement
150  *
151  * \return true if it has speed measurement
152  */
153  virtual bool HasSpeedMeasurement(void) const = 0;
154
155  /*!
156  * \brief Has current measurement
157  *
158  * \return true if it has current measurement
159  */
160  virtual bool HasCurrentMeasurement(void) const = 0;
161
162protected:
163  core::Matrix *output;
164
165private:
166  /*!
167  * \brief Update using provided datas
168  *
169  * Reimplemented from IODevice.
170  *
171  * \param data data from the parent to process
172  */
173  void UpdateFrom(const core::io_data *data);
174
175  /*!
176  * \brief Set motors values
177  *
178  * values size must be the same as MotorsCount()
179  *
180  * \param values set motors values
181  */
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
Note: See TracBrowser for help on using the repository browser.