Rev | Line | |
---|
[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 Srf08.h
|
---|
| 7 | * \brief Class for ultra sonic SRF08
|
---|
| 8 | * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
|
---|
| 9 | * \date 2011/05/01
|
---|
| 10 | * \version 4.0
|
---|
| 11 | */
|
---|
| 12 |
|
---|
| 13 | #ifndef SRF08_H
|
---|
| 14 | #define SRF08_H
|
---|
| 15 |
|
---|
| 16 | #include <Thread.h>
|
---|
| 17 | #include <UsRangeFinder.h>
|
---|
| 18 |
|
---|
[13] | 19 | namespace flair {
|
---|
| 20 | namespace core {
|
---|
| 21 | class I2cPort;
|
---|
[4] | 22 | }
|
---|
[13] | 23 | namespace gui {
|
---|
| 24 | class SpinBox;
|
---|
| 25 | }
|
---|
| 26 | }
|
---|
[4] | 27 |
|
---|
[13] | 28 | namespace flair {
|
---|
| 29 | namespace sensor {
|
---|
| 30 | /*! \class Srf08
|
---|
| 31 | *
|
---|
| 32 | * \brief Class for ultra sonic SRF08
|
---|
| 33 | */
|
---|
| 34 | class Srf08 : public core::Thread, public UsRangeFinder {
|
---|
[4] | 35 |
|
---|
[13] | 36 | public:
|
---|
| 37 | /*!
|
---|
| 38 | * \brief Constructor
|
---|
| 39 | *
|
---|
[32] | 40 | * Construct a SRF08 sensor
|
---|
[50] | 41 | * It will be child of the FrameworkManager.
|
---|
[13] | 42 | *
|
---|
| 43 | * \param name name
|
---|
| 44 | * \param i2cport i2c port
|
---|
| 45 | * \param address i2c slave address
|
---|
| 46 | * \param priority priority of the Thread
|
---|
| 47 | */
|
---|
[50] | 48 | Srf08(std::string name,
|
---|
[13] | 49 | core::I2cPort *i2cport, uint16_t address, uint8_t priority);
|
---|
[4] | 50 |
|
---|
[13] | 51 | /*!
|
---|
| 52 | * \brief Destructor
|
---|
| 53 | *
|
---|
| 54 | */
|
---|
| 55 | ~Srf08();
|
---|
[4] | 56 |
|
---|
[13] | 57 | /*!
|
---|
| 58 | * \brief Set Range
|
---|
| 59 | *
|
---|
| 60 | * check datasheet for values
|
---|
| 61 | */
|
---|
| 62 | void SetRange(void);
|
---|
[4] | 63 |
|
---|
[13] | 64 | /*!
|
---|
| 65 | * \brief Set Max Gain
|
---|
| 66 | *
|
---|
| 67 | * check datasheet for values
|
---|
| 68 | */
|
---|
| 69 | void SetMaxGain(void);
|
---|
[4] | 70 |
|
---|
[13] | 71 | private:
|
---|
| 72 | /*!
|
---|
| 73 | * \brief Update using provided datas
|
---|
| 74 | *
|
---|
| 75 | * Reimplemented from IODevice.
|
---|
| 76 | *
|
---|
| 77 | * \param data data from the parent to process
|
---|
| 78 | */
|
---|
| 79 | void UpdateFrom(const core::io_data *data){};
|
---|
[4] | 80 |
|
---|
[13] | 81 | /*!
|
---|
| 82 | * \brief Run function
|
---|
| 83 | *
|
---|
| 84 | * Reimplemented from Thread.
|
---|
| 85 | *
|
---|
| 86 | */
|
---|
| 87 | void Run(void);
|
---|
[4] | 88 |
|
---|
[13] | 89 | void SendEcho(void);
|
---|
| 90 | void GetEcho(void);
|
---|
[4] | 91 |
|
---|
[13] | 92 | bool is_init;
|
---|
| 93 | core::Time echo_time;
|
---|
| 94 | float z_1, z_2;
|
---|
| 95 | gui::SpinBox *gain, *range;
|
---|
| 96 | uint16_t address;
|
---|
| 97 | core::I2cPort *i2cport;
|
---|
| 98 | };
|
---|
[4] | 99 | } // end namespace sensor
|
---|
| 100 | } // end namespace flair
|
---|
| 101 | #endif // SRF08_H
|
---|
Note:
See
TracBrowser
for help on using the repository browser.