source: flair-src/trunk/lib/FlairSensorActuator/src/Bldc.h@ 52

Last change on this file since 52 was 15, checked in by Bayard Gildas, 9 years ago

sources reformatted with flair-format-dir script

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