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

Last change on this file since 13 was 13, checked in by Bayard Gildas, 8 years ago

formatting script + include reformatted

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