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

Last change on this file since 434 was 376, checked in by Sanahuja Guillaume, 4 years ago

up ugv

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