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

Last change on this file since 251 was 214, checked in by Sanahuja Guillaume, 6 years ago

matrix

File size: 3.6 KB
RevLine 
[3]1// %flair:license{
[15]2// This file is part of the Flair framework distributed under the
3// CECILL-C License, Version 1.0.
[3]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
[15]19namespace flair {
20namespace core {
[214]21class Matrix;
[3]22}
[15]23namespace gui {
24class Layout;
25class TabWidget;
26}
27}
[3]28
29class Bldc_impl;
30
[15]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;
[3]39
[15]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);
[3]53
[15]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);
[3]65
[15]66 /*!
67 * \brief Destructor
68 *
69 */
70 ~Bldc();
[3]71
[15]72 /*!
73 * \brief Lock user interface
74 *
75 */
76 void LockUserInterface(void) const;
[3]77
[15]78 /*!
79 * \brief Unlock user interface
80 *
81 */
82 void UnlockUserInterface(void) const;
[3]83
[15]84 /*!
85 * \brief Use default plot
86 *
87 * \param tabwidget TabWidget to draw plots
88 */
89 void UseDefaultPlot(gui::TabWidget *tabwidget);
[3]90
[15]91 /*!
92 * \brief Output from motors
93 *
94 * First column is real speed if available, secund column is current if
95 *available
96 *
97 */
[214]98 core::Matrix *Output(void) const;
[3]99
[15]100 /*!
101 * \brief Motors count
102 *
103 * \return number of motors
104 */
105 uint8_t MotorsCount(void) const;
[3]106
[15]107 /*!
108 * \brief Enable motors
109 *
110 * \param true to enable all motors
111 */
112 void SetEnabled(bool status);
[3]113
[15]114 /*!
115 * \brief Are motors enabled?
116 *
117 * \return true if motors are enabled
118 */
119 bool AreEnabled(void) const;
[3]120
[15]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);
[3]138
[15]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;
[3]147
[15]148 /*!
149 * \brief Has speed measurement
150 *
151 * \return true if it has speed measurement
152 */
153 virtual bool HasSpeedMeasurement(void) const = 0;
[3]154
[15]155 /*!
156 * \brief Has current measurement
157 *
158 * \return true if it has current measurement
159 */
160 virtual bool HasCurrentMeasurement(void) const = 0;
[3]161
[15]162protected:
[214]163 core::Matrix *output;
[3]164
[15]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);
[3]174
[15]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;
[3]183
[15]184 class Bldc_impl *pimpl_;
185};
[3]186} // end namespace actuator
[170]187} // end namespace flair
[3]188#endif // BLDC_H
Note: See TracBrowser for help on using the repository browser.