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

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

add servos

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