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

Last change on this file since 76 was 68, checked in by Sanahuja Guillaume, 3 years ago

maj for armv5te

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