[340] | 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 Servos.h
|
---|
| 7 | * \brief Base class for servos
|
---|
| 8 | * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
|
---|
| 9 | * \date 2019/11/28
|
---|
| 10 | * \version 4.0
|
---|
| 11 | */
|
---|
| 12 |
|
---|
| 13 | #ifndef SERVOS_H
|
---|
| 14 | #define SERVOS_H
|
---|
| 15 |
|
---|
| 16 | #include <IODevice.h>
|
---|
| 17 | #include <stdint.h>
|
---|
| 18 |
|
---|
| 19 | namespace flair {
|
---|
| 20 | namespace gui {
|
---|
| 21 | class Layout;
|
---|
| 22 | class TabWidget;
|
---|
| 23 | }
|
---|
| 24 | }
|
---|
| 25 |
|
---|
| 26 | class Servos_impl;
|
---|
| 27 |
|
---|
| 28 | namespace flair {
|
---|
| 29 | namespace actuator {
|
---|
| 30 | /*! \class Servos
|
---|
| 31 | *
|
---|
| 32 | * \brief Base class for brushless motors drivers
|
---|
| 33 | */
|
---|
| 34 | class Servos : public core::IODevice {
|
---|
| 35 | friend class ::Servos_impl;
|
---|
| 36 |
|
---|
| 37 | public:
|
---|
| 38 | /*!
|
---|
| 39 | * \brief Constructor
|
---|
| 40 | *
|
---|
| 41 | * Construct a Servos.
|
---|
| 42 | *
|
---|
| 43 | * \param parent parent
|
---|
| 44 | * \param layout layout
|
---|
| 45 | * \param name name
|
---|
| 46 | * \param servos_count number of servos
|
---|
| 47 | */
|
---|
| 48 | Servos(const core::IODevice *parent, gui::Layout *layout, std::string name,
|
---|
| 49 | uint8_t servos_count);
|
---|
| 50 |
|
---|
| 51 | /*!
|
---|
| 52 | * \brief Destructor
|
---|
| 53 | *
|
---|
| 54 | */
|
---|
| 55 | ~Servos();
|
---|
| 56 |
|
---|
| 57 | /*!
|
---|
| 58 | * \brief Lock user interface
|
---|
| 59 | *
|
---|
| 60 | */
|
---|
| 61 | void LockUserInterface(void) const;
|
---|
| 62 |
|
---|
| 63 | /*!
|
---|
| 64 | * \brief Unlock user interface
|
---|
| 65 | *
|
---|
| 66 | */
|
---|
| 67 | void UnlockUserInterface(void) const;
|
---|
| 68 |
|
---|
| 69 | /*!
|
---|
| 70 | * \brief Use default plot
|
---|
| 71 | *
|
---|
| 72 | * \param tabwidget TabWidget to draw plots
|
---|
| 73 | */
|
---|
| 74 | void UseDefaultPlot(gui::TabWidget *tabwidget);
|
---|
| 75 |
|
---|
| 76 |
|
---|
| 77 | /*!
|
---|
| 78 | * \brief Servos count
|
---|
| 79 | *
|
---|
| 80 | * \return number of servos
|
---|
| 81 | */
|
---|
| 82 | uint8_t ServosCount(void) const;
|
---|
| 83 |
|
---|
| 84 | /*!
|
---|
| 85 | * \brief Enable servos
|
---|
| 86 | *
|
---|
| 87 | * \param true to enable all servos
|
---|
| 88 | */
|
---|
| 89 | void SetEnabled(bool status);
|
---|
| 90 |
|
---|
| 91 | /*!
|
---|
| 92 | * \brief Are servos enabled?
|
---|
| 93 | *
|
---|
| 94 | * \return true if servos are enabled
|
---|
| 95 | */
|
---|
| 96 | bool AreEnabled(void) const;
|
---|
| 97 |
|
---|
| 98 | /*!
|
---|
| 99 | * \brief Layout
|
---|
| 100 | *
|
---|
| 101 | * This the same Layout as passed to the constructor
|
---|
| 102 | *
|
---|
| 103 | * \return a Layout
|
---|
| 104 | */
|
---|
| 105 | gui::Layout *GetLayout(void) const;
|
---|
| 106 |
|
---|
| 107 |
|
---|
| 108 | protected:
|
---|
| 109 |
|
---|
| 110 |
|
---|
| 111 | private:
|
---|
| 112 | /*!
|
---|
| 113 | * \brief Update using provided datas
|
---|
| 114 | *
|
---|
| 115 | * Reimplemented from IODevice.
|
---|
| 116 | *
|
---|
| 117 | * \param data data from the parent to process
|
---|
| 118 | */
|
---|
| 119 | void UpdateFrom(const core::io_data *data);
|
---|
| 120 |
|
---|
| 121 | /*!
|
---|
| 122 | * \brief Set servos position
|
---|
| 123 | *
|
---|
| 124 | * values size must be the same as ServosCount()
|
---|
| 125 | *
|
---|
| 126 | * \param position set servos position
|
---|
| 127 | */
|
---|
| 128 | virtual void SetServos(float *position) = 0;
|
---|
| 129 |
|
---|
| 130 | class Servos_impl *pimpl_;
|
---|
| 131 | };
|
---|
| 132 | } // end namespace actuator
|
---|
| 133 | } // end namespace flair
|
---|
| 134 | #endif // SERVOS_H
|
---|