Changeset 13 in flair-dev for trunk/include/FlairSensorActuator
- Timestamp:
- Apr 8, 2016, 3:39:24 PM (9 years ago)
- Location:
- trunk/include/FlairSensorActuator
- Files:
-
- 31 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/FlairSensorActuator/AfroBldc.h
r4 r13 16 16 #include "Bldc.h" 17 17 18 namespace flair 19 { 20 namespace core 21 { 22 class FrameworkManager; 23 class I2cPort; 24 } 25 namespace sensor 26 { 27 class BatteryMonitor; 28 } 18 namespace flair { 19 namespace core { 20 class FrameworkManager; 21 class I2cPort; 22 } 23 namespace sensor { 24 class BatteryMonitor; 25 } 29 26 } 30 27 31 28 class AfroBldc_impl; 32 29 33 namespace flair 34 { 35 namespace actuator 36 { 37 /*! \class AfroBldc 38 * 39 * \brief Class for Mikrokopter's blctrlv2 40 * 41 * blctrlv2 drivers can also monitor the battery level. See GetBatteryMonitor(). 42 */ 43 class AfroBldc : public Bldc 44 { 45 friend class ::AfroBldc_impl; 30 namespace flair { 31 namespace actuator { 32 /*! \class AfroBldc 33 * 34 * \brief Class for Mikrokopter's blctrlv2 35 * 36 * blctrlv2 drivers can also monitor the battery level. See GetBatteryMonitor(). 37 */ 38 class AfroBldc : public Bldc { 39 friend class ::AfroBldc_impl; 46 40 47 public: 48 /*! 49 * \brief Constructor 50 * 51 * Construct a AfroBldc. 52 * 53 * \param parent parent 54 * \param layout layout 55 * \param name name 56 * \param motors_count number of motors 57 * \param i2cport I2cPort 58 */ 59 AfroBldc(const core::IODevice* parent,gui::Layout* layout,std::string name,uint8_t motors_count,core::I2cPort* i2cport); 41 public: 42 /*! 43 * \brief Constructor 44 * 45 * Construct a AfroBldc. 46 * 47 * \param parent parent 48 * \param layout layout 49 * \param name name 50 * \param motors_count number of motors 51 * \param i2cport I2cPort 52 */ 53 AfroBldc(const core::IODevice *parent, gui::Layout *layout, std::string name, 54 uint8_t motors_count, core::I2cPort *i2cport); 60 55 61 62 63 64 65 56 /*! 57 * \brief Destructor 58 * 59 */ 60 ~AfroBldc(); 66 61 67 68 69 70 71 72 73 74 bool HasSpeedMeasurement(void) const{return false;};62 /*! 63 * \brief Has speed measurement 64 * 65 * Reimplemented from Bldc. \n 66 * 67 * \return true if it has speed measurement 68 */ 69 bool HasSpeedMeasurement(void) const { return false; }; 75 70 76 77 78 79 80 81 82 83 bool HasCurrentMeasurement(void) const{return false;};71 /*! 72 * \brief Has current measurement 73 * 74 * Reimplemented from Bldc. \n 75 * 76 * \return true if it has current measurement 77 */ 78 bool HasCurrentMeasurement(void) const { return false; }; 84 79 85 86 87 88 89 90 91 92 93 94 void SetMotors(float*values);80 private: 81 /*! 82 * \brief Set motors values 83 * 84 * Reimplemented from Bldc. \n 85 * Values size must be the same as MotorsCount() 86 * 87 * \param values motor values 88 */ 89 void SetMotors(float *values); 95 90 96 class AfroBldc_impl*pimpl_;97 91 class AfroBldc_impl *pimpl_; 92 }; 98 93 } // end namespace actuator 99 94 } // end namespace flair -
trunk/include/FlairSensorActuator/BatteryMonitor.h
r4 r13 16 16 #include <GroupBox.h> 17 17 18 namespace flair 19 { 20 namespace gui 21 { 22 class LayoutPosition; 23 class Label; 24 class DoubleSpinBox; 25 } 18 namespace flair { 19 namespace gui { 20 class LayoutPosition; 21 class Label; 22 class DoubleSpinBox; 23 } 26 24 } 27 25 28 namespace flair 29 { 30 namespace sensor 31 { 26 namespace flair { 27 namespace sensor { 32 28 33 34 35 36 29 /*! \class BatteryMonitor 30 * 31 * \brief Base class for battery monitor 32 */ 37 33 38 class BatteryMonitor : public gui::GroupBox 39 { 40 public: 41 /*! 42 * \brief Constructor 43 * 44 * Construct a BatteryMonitor at given position. 45 * 46 * \param position position 47 * \param name name 48 */ 49 BatteryMonitor(const gui::LayoutPosition* position,std::string name); 34 class BatteryMonitor : public gui::GroupBox { 35 public: 36 /*! 37 * \brief Constructor 38 * 39 * Construct a BatteryMonitor at given position. 40 * 41 * \param position position 42 * \param name name 43 */ 44 BatteryMonitor(const gui::LayoutPosition *position, std::string name); 50 45 51 52 53 54 55 46 /*! 47 * \brief Destructor 48 * 49 */ 50 ~BatteryMonitor(); 56 51 57 58 59 60 61 62 63 52 /*! 53 * \brief Is batteru low? 54 * 55 * \return true if battery is below threshold 56 * 57 */ 58 bool IsBatteryLow(void) const; 64 59 65 66 67 68 69 70 71 60 /*! 61 * \brief Set battery value 62 * 63 * \param battery value 64 * 65 */ 66 void SetBatteryValue(float value); 72 67 73 74 75 76 77 78 79 68 /*! 69 * \brief Get battery voltage 70 * 71 * \return battery voltage 72 * 73 */ 74 float GetVoltage(void) const; 80 75 81 82 83 84 85 76 private: 77 float batteryvalue; 78 gui::DoubleSpinBox *battery_thresh; 79 gui::Label *battery; 80 }; 86 81 } // end namespace sensor 87 82 } // end namespace flair -
trunk/include/FlairSensorActuator/BlCtrlV2.h
r4 r13 16 16 #include "Bldc.h" 17 17 18 namespace flair 19 { 20 namespace core 21 { 22 class FrameworkManager; 23 class I2cPort; 24 } 25 namespace sensor 26 { 27 class BatteryMonitor; 28 } 18 namespace flair { 19 namespace core { 20 class FrameworkManager; 21 class I2cPort; 22 } 23 namespace sensor { 24 class BatteryMonitor; 25 } 29 26 } 30 27 31 28 class BlCtrlV2_impl; 32 29 33 namespace flair 34 { 35 namespace actuator 36 { 37 /*! \class BlCtrlV2 38 * 39 * \brief Class for Mikrokopter's blctrlv2 40 * 41 * blctrlv2 drivers can also monitor the battery level. See GetBatteryMonitor(). 42 */ 43 class BlCtrlV2 : public Bldc 44 { 45 friend class ::BlCtrlV2_impl; 30 namespace flair { 31 namespace actuator { 32 /*! \class BlCtrlV2 33 * 34 * \brief Class for Mikrokopter's blctrlv2 35 * 36 * blctrlv2 drivers can also monitor the battery level. See GetBatteryMonitor(). 37 */ 38 class BlCtrlV2 : public Bldc { 39 friend class ::BlCtrlV2_impl; 46 40 47 public: 48 /*! 49 * \brief Constructor 50 * 51 * Construct a BlCtrlV2. 52 * 53 * \param parent parent 54 * \param layout layout 55 * \param name name 56 * \param motors_count number of motors 57 * \param i2cport I2cPort 58 */ 59 BlCtrlV2(const core::IODevice* parent,gui::Layout* layout,std::string name,uint8_t motors_count,core::I2cPort* i2cport); 41 public: 42 /*! 43 * \brief Constructor 44 * 45 * Construct a BlCtrlV2. 46 * 47 * \param parent parent 48 * \param layout layout 49 * \param name name 50 * \param motors_count number of motors 51 * \param i2cport I2cPort 52 */ 53 BlCtrlV2(const core::IODevice *parent, gui::Layout *layout, std::string name, 54 uint8_t motors_count, core::I2cPort *i2cport); 60 55 61 62 63 64 65 56 /*! 57 * \brief Destructor 58 * 59 */ 60 ~BlCtrlV2(); 66 61 67 68 69 70 71 72 sensor::BatteryMonitor*GetBatteryMonitor(void) const;62 /*! 63 * \brief Get battery monitor 64 * 65 * \return BatteryMonitor 66 */ 67 sensor::BatteryMonitor *GetBatteryMonitor(void) const; 73 68 74 75 76 77 78 79 80 81 bool HasSpeedMeasurement(void) const{return true;};69 /*! 70 * \brief Has speed measurement 71 * 72 * Reimplemented from Bldc. \n 73 * 74 * \return true if it has speed measurement 75 */ 76 bool HasSpeedMeasurement(void) const { return true; }; 82 77 83 84 85 86 87 88 89 90 bool HasCurrentMeasurement(void) const{return true;};78 /*! 79 * \brief Has current measurement 80 * 81 * Reimplemented from Bldc. \n 82 * 83 * \return true if it has current measurement 84 */ 85 bool HasCurrentMeasurement(void) const { return true; }; 91 86 92 93 94 95 96 97 98 99 100 101 void SetMotors(float*values);87 private: 88 /*! 89 * \brief Set motors values 90 * 91 * Reimplemented from Bldc. \n 92 * Values size must be the same as MotorsCount() 93 * 94 * \param values motor values 95 */ 96 void SetMotors(float *values); 102 97 103 class BlCtrlV2_impl*pimpl_;104 98 class BlCtrlV2_impl *pimpl_; 99 }; 105 100 } // end namespace actuator 106 101 } // end namespace flair -
trunk/include/FlairSensorActuator/BlCtrlV2_x4_speed.h
r4 r13 16 16 /*********************************************************************/ 17 17 18 19 18 #ifndef BLCTRLV2_X4_SPEED_H 20 19 #define BLCTRLV2_X4_SPEED_H … … 23 22 #include <Thread.h> 24 23 25 namespace flair 26 { 27 namespace core 28 { 29 class cvmatrix; 30 class FrameworkManager; 31 class I2cPort; 32 33 } 34 namespace gui 35 { 36 class TabWidget; 37 class Tab; 38 class SpinBox; 39 class DoubleSpinBox; 40 class ComboBox; 41 class PushButton; 42 class GroupBox; 43 } 24 namespace flair { 25 namespace core { 26 class cvmatrix; 27 class FrameworkManager; 28 class I2cPort; 29 } 30 namespace gui { 31 class TabWidget; 32 class Tab; 33 class SpinBox; 34 class DoubleSpinBox; 35 class ComboBox; 36 class PushButton; 37 class GroupBox; 38 } 44 39 } 45 40 46 namespace flair 47 { 48 namespace actuator 49 { 50 class BlCtrlV2_x4_speed : public core::Thread,public core::IODevice 51 { 41 namespace flair { 42 namespace actuator { 43 class BlCtrlV2_x4_speed : public core::Thread, public core::IODevice { 52 44 53 public: 54 BlCtrlV2_x4_speed(core::FrameworkManager* parent,std::string name,core::I2cPort* i2cport,uint8_t base_address,uint8_t priority); 55 ~BlCtrlV2_x4_speed(); 56 void UseDefaultPlot(void); 57 void LockUserInterface(void); 58 void UnlockUserInterface(void); 59 void SetEnabled(bool status); 60 void SetUroll(float value); 61 void SetUpitch(float value); 62 void SetUyaw(float value); 63 void SetUgaz(float value); 64 void SetRollTrim(float value); 65 void SetPitchTrim(float value); 66 void SetYawTrim(float value); 67 void SetGazTrim(float value); 68 float TrimValue(void); 69 int StartValue(void); 45 public: 46 BlCtrlV2_x4_speed(core::FrameworkManager *parent, std::string name, 47 core::I2cPort *i2cport, uint8_t base_address, 48 uint8_t priority); 49 ~BlCtrlV2_x4_speed(); 50 void UseDefaultPlot(void); 51 void LockUserInterface(void); 52 void UnlockUserInterface(void); 53 void SetEnabled(bool status); 54 void SetUroll(float value); 55 void SetUpitch(float value); 56 void SetUyaw(float value); 57 void SetUgaz(float value); 58 void SetRollTrim(float value); 59 void SetPitchTrim(float value); 60 void SetYawTrim(float value); 61 void SetGazTrim(float value); 62 float TrimValue(void); 63 int StartValue(void); 70 64 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 gui::Tab*main_tab;93 gui::TabWidget*tab;94 gui::GroupBox*reglages_groupbox;95 gui::SpinBox *min,*max,*test;96 gui::PushButton *button_avg,*button_avd,*button_arg,*button_ard;97 gui::ComboBox *av_g,*av_d,*ar_g,*ar_d,*pas;98 gui::DoubleSpinBox *trim,*kp,*ki;99 gui::SpinBox *start_value,*poles;100 core::Time start_time,flight_start_time;101 102 float speed_av_g,speed_av_d,speed_ar_g,speed_ar_d;103 float int_av_g,int_av_d,int_ar_g,int_ar_d;65 private: 66 /*! 67 * \brief Update using provided datas 68 * 69 * Reimplemented from IODevice. 70 * 71 * \param data data from the parent to process 72 */ 73 void UpdateFrom(core::io_data *data){}; 74 void WriteValue(uint16_t value); 75 float GetSpeed(void); 76 void StartTest(void); 77 void StopTest(void); 78 /*! 79 * \brief Run function 80 * 81 * Reimplemented from Thread. 82 * 83 */ 84 void Run(void); 85 void Update(void); 86 gui::Tab *main_tab; 87 gui::TabWidget *tab; 88 gui::GroupBox *reglages_groupbox; 89 gui::SpinBox *min, *max, *test; 90 gui::PushButton *button_avg, *button_avd, *button_arg, *button_ard; 91 gui::ComboBox *av_g, *av_d, *ar_g, *ar_d, *pas; 92 gui::DoubleSpinBox *trim, *kp, *ki; 93 gui::SpinBox *start_value, *poles; 94 core::Time start_time, flight_start_time; 95 int time_sec; 96 float speed_av_g, speed_av_d, speed_ar_g, speed_ar_d; 97 float int_av_g, int_av_d, int_ar_g, int_ar_d; 104 98 105 //matrix106 107 99 // matrix 100 core::cvmatrix *input; 101 core::cvmatrix *output; 108 102 109 110 core::I2cPort*i2cport;111 103 int tested_motor; 104 core::I2cPort *i2cport; 105 uint8_t slave_address; 112 106 113 107 bool enabled; 114 108 115 uint16_t SatPWM(float vel_cons,uint16_t min,uint16_t max);116 109 uint16_t SatPWM(float vel_cons, uint16_t min, uint16_t max); 110 }; 117 111 } // end namespace actuator 118 112 } // end namespace flair -
trunk/include/FlairSensorActuator/Bldc.h
r4 r13 17 17 #include <stdint.h> 18 18 19 namespace flair 20 { 21 namespace core 22 { 23 class FrameworkManager; 24 class cvmatrix; 25 } 26 namespace gui 27 { 28 class Layout; 29 class TabWidget; 30 } 19 namespace flair { 20 namespace core { 21 class FrameworkManager; 22 class cvmatrix; 23 } 24 namespace gui { 25 class Layout; 26 class TabWidget; 27 } 31 28 } 32 29 33 30 class Bldc_impl; 34 31 35 namespace flair 36 { 37 namespace actuator 38 { 39 /*! \class Bldc 40 * 41 * \brief Base class for brushless motors drivers 42 */ 43 class Bldc : public core::IODevice 44 { 45 friend class ::Bldc_impl; 32 namespace flair { 33 namespace actuator { 34 /*! \class Bldc 35 * 36 * \brief Base class for brushless motors drivers 37 */ 38 class Bldc : public core::IODevice { 39 friend class ::Bldc_impl; 46 40 47 public: 48 /*! 49 * \brief Constructor 50 * 51 * Construct a Bldc. 52 * 53 * \param parent parent 54 * \param layout layout 55 * \param name name 56 * \param motors_count number of motors 57 */ 58 Bldc(const core::IODevice* parent,gui::Layout* layout,std::string name,uint8_t motors_count); 41 public: 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); 59 54 60 61 62 63 64 65 66 67 68 69 70 Bldc(const core::Object* parent,std::string name,uint8_t motors_count);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); 71 66 72 73 74 75 76 67 /*! 68 * \brief Destructor 69 * 70 */ 71 ~Bldc(); 77 72 78 79 80 81 82 73 /*! 74 * \brief Lock user interface 75 * 76 */ 77 void LockUserInterface(void) const; 83 78 84 85 86 87 88 79 /*! 80 * \brief Unlock user interface 81 * 82 */ 83 void UnlockUserInterface(void) const; 89 84 90 91 92 93 94 95 void UseDefaultPlot(gui::TabWidget*tabwidget);85 /*! 86 * \brief Use default plot 87 * 88 * \param tabwidget TabWidget to draw plots 89 */ 90 void UseDefaultPlot(gui::TabWidget *tabwidget); 96 91 97 /*! 98 * \brief Output from motors 99 * 100 * First column is real speed if available, secund column is current if available 101 * 102 */ 103 core::cvmatrix *Output(void) const; 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; 104 100 105 106 107 108 109 110 101 /*! 102 * \brief Motors count 103 * 104 * \return number of motors 105 */ 106 uint8_t MotorsCount(void) const; 111 107 112 113 114 115 116 117 108 /*! 109 * \brief Enable motors 110 * 111 * \param true to enable all motors 112 */ 113 void SetEnabled(bool status); 118 114 119 120 121 122 123 124 115 /*! 116 * \brief Are motors enabled? 117 * 118 * \return true if motors are enabled 119 */ 120 bool AreEnabled(void) const; 125 121 126 /*! 127 * \brief Set motor power 128 * 129 * Changes the power (from 0 to 1) of a specific motor. \n 130 * By default power is set to 1 for each motor which has no effect. \n 131 * A value <1 will decrease the power of a motor sent to the reimplemented Bldc class through SetMotors. \n 132 * The power value is applied after applying saturation between min value and max value. 133 * So the resulting value cannot be higher than max value 134 * but it can be lower than min value. 135 * 136 * \param motor_id id of the motor 137 * \param value power value (from 0 to 1) 138 * 139 */ 140 void SetPower(int motor_id,float value); 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); 141 139 142 143 144 145 146 147 148 149 gui::Layout*GetLayout(void) const;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; 150 148 151 152 153 154 155 156 virtual bool HasSpeedMeasurement(void) const=0;149 /*! 150 * \brief Has speed measurement 151 * 152 * \return true if it has speed measurement 153 */ 154 virtual bool HasSpeedMeasurement(void) const = 0; 157 155 158 159 160 161 162 163 virtual bool HasCurrentMeasurement(void) const=0;156 /*! 157 * \brief Has current measurement 158 * 159 * \return true if it has current measurement 160 */ 161 virtual bool HasCurrentMeasurement(void) const = 0; 164 162 165 166 163 protected: 164 core::cvmatrix *output; 167 165 168 169 170 171 172 173 174 175 176 166 private: 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); 177 175 178 179 180 181 182 183 184 185 virtual void SetMotors(float* values)=0;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; 186 184 187 class Bldc_impl*pimpl_;188 185 class Bldc_impl *pimpl_; 186 }; 189 187 } // end namespace actuator 190 188 } // end namespace framewor -
trunk/include/FlairSensorActuator/Camera.h
r4 r13 18 18 #include <cvimage.h> 19 19 20 namespace flair 21 { 22 namespace gui 23 { 24 class GroupBox; 25 class Tab; 26 class TabWidget; 27 class Picture; 28 class GridLayout; 29 } 20 namespace flair { 21 namespace gui { 22 class GroupBox; 23 class Tab; 24 class TabWidget; 25 class Picture; 26 class GridLayout; 27 } 30 28 } 31 29 32 namespace flair 33 { 34 namespace sensor 35 { 36 /*! \class Camera 37 * 38 * \brief Base class for Camera 39 * 40 * Use this class to define a custom Camera. 41 * 42 */ 43 class Camera : public core::IODevice 44 { 45 public: 46 /*! 47 * \brief Constructor 48 * 49 * Construct a Camera. 50 * 51 * \param parent parent 52 * \param name name 53 * \param width width 54 * \param height height 55 * \param format image format 56 */ 57 Camera(const core::FrameworkManager* parent,std::string name,uint16_t width,uint16_t height,core::cvimage::Type::Format format); 30 namespace flair { 31 namespace sensor { 32 /*! \class Camera 33 * 34 * \brief Base class for Camera 35 * 36 * Use this class to define a custom Camera. 37 * 38 */ 39 class Camera : public core::IODevice { 40 public: 41 /*! 42 * \brief Constructor 43 * 44 * Construct a Camera. 45 * 46 * \param parent parent 47 * \param name name 48 * \param width width 49 * \param height height 50 * \param format image format 51 */ 52 Camera(const core::FrameworkManager *parent, std::string name, uint16_t width, 53 uint16_t height, core::cvimage::Type::Format format); 58 54 59 60 61 62 63 64 65 66 67 68 Camera(const core::IODevice* parent,std::string name);55 /*! 56 * \brief Constructor 57 * 58 * Construct a Camera. \n 59 * This contructor must only be called for a simulated device. 60 * 61 * \param parent parent 62 * \param name name 63 */ 64 Camera(const core::IODevice *parent, std::string name); 69 65 70 71 72 73 74 66 /*! 67 * \brief Destructor 68 * 69 */ 70 ~Camera(); 75 71 76 77 78 79 80 81 72 /*! 73 * \brief Use default plot 74 * 75 * \param image image to display 76 */ 77 void UseDefaultPlot(const core::cvimage *image); 82 78 83 84 85 86 87 88 gui::GridLayout*GetLayout(void) const;79 /*! 80 * \brief get Layout 81 * 82 * \return a Layout available 83 */ 84 gui::GridLayout *GetLayout(void) const; 89 85 90 91 92 93 94 95 gui::Tab*GetPlotTab(void) const;86 /*! 87 * \brief plot tab 88 * 89 * \return plot tab 90 */ 91 gui::Tab *GetPlotTab(void) const; 96 92 97 98 99 100 101 102 93 /*! 94 * \brief Save picture to file 95 * 96 * \param filename filename 97 */ 98 void SaveToFile(std::string filename) const; 103 99 104 105 106 107 108 109 100 /*! 101 * \brief Width 102 * 103 * \return width 104 */ 105 uint16_t Width(void) const; 110 106 111 112 113 114 115 116 107 /*! 108 * \brief Height 109 * 110 * \return height 111 */ 112 uint16_t Height(void) const; 117 113 118 119 120 121 122 123 124 125 core::cvimage*Output(void);114 /*! 115 * \brief Output matrix 116 * 117 * Output matrix is of the same size as declared in constructor. \n 118 * 119 * \return the output matrix 120 */ 121 core::cvimage *Output(void); 126 122 127 123 core::DataType const &GetOutputDataType() const; 128 124 129 130 131 132 133 134 135 gui::GroupBox*GetGroupBox(void) const;125 protected: 126 /*! 127 * \brief get GroupBox 128 * 129 * \return a GroupBox available 130 */ 131 gui::GroupBox *GetGroupBox(void) const; 136 132 137 133 core::cvimage *output; 138 134 139 140 gui::Tab *main_tab,*sensor_tab,*plot_tab;141 142 gui::GroupBox*setup_groupbox;143 gui::GridLayout*setup_layout;144 135 private: 136 gui::Tab *main_tab, *sensor_tab, *plot_tab; 137 gui::TabWidget *tab; 138 gui::GroupBox *setup_groupbox; 139 gui::GridLayout *setup_layout; 140 }; 145 141 } // end namespace sensor 146 142 } // end namespace flair -
trunk/include/FlairSensorActuator/Controller.h
r4 r13 23 23 24 24 namespace flair { 25 26 27 25 namespace core { 26 class Message; 27 } 28 28 } 29 29 30 namespace flair { namespace sensor { 30 namespace flair { 31 namespace sensor { 31 32 32 enum class ControllerAction { 33 SetLedOn, 34 SetLedOff, 35 Rumble, 36 FlashLed, 37 Exit 38 }; 33 enum class ControllerAction { SetLedOn, SetLedOff, Rumble, FlashLed, Exit }; 39 34 40 class RumbleMessage: public core::Message { 41 public: 42 RumbleMessage(unsigned int leftForce,unsigned int leftTimeout,unsigned int rightForce,unsigned int rightTimeout); 43 unsigned int GetLeftForce() const; 44 unsigned int GetLeftTimeout() const; 45 unsigned int GetRightForce() const; 46 unsigned int GetRightTimeout() const; 47 void SetLeftForce(unsigned int leftForce); 48 void SetLeftTimeout(unsigned int leftTimeout); 49 void SetRightForce(unsigned int rightForce); 50 void SetRightTimeout(unsigned int rightTimeout); 51 private: 52 static const unsigned int leftForceOffset=sizeof(ControllerAction); 53 static const unsigned int leftTimeoutOffset=sizeof(ControllerAction)+sizeof(unsigned int); 54 static const unsigned int rightForceOffset=sizeof(ControllerAction)+2*sizeof(unsigned int); 55 static const unsigned int rightTimeoutOffset=sizeof(ControllerAction)+3*sizeof(unsigned int); 56 }; 35 class RumbleMessage : public core::Message { 36 public: 37 RumbleMessage(unsigned int leftForce, unsigned int leftTimeout, 38 unsigned int rightForce, unsigned int rightTimeout); 39 unsigned int GetLeftForce() const; 40 unsigned int GetLeftTimeout() const; 41 unsigned int GetRightForce() const; 42 unsigned int GetRightTimeout() const; 43 void SetLeftForce(unsigned int leftForce); 44 void SetLeftTimeout(unsigned int leftTimeout); 45 void SetRightForce(unsigned int rightForce); 46 void SetRightTimeout(unsigned int rightTimeout); 57 47 58 class SwitchLedMessage: public core::Message { 59 public: 60 SwitchLedMessage(bool isOn,unsigned int ledId); 61 bool IsOn() const; 62 unsigned int GetLedId() const; 63 void SetOn(); 64 void SetOff(); 65 void SetLedId(unsigned int ledId); 66 private: 67 static const unsigned int isOnOffset=sizeof(ControllerAction); 68 static const unsigned int ledIdOffset=sizeof(ControllerAction)+sizeof(bool); 69 }; 48 private: 49 static const unsigned int leftForceOffset = sizeof(ControllerAction); 50 static const unsigned int leftTimeoutOffset = 51 sizeof(ControllerAction) + sizeof(unsigned int); 52 static const unsigned int rightForceOffset = 53 sizeof(ControllerAction) + 2 * sizeof(unsigned int); 54 static const unsigned int rightTimeoutOffset = 55 sizeof(ControllerAction) + 3 * sizeof(unsigned int); 56 }; 70 57 71 class FlashLedMessage: public core::Message { 72 public: 73 FlashLedMessage(unsigned int ledId,unsigned int onTime,unsigned int offTime); 74 unsigned int GetLedId() const; 75 unsigned int GetOnTime() const; 76 unsigned int GetOffTime() const; 77 void SetLedId(unsigned int ledId); 78 void SetOnTime(unsigned int onTime); 79 void SetOffTime(unsigned int offTime); 80 private: 81 static const unsigned int ledIdOffset=sizeof(ControllerAction); 82 static const unsigned int onTimeOffset=sizeof(ControllerAction)+sizeof(unsigned int); 83 static const unsigned int offTimeOffset=sizeof(ControllerAction)+2*sizeof(unsigned int); 84 }; 58 class SwitchLedMessage : public core::Message { 59 public: 60 SwitchLedMessage(bool isOn, unsigned int ledId); 61 bool IsOn() const; 62 unsigned int GetLedId() const; 63 void SetOn(); 64 void SetOff(); 65 void SetLedId(unsigned int ledId); 85 66 86 }} 67 private: 68 static const unsigned int isOnOffset = sizeof(ControllerAction); 69 static const unsigned int ledIdOffset = 70 sizeof(ControllerAction) + sizeof(bool); 71 }; 72 73 class FlashLedMessage : public core::Message { 74 public: 75 FlashLedMessage(unsigned int ledId, unsigned int onTime, 76 unsigned int offTime); 77 unsigned int GetLedId() const; 78 unsigned int GetOnTime() const; 79 unsigned int GetOffTime() const; 80 void SetLedId(unsigned int ledId); 81 void SetOnTime(unsigned int onTime); 82 void SetOffTime(unsigned int offTime); 83 84 private: 85 static const unsigned int ledIdOffset = sizeof(ControllerAction); 86 static const unsigned int onTimeOffset = 87 sizeof(ControllerAction) + sizeof(unsigned int); 88 static const unsigned int offTimeOffset = 89 sizeof(ControllerAction) + 2 * sizeof(unsigned int); 90 }; 91 } 92 } 87 93 88 94 #endif // CONTROLLER_H -
trunk/include/FlairSensorActuator/Gps.h
r4 r13 17 17 #include <nmea/nmea.h> 18 18 19 namespace flair 20 { 21 namespace core 22 { 23 class cvmatrix; 24 class FrameworkManager; 25 class GeoCoordinate; 26 class Vector3D; 27 } 28 namespace gui 29 { 30 class Layout; 31 class DataPlot1D; 32 class Tab; 33 class TabWidget; 34 class PushButton; 35 class Map; 36 class Label; 37 } 19 namespace flair { 20 namespace core { 21 class cvmatrix; 22 class FrameworkManager; 23 class GeoCoordinate; 24 class Vector3D; 38 25 } 39 40 namespace flair 41 { 42 namespace sensor 43 { 44 /*! \class Gps 45 * 46 * \brief Base class for GPS 47 */ 48 class Gps : public core::IODevice 49 { 50 public: 51 /*! 52 \enum FixQuality_t 53 \brief Fix qualty indicators 54 */ 55 enum class FixQuality_t { 56 Invalid=0,/*!< invalid */ 57 Gps=1,/*!< Gps */ 58 DGps=2,/*!< Differential Gps */ 59 Pps=3,/*!< Pps */ 60 Rtk=4,/*!< RTK */ 61 RtkFloat=5,/*!< RTK float */ 62 Estimated=6,/*!< Estimated */ 63 Manual=7,/*!< Manual */ 64 Simulation=8,/*!< Simulation */ 65 }; 66 67 /*! 68 \enum NMEAFlags_t 69 \brief NMEA flags 70 */ 71 enum NMEAFlags_t { 72 GGA=0x01,/*!< GGA */ 73 VTG=0x02,/*!< VTG */ 74 GST=0x04,/*!< GST */ 75 }; 76 77 /*! 78 * \brief Constructor 79 * 80 * Construct a Gps. 81 * 82 * \param parent parent 83 * \param name name 84 * \param NMEAFlags NMEA sentances to enable 85 */ 86 Gps(const core::FrameworkManager* parent,std::string name,NMEAFlags_t NMEAFlags); 87 88 /*! 89 * \brief Destructor 90 * 91 */ 92 ~Gps(); 93 94 /*! 95 * \brief Use default plot 96 * 97 */ 98 void UseDefaultPlot(void); 99 100 /*! 101 * \brief East plot 102 * 103 * \return east plot 104 */ 105 gui::DataPlot1D* EPlot(void) const; 106 107 /*! 108 * \brief North plot 109 * 110 * \return north plot 111 */ 112 gui::DataPlot1D* NPlot(void) const; 113 114 /*! 115 * \brief Up plot 116 * 117 * \return up plot 118 */ 119 gui::DataPlot1D* UPlot(void) const; 120 121 /*! 122 * \brief East velocity plot 123 * 124 * \return east velocity plot 125 */ 126 gui::DataPlot1D* VEPlot(void) const; 127 128 /*! 129 * \brief North velocity plot 130 * 131 * \return north velocity plot 132 */ 133 gui::DataPlot1D* VNPlot(void) const; 134 135 /*! 136 * \brief Main tab 137 * 138 * \return main tab 139 */ 140 gui::TabWidget* GetTab(void) const; 141 142 /*! 143 * \brief Setup Layout 144 * 145 * \return setup Layout 146 */ 147 gui::Layout* GetLayout(void) const; 148 149 /*! 150 * \brief Plot tab 151 * 152 * \return plot Tab 153 */ 154 gui::Tab* GetPlotTab(void) const; 155 156 /*! 157 * \brief Number of used satellites 158 * 159 * \return number of used satellites 160 */ 161 uint16_t NbSat(void) const; 162 163 /*! 164 * \brief Fix Quality 165 * 166 * \return fix quality 167 */ 168 FixQuality_t FixQuality(void) const; 169 170 /*! 171 * \brief Set reference for ENU coordinates 172 * 173 * The actual position is used as reference to calculate 174 * ENU coordinates. 175 * 176 * \return fix quality 177 */ 178 void SetRef(void); 179 180 /*! 181 * \brief Get ENU position 182 * 183 * \param point to store position 184 */ 185 void GetENUPosition(core::Vector3D *point); 186 187 protected: 188 /*! 189 * \brief Parse a NMEA frame 190 * 191 * This function must be called by the reimplemented class. \n 192 * When a frame is parsed, GPS datas are filled. 193 * 194 * \param frame NMEA frame 195 * \param frame_size frame size 196 * 197 */ 198 void parseFrame(const char *frame, int frame_size); 199 200 NMEAFlags_t NMEAFlags; 201 202 protected: 203 core::GeoCoordinate *position; 204 205 private: 206 /*! 207 * \brief Update using provided datas 208 * 209 * Reimplemented from IODevice. 210 * 211 * \param data data from the parent to process 212 */ 213 void UpdateFrom(const core::io_data *data){}; 214 215 gui::Tab *main_tab,*sensor_tab; 216 gui::TabWidget* tab; 217 gui::PushButton *button_ref; 218 gui::DataPlot1D* e_plot; 219 gui::DataPlot1D* n_plot; 220 gui::DataPlot1D* u_plot; 221 gui::DataPlot1D* ve_plot; 222 gui::DataPlot1D* vn_plot; 223 gui::Tab* plot_tab; 224 gui::Map *map; 225 gui::Label *nb_sat_label,*fix_label; 226 uint16_t nb_sat; 227 FixQuality_t fix; 228 bool take_ref; 229 nmeaINFO info; 230 nmeaPARSER parser; 231 nmeaGPGGA pack; 232 nmeaPOS pos; 233 double lat_ref,long_ref,alt_ref; 234 235 //matrix 236 core::cvmatrix *output; 237 }; 26 namespace gui { 27 class Layout; 28 class DataPlot1D; 29 class Tab; 30 class TabWidget; 31 class PushButton; 32 class Map; 33 class Label; 34 } 35 } 36 37 namespace flair { 38 namespace sensor { 39 /*! \class Gps 40 * 41 * \brief Base class for GPS 42 */ 43 class Gps : public core::IODevice { 44 public: 45 /*! 46 \enum FixQuality_t 47 \brief Fix qualty indicators 48 */ 49 enum class FixQuality_t { 50 Invalid = 0, /*!< invalid */ 51 Gps = 1, /*!< Gps */ 52 DGps = 2, /*!< Differential Gps */ 53 Pps = 3, /*!< Pps */ 54 Rtk = 4, /*!< RTK */ 55 RtkFloat = 5, /*!< RTK float */ 56 Estimated = 6, /*!< Estimated */ 57 Manual = 7, /*!< Manual */ 58 Simulation = 8, /*!< Simulation */ 59 }; 60 61 /*! 62 \enum NMEAFlags_t 63 \brief NMEA flags 64 */ 65 enum NMEAFlags_t { 66 GGA = 0x01, /*!< GGA */ 67 VTG = 0x02, /*!< VTG */ 68 GST = 0x04, /*!< GST */ 69 }; 70 71 /*! 72 * \brief Constructor 73 * 74 * Construct a Gps. 75 * 76 * \param parent parent 77 * \param name name 78 * \param NMEAFlags NMEA sentances to enable 79 */ 80 Gps(const core::FrameworkManager *parent, std::string name, 81 NMEAFlags_t NMEAFlags); 82 83 /*! 84 * \brief Destructor 85 * 86 */ 87 ~Gps(); 88 89 /*! 90 * \brief Use default plot 91 * 92 */ 93 void UseDefaultPlot(void); 94 95 /*! 96 * \brief East plot 97 * 98 * \return east plot 99 */ 100 gui::DataPlot1D *EPlot(void) const; 101 102 /*! 103 * \brief North plot 104 * 105 * \return north plot 106 */ 107 gui::DataPlot1D *NPlot(void) const; 108 109 /*! 110 * \brief Up plot 111 * 112 * \return up plot 113 */ 114 gui::DataPlot1D *UPlot(void) const; 115 116 /*! 117 * \brief East velocity plot 118 * 119 * \return east velocity plot 120 */ 121 gui::DataPlot1D *VEPlot(void) const; 122 123 /*! 124 * \brief North velocity plot 125 * 126 * \return north velocity plot 127 */ 128 gui::DataPlot1D *VNPlot(void) const; 129 130 /*! 131 * \brief Main tab 132 * 133 * \return main tab 134 */ 135 gui::TabWidget *GetTab(void) const; 136 137 /*! 138 * \brief Setup Layout 139 * 140 * \return setup Layout 141 */ 142 gui::Layout *GetLayout(void) const; 143 144 /*! 145 * \brief Plot tab 146 * 147 * \return plot Tab 148 */ 149 gui::Tab *GetPlotTab(void) const; 150 151 /*! 152 * \brief Number of used satellites 153 * 154 * \return number of used satellites 155 */ 156 uint16_t NbSat(void) const; 157 158 /*! 159 * \brief Fix Quality 160 * 161 * \return fix quality 162 */ 163 FixQuality_t FixQuality(void) const; 164 165 /*! 166 * \brief Set reference for ENU coordinates 167 * 168 * The actual position is used as reference to calculate 169 * ENU coordinates. 170 * 171 * \return fix quality 172 */ 173 void SetRef(void); 174 175 /*! 176 * \brief Get ENU position 177 * 178 * \param point to store position 179 */ 180 void GetENUPosition(core::Vector3D *point); 181 182 protected: 183 /*! 184 * \brief Parse a NMEA frame 185 * 186 * This function must be called by the reimplemented class. \n 187 * When a frame is parsed, GPS datas are filled. 188 * 189 * \param frame NMEA frame 190 * \param frame_size frame size 191 * 192 */ 193 void parseFrame(const char *frame, int frame_size); 194 195 NMEAFlags_t NMEAFlags; 196 197 protected: 198 core::GeoCoordinate *position; 199 200 private: 201 /*! 202 * \brief Update using provided datas 203 * 204 * Reimplemented from IODevice. 205 * 206 * \param data data from the parent to process 207 */ 208 void UpdateFrom(const core::io_data *data){}; 209 210 gui::Tab *main_tab, *sensor_tab; 211 gui::TabWidget *tab; 212 gui::PushButton *button_ref; 213 gui::DataPlot1D *e_plot; 214 gui::DataPlot1D *n_plot; 215 gui::DataPlot1D *u_plot; 216 gui::DataPlot1D *ve_plot; 217 gui::DataPlot1D *vn_plot; 218 gui::Tab *plot_tab; 219 gui::Map *map; 220 gui::Label *nb_sat_label, *fix_label; 221 uint16_t nb_sat; 222 FixQuality_t fix; 223 bool take_ref; 224 nmeaINFO info; 225 nmeaPARSER parser; 226 nmeaGPGGA pack; 227 nmeaPOS pos; 228 double lat_ref, long_ref, alt_ref; 229 230 // matrix 231 core::cvmatrix *output; 232 }; 238 233 } // end namespace sensor 239 234 } // end namespace framewor -
trunk/include/FlairSensorActuator/Gx3_25_imu.h
r4 r13 18 18 19 19 namespace flair { 20 21 22 23 20 namespace core { 21 class FrameworkManager; 22 class SerialPort; 23 } 24 24 } 25 25 26 26 class Gx3_25_imu_impl; 27 27 28 namespace flair { namespace sensor { 29 /*! \class Gx3_25_imu 30 * 31 * \brief Class for 3dmgx3-25 Imu 32 */ 33 class Gx3_25_imu : public Imu, public core::Thread { 34 friend class ::Gx3_25_imu_impl; 28 namespace flair { 29 namespace sensor { 30 /*! \class Gx3_25_imu 31 * 32 * \brief Class for 3dmgx3-25 Imu 33 */ 34 class Gx3_25_imu : public Imu, public core::Thread { 35 friend class ::Gx3_25_imu_impl; 35 36 36 public: 37 /*! 38 \enum Command_t 39 \brief Command for the continuous mode 40 */ 41 enum Command_t{ 42 EulerAnglesAndAngularRates=0xcf,/*!< Euler angles and angular rates */ 43 AccelerationAngularRateAndOrientationMatrix=0xc8,/*!< Acceleration, angular rate and orientation matrix */ 44 }; 37 public: 38 /*! 39 \enum Command_t 40 \brief Command for the continuous mode 41 */ 42 enum Command_t { 43 EulerAnglesAndAngularRates = 0xcf, /*!< Euler angles and angular rates */ 44 AccelerationAngularRateAndOrientationMatrix = 45 0xc8, /*!< Acceleration, angular rate and orientation matrix */ 46 }; 45 47 46 /*! 47 * \brief Constructor 48 * 49 * Construct a Gx3_25_imu. 50 * 51 * \param parent parent 52 * \param name name 53 * \param serialport SerialPort 54 * \param command command for continuous mode 55 * \param priority priority of the Thread 56 */ 57 Gx3_25_imu(const core::FrameworkManager* parent,std::string name,core::SerialPort *serialport,Command_t command,uint8_t priority); 48 /*! 49 * \brief Constructor 50 * 51 * Construct a Gx3_25_imu. 52 * 53 * \param parent parent 54 * \param name name 55 * \param serialport SerialPort 56 * \param command command for continuous mode 57 * \param priority priority of the Thread 58 */ 59 Gx3_25_imu(const core::FrameworkManager *parent, std::string name, 60 core::SerialPort *serialport, Command_t command, uint8_t priority); 58 61 59 60 61 62 63 62 /*! 63 * \brief Destructor 64 * 65 */ 66 ~Gx3_25_imu(); 64 67 65 66 67 68 69 70 71 72 68 private: 69 /*! 70 * \brief Run function 71 * 72 * Reimplemented from Thread. 73 * 74 */ 75 void Run(void); 73 76 74 75 76 77 78 79 80 81 77 /*! 78 * \brief Update using provided datas 79 * 80 * Reimplemented from IODevice. 81 * 82 * \param data data from the parent to process 83 */ 84 void UpdateFrom(const core::io_data *data){}; 82 85 83 class Gx3_25_imu_impl*pimpl_;84 86 class Gx3_25_imu_impl *pimpl_; 87 }; 85 88 } // end namespace sensor 86 89 } // end namespace flair -
trunk/include/FlairSensorActuator/HokuyoUTM30Lx.h
r4 r13 21 21 #include <vector> 22 22 23 namespace flair 24 { 25 namespace core 26 { 27 class cvmatrix; 28 class FrameworkManager; 29 class SerialPort; 30 class Mutex; 31 } 32 namespace gui 33 { 34 class Tab; 35 class TabWidget; 36 class RangeFinderPlot; 37 } 23 namespace flair { 24 namespace core { 25 class cvmatrix; 26 class FrameworkManager; 27 class SerialPort; 28 class Mutex; 29 } 30 namespace gui { 31 class Tab; 32 class TabWidget; 33 class RangeFinderPlot; 34 } 38 35 } 39 36 40 namespace flair 41 { 42 namespace sensor 43 { 44 /*! \class HokuyoUTM30Lx 45 * 46 * \brief Classe intégrant le telemetre laser Hokuyo UTM 30lx 47 */ 48 class HokuyoUTM30Lx : public core::Thread, public LaserRangeFinder 49 { 50 public: 37 namespace flair { 38 namespace sensor { 39 /*! \class HokuyoUTM30Lx 40 * 41 * \brief Classe intégrant le telemetre laser Hokuyo UTM 30lx 42 */ 43 class HokuyoUTM30Lx : public core::Thread, public LaserRangeFinder { 44 public: 45 /*! 46 * \brief Constructor 47 * 48 * Construct a Hokuyo UTM30-Lx. 49 * 50 * \param parent parent 51 * \param name name 52 * \param serialport serialport 53 * \param priority priority of the Thread 54 */ 55 HokuyoUTM30Lx(const core::FrameworkManager *parent, std::string name, 56 core::SerialPort *serialport, uint8_t priority); 57 void getMesure(int startStep, int endStep, int clusterCount, int interval, 58 int scanNumber = 0); 59 core::cvmatrix *getDatas(void); 51 60 52 /*! 53 * \brief Constructor 54 * 55 * Construct a Hokuyo UTM30-Lx. 56 * 57 * \param parent parent 58 * \param name name 59 * \param serialport serialport 60 * \param priority priority of the Thread 61 */ 62 HokuyoUTM30Lx(const core::FrameworkManager* parent,std::string name,core::SerialPort *serialport,uint8_t priority); 63 void getMesure(int startStep, int endStep,int clusterCount, int interval, int scanNumber=0); 64 core::cvmatrix* getDatas(void); 61 /*! 62 * \brief Use default plot 63 * 64 */ 65 void UseDefaultPlot(void); 66 /*! 67 * \brief Destructor 68 * 69 */ 70 ~HokuyoUTM30Lx(); 65 71 66 /*! 67 * \brief Use default plot 68 * 69 */ 70 void UseDefaultPlot(void); 71 /*! 72 * \brief Destructor 73 * 74 */ 75 ~HokuyoUTM30Lx(); 72 private: 73 core::SerialPort *serialport; 74 core::Mutex *bufRetMut; 75 core::Mutex *sendingCmdMut; 76 gui::Tab *main_tab; 77 gui::TabWidget *tab; 78 gui::RangeFinderPlot *plot; 76 79 77 private: 78 core::SerialPort *serialport; 79 core::Mutex* bufRetMut; 80 core::Mutex* sendingCmdMut; 81 gui::Tab* main_tab; 82 gui::TabWidget* tab; 83 gui::RangeFinderPlot* plot; 80 // matrix 81 core::cvmatrix *output; 84 82 85 //matrix 86 core::cvmatrix *output; 83 std::queue<std::string> bufRet; 87 84 88 std::queue<std::string> bufRet; 85 /*! 86 * \brief Run function 87 * 88 * Reimplemented from Thread. 89 * 90 */ 91 void Run(void); 92 /*! 93 * \brief Send a command 94 * \param command Command to send (see Hokuyo UTM 30-LX doc for more 95 * informations) 96 * \return Return code 97 */ 98 std::string sendCommand(std::string command); 99 /*! 100 * \brief Start the laser 101 * 102 */ 103 void startLaser(void); 104 /*! 105 * \brief Stop the laser 106 * 107 */ 108 void stopLaser(void); 109 /*! 110 * \brief Stop and reset the laser's settings 111 * 112 */ 113 void resetConfig(void); 114 /*! 115 * \brief Decode incomming datas 116 * \param datas Datas to decode 117 * \param startStep Set the first mesured point 118 * Decode mesured points from incoming datas and fill the output matrix 119 */ 120 void decodeDatas(std::vector<std::string> datas, int startStep); 121 /*! 122 * \brief Explode a string into a vector 123 * \param str The string to explode 124 * \param delimiter The character separating elements 125 * \return A vector containing the elements 126 */ 127 static std::vector<std::string> explode(const std::string str, 128 char delimiter); 129 /*! 130 * \brief Calculate the checksum 131 * \param code Data from which calculate 132 * \param byte Data's size 133 * \return A character corresponding to the code's checksum 134 */ 135 static int encodeSum(const char *code, int byte); 136 /*! 137 * \brief Check if a data correspond to its checksum 138 * \param data Datas to check 139 */ 140 static bool checkSum(std::string data); 141 /*! 142 * \brief Decode datas using the 2 character encoding 143 * \param data Datas to decode 144 * \return Decoded datas 145 */ 146 static float decode2car(const char *data); 147 /*! 148 * \brief Decode datas using the 3 character encoding 149 * \param data Datas to decode 150 * \return Decoded datas 151 */ 152 static float decode3car(const char *data); 153 /*! 154 * \brief Decode datas using the 4 character encoding 155 * \param data Datas to decode 156 * \return Decoded datas 157 */ 158 static float decode4car(const char *data); 89 159 90 /*! 91 * \brief Run function 92 * 93 * Reimplemented from Thread. 94 * 95 */ 96 void Run(void); 97 /*! 98 * \brief Send a command 99 * \param command Command to send (see Hokuyo UTM 30-LX doc for more informations) 100 * \return Return code 101 */ 102 std::string sendCommand(std::string command); 103 /*! 104 * \brief Start the laser 105 * 106 */ 107 void startLaser(void); 108 /*! 109 * \brief Stop the laser 110 * 111 */ 112 void stopLaser(void); 113 /*! 114 * \brief Stop and reset the laser's settings 115 * 116 */ 117 void resetConfig(void); 118 /*! 119 * \brief Decode incomming datas 120 * \param datas Datas to decode 121 * \param startStep Set the first mesured point 122 * Decode mesured points from incoming datas and fill the output matrix 123 */ 124 void decodeDatas(std::vector<std::string> datas, int startStep); 125 /*! 126 * \brief Explode a string into a vector 127 * \param str The string to explode 128 * \param delimiter The character separating elements 129 * \return A vector containing the elements 130 */ 131 static std::vector<std::string> explode(const std::string str, char delimiter); 132 /*! 133 * \brief Calculate the checksum 134 * \param code Data from which calculate 135 * \param byte Data's size 136 * \return A character corresponding to the code's checksum 137 */ 138 static int encodeSum(const char* code, int byte); 139 /*! 140 * \brief Check if a data correspond to its checksum 141 * \param data Datas to check 142 */ 143 static bool checkSum(std::string data); 144 /*! 145 * \brief Decode datas using the 2 character encoding 146 * \param data Datas to decode 147 * \return Decoded datas 148 */ 149 static float decode2car(const char* data); 150 /*! 151 * \brief Decode datas using the 3 character encoding 152 * \param data Datas to decode 153 * \return Decoded datas 154 */ 155 static float decode3car(const char* data); 156 /*! 157 * \brief Decode datas using the 4 character encoding 158 * \param data Datas to decode 159 * \return Decoded datas 160 */ 161 static float decode4car(const char* data); 162 163 /*! 164 * \brief Update using provided datas 165 * 166 * Reimplemented from IODevice. 167 * 168 * \param data data from the parent to process 169 */ 170 void UpdateFrom(const core::io_data *data){}; 171 172 }; 160 /*! 161 * \brief Update using provided datas 162 * 163 * Reimplemented from IODevice. 164 * 165 * \param data data from the parent to process 166 */ 167 void UpdateFrom(const core::io_data *data){}; 168 }; 173 169 } // end namespace sensor 174 170 } // end namespace framewor -
trunk/include/FlairSensorActuator/HostEthController.h
r4 r13 11 11 // version: $Id: $ 12 12 // 13 // purpose: Base class for host side remote controls that talks to target side through ethernet connection 13 // purpose: Base class for host side remote controls that talks to target 14 // side through ethernet connection 14 15 // 15 16 // … … 24 25 25 26 namespace flair { 26 27 28 29 30 31 32 33 34 35 36 37 27 namespace core { 28 class FrameworkManager; 29 class cvmatrix; 30 class TcpSocket; 31 class Socket; 32 class Mutex; 33 } 34 namespace gui { 35 class Tab; 36 class TabWidget; 37 class DataPlot1D; 38 } 38 39 } 39 40 40 namespace flair { namespace sensor { 41 enum class ControllerAction; 41 namespace flair { 42 namespace sensor { 43 enum class ControllerAction; 42 44 43 /*! \class HostEthController 44 * 45 * \brief Base Class for host side remote controls that talks to target side through ethernet connection 46 * 47 * There are 2 communication channels: 48 * - 1 connection with the ground station to display the values. Output for analog sticks is normalized in the range [-1, 1] (float values) 49 * - 1 connection with the target to send the controller values (and receive controller state modification requests) 50 */ 51 class HostEthController : public core::Thread, public core::IODevice { 52 public: 53 HostEthController(const core::FrameworkManager* parent,std::string name,std::string address,int port,uint32_t period=10,uint32_t _bitsPerAxis=7,uint8_t priority=0); 54 ~HostEthController(); 55 void DrawUserInterface(); 56 protected: 57 std::string controllerName; 58 core::TcpSocket *controlSocket; //connection to the target 59 core::Socket *dataSocket; 60 std::string targetAddress; 61 int targetPort; 62 gui::Tab *tab; 63 gui::TabWidget *tabWidget; 64 virtual bool IsDataFrameReady() { return true;}; 65 virtual void CompleteDataFrameGrab() {}; 66 // int8_t *datas; 67 // uint8_t dataSize; 68 char *dataFrameBuffer; 69 size_t dataFrameSize; 70 virtual void ProcessMessage(core::Message *controllerAction) {}; 45 /*! \class HostEthController 46 * 47 * \brief Base Class for host side remote controls that talks to target side 48 *through ethernet connection 49 * 50 * There are 2 communication channels: 51 * - 1 connection with the ground station to display the values. Output for 52 *analog sticks is normalized in the range [-1, 1] (float values) 53 * - 1 connection with the target to send the controller values (and receive 54 *controller state modification requests) 55 */ 56 class HostEthController : public core::Thread, public core::IODevice { 57 public: 58 HostEthController(const core::FrameworkManager *parent, std::string name, 59 std::string address, int port, uint32_t period = 10, 60 uint32_t _bitsPerAxis = 7, uint8_t priority = 0); 61 ~HostEthController(); 62 void DrawUserInterface(); 71 63 72 virtual std::string GetAxisDescription(unsigned int axis); 73 virtual void GetAxisData()=0; //responsible for getting the axis data from the hardware 74 unsigned int axisNumber; 75 core::cvmatrix* axis; 76 gui::DataPlot1D **axisPlot; 77 uint32_t bitsPerAxis; 78 uint32_t nativeBitsPerAxis; 64 protected: 65 std::string controllerName; 66 core::TcpSocket *controlSocket; // connection to the target 67 core::Socket *dataSocket; 68 std::string targetAddress; 69 int targetPort; 70 gui::Tab *tab; 71 gui::TabWidget *tabWidget; 72 virtual bool IsDataFrameReady() { return true; }; 73 virtual void CompleteDataFrameGrab(){}; 74 // int8_t *datas; 75 // uint8_t dataSize; 76 char *dataFrameBuffer; 77 size_t dataFrameSize; 78 virtual void ProcessMessage(core::Message *controllerAction){}; 79 79 80 virtual std::string GetButtonDescription(unsigned int button); 81 virtual void GetButtonData()=0; //responsible for getting the button data from the hardware 82 unsigned int buttonNumber; 83 core::cvmatrix* button; 84 uint8_t buttonOffset; 85 bool meaningfulDataAvailable; 80 virtual std::string GetAxisDescription(unsigned int axis); 81 virtual void 82 GetAxisData() = 0; // responsible for getting the axis data from the hardware 83 unsigned int axisNumber; 84 core::cvmatrix *axis; 85 gui::DataPlot1D **axisPlot; 86 uint32_t bitsPerAxis; 87 uint32_t nativeBitsPerAxis; 86 88 87 private: 88 class DataSender : public core::Thread { 89 public: 90 DataSender(Object* parent,HostEthController* hostEthController,std::string name,uint8_t priority=0); 91 void Run(); 92 private: 93 HostEthController* hostEthController; 94 }; 95 DataSender *dataSender; 89 virtual std::string GetButtonDescription(unsigned int button); 90 virtual void GetButtonData() = 0; // responsible for getting the button data 91 // from the hardware 92 unsigned int buttonNumber; 93 core::cvmatrix *button; 94 uint8_t buttonOffset; 95 bool meaningfulDataAvailable; 96 96 97 bool ControllerInitialization(); 98 bool ConnectedWithTarget(); 99 void SendControllerInfo(); 100 void Run(); 101 void BuildDataFrame(); 102 bool writeBits(uint16_t value,uint8_t valueSizeInBits,char *buffer,uint8_t offsetInBits); 103 core::Mutex *connectionEstablishedMutex; 104 }; 97 private: 98 class DataSender : public core::Thread { 99 public: 100 DataSender(Object *parent, HostEthController *hostEthController, 101 std::string name, uint8_t priority = 0); 102 void Run(); 105 103 106 }} 104 private: 105 HostEthController *hostEthController; 106 }; 107 DataSender *dataSender; 108 109 bool ControllerInitialization(); 110 bool ConnectedWithTarget(); 111 void SendControllerInfo(); 112 void Run(); 113 void BuildDataFrame(); 114 bool writeBits(uint16_t value, uint8_t valueSizeInBits, char *buffer, 115 uint8_t offsetInBits); 116 core::Mutex *connectionEstablishedMutex; 117 }; 118 } 119 } 107 120 108 121 #endif // HOSTETHCONTROLLER_H -
trunk/include/FlairSensorActuator/Imu.h
r4 r13 17 17 18 18 namespace flair { 19 20 21 22 23 24 25 26 27 28 29 19 namespace core { 20 class ImuData; 21 class OneAxisRotation; 22 } 23 namespace gui { 24 class Tab; 25 class TabWidget; 26 class GroupBox; 27 class Layout; 28 class DataPlot1D; 29 } 30 30 } 31 31 32 32 class Ahrs_impl; 33 33 34 namespace flair { namespace sensor { 35 /*! \class Imu 36 * 37 * \brief Base class for Imu 38 * 39 * Use this class to define a custom Imu. 40 * 41 */ 42 class Imu : public core::IODevice { 43 friend class ::Ahrs_impl; 34 namespace flair { 35 namespace sensor { 36 /*! \class Imu 37 * 38 * \brief Base class for Imu 39 * 40 * Use this class to define a custom Imu. 41 * 42 */ 43 class Imu : public core::IODevice { 44 friend class ::Ahrs_impl; 44 45 45 46 47 48 49 50 51 52 53 54 Imu(const core::FrameworkManager *parent,std::string name);46 public: 47 /*! 48 * \brief Constructor 49 * 50 * Construct an Imu. 51 * 52 * \param parent parent 53 * \param name name 54 */ 55 Imu(const core::FrameworkManager *parent, std::string name); 55 56 56 57 58 59 60 61 62 63 64 65 Imu(const core::IODevice *parent,std::string name);57 /*! 58 * \brief Constructor 59 * 60 * Construct an Imu. \n 61 * This contructor must only be called for a simulated device. 62 * 63 * \param parent parent 64 * \param name name 65 */ 66 Imu(const core::IODevice *parent, std::string name); 66 67 67 68 69 70 71 68 /*! 69 * \brief Destructor 70 * 71 */ 72 ~Imu(); 72 73 73 74 75 76 77 78 74 /*! 75 * \brief Setup Layout 76 * 77 * \return setup Layout 78 */ 79 gui::Layout *GetLayout(void) const; 79 80 80 81 82 83 84 81 /*! 82 * \brief Lock user interface 83 * 84 */ 85 void LockUserInterface(void) const; 85 86 86 87 88 89 90 87 /*! 88 * \brief Unlock user interface 89 * 90 */ 91 void UnlockUserInterface(void) const; 91 92 92 93 94 95 96 93 /*! 94 * \brief Use default plot 95 * 96 */ 97 void UseDefaultPlot(void); 97 98 98 99 100 101 102 103 99 /*! 100 * \brief Plot tab 101 * 102 * \return plot Tab 103 */ 104 gui::Tab *GetPlotTab(void) const; 104 105 105 106 107 108 109 110 111 106 protected: 107 /*! 108 * \brief Setup GroupBox 109 * 110 * \return setup GroupBox 111 */ 112 gui::GroupBox *GetGroupBox(void) const; 112 113 113 /*! 114 * \brief UpdateImu 115 * 116 * The reimplemented class must call this function as soon as IMU datas are available. \n 117 * It handles the data rotation if it was defined. 118 * 119 */ 120 void UpdateImu(); 114 /*! 115 * \brief UpdateImu 116 * 117 * The reimplemented class must call this function as soon as IMU datas are 118 *available. \n 119 * It handles the data rotation if it was defined. 120 * 121 */ 122 void UpdateImu(); 121 123 122 123 124 125 126 127 124 /*! 125 * \brief Get imu datas 126 * 127 * \param imuData imu datas 128 */ 129 void GetDatas(core::ImuData **imuData) const; 128 130 131 private: 132 gui::Tab *mainTab, *sensorTab, *plotTab; 133 gui::TabWidget *tab; 134 gui::GroupBox *setupGroupbox; 135 core::OneAxisRotation *rotation; 136 core::ImuData *imuData; 129 137 130 private: 131 gui::Tab *mainTab,*sensorTab,*plotTab; 132 gui::TabWidget* tab; 133 gui::GroupBox *setupGroupbox; 134 core::OneAxisRotation* rotation; 135 core::ImuData *imuData; 136 137 gui::DataPlot1D *axPlot,*ayPlot,*azPlot; 138 gui::DataPlot1D *gxPlot,*gyPlot,*gzPlot; 139 gui::DataPlot1D *mxPlot,*myPlot,*mzPlot; 140 }; 138 gui::DataPlot1D *axPlot, *ayPlot, *azPlot; 139 gui::DataPlot1D *gxPlot, *gyPlot, *gzPlot; 140 gui::DataPlot1D *mxPlot, *myPlot, *mzPlot; 141 }; 141 142 } // end namespace sensor 142 143 } // end namespace flair -
trunk/include/FlairSensorActuator/LaserRangeFinder.h
r4 r13 16 16 #include <IODevice.h> 17 17 18 namespace flair 19 { 20 namespace core 21 { 22 class FrameworkManager; 23 class cvmatrix; 24 25 } 26 namespace gui 27 { 28 class Tab; 29 class TabWidget; 30 class GroupBox; 31 class Layout; 32 class RangeFinderPlot; 33 } 18 namespace flair { 19 namespace core { 20 class FrameworkManager; 21 class cvmatrix; 22 } 23 namespace gui { 24 class Tab; 25 class TabWidget; 26 class GroupBox; 27 class Layout; 28 class RangeFinderPlot; 29 } 34 30 } 35 31 36 namespace flair 37 { 38 namespace sensor 39 { 40 /*! \class LaserRangeFinder 41 * 42 * \brief Classe generique intégrant les telemetres laser 43 */ 44 class LaserRangeFinder : public core::IODevice 45 { 46 public: 47 /*! 48 * \brief Constructor 49 * 50 * Construct a Laser Range Finder. 51 * 52 * \param parent parent 53 * \param name name 54 */ 55 LaserRangeFinder(const core::FrameworkManager* parent,std::string name); 56 /*! 57 * \brief Constructor 58 * 59 * Construct a UsRangeFinder. Simulation part. 60 * 61 * \param parent parent 62 * \param name name 63 */ 64 LaserRangeFinder(const core::IODevice* parent,std::string name); 65 /*! 66 * \brief Destructor 67 * 68 */ 69 ~LaserRangeFinder(); 32 namespace flair { 33 namespace sensor { 34 /*! \class LaserRangeFinder 35 * 36 * \brief Classe generique intégrant les telemetres laser 37 */ 38 class LaserRangeFinder : public core::IODevice { 39 public: 40 /*! 41 * \brief Constructor 42 * 43 * Construct a Laser Range Finder. 44 * 45 * \param parent parent 46 * \param name name 47 */ 48 LaserRangeFinder(const core::FrameworkManager *parent, std::string name); 49 /*! 50 * \brief Constructor 51 * 52 * Construct a UsRangeFinder. Simulation part. 53 * 54 * \param parent parent 55 * \param name name 56 */ 57 LaserRangeFinder(const core::IODevice *parent, std::string name); 58 /*! 59 * \brief Destructor 60 * 61 */ 62 ~LaserRangeFinder(); 70 63 71 72 73 74 75 64 /*! 65 * \brief Use default plot 66 * 67 */ 68 void UseDefaultPlot(void); 76 69 77 78 79 80 81 82 gui::RangeFinderPlot*GetPlot(void) const;70 /*! 71 * \brief Plot 72 * 73 * \return DataPlot1D 74 */ 75 gui::RangeFinderPlot *GetPlot(void) const; 83 76 84 85 86 87 88 89 gui::Layout*GetLayout(void) const;77 /*! 78 * \brief Setup Layout 79 * 80 * \return a Layout available 81 */ 82 gui::Layout *GetLayout(void) const; 90 83 91 92 93 94 95 96 gui::Tab*GetPlotTab(void) const;84 /*! 85 * \brief Plot tab 86 * 87 * \return plot Tab 88 */ 89 gui::Tab *GetPlotTab(void) const; 97 90 98 99 100 101 102 103 91 /*! 92 * \brief Value 93 * 94 * \return output value 95 */ 96 float Value(void) const; 104 97 105 106 107 108 109 110 111 98 protected: 99 /*! 100 * \brief Output matrix 101 * 102 * \return output matrix 103 */ 104 core::cvmatrix *output; 112 105 113 114 115 116 117 118 gui::GroupBox*GetGroupBox(void) const;106 /*! 107 * \brief Setup GroupBox 108 * 109 * \return a GroupBox available 110 */ 111 gui::GroupBox *GetGroupBox(void) const; 119 112 120 121 122 123 124 125 126 127 128 113 private: 114 /*! 115 * \brief Update using provided datas 116 * 117 * Reimplemented from IODevice. 118 * 119 * \param data data from the parent to process 120 */ 121 void UpdateFrom(const core::io_data *data){}; 129 122 130 gui::Tab* main_tab; 131 gui::TabWidget *tab; 132 gui::GroupBox* setup_groupbox; 133 gui::Tab* sensor_tab; 134 gui::RangeFinderPlot* plot; 135 gui::Tab* plot_tab; 136 137 }; 123 gui::Tab *main_tab; 124 gui::TabWidget *tab; 125 gui::GroupBox *setup_groupbox; 126 gui::Tab *sensor_tab; 127 gui::RangeFinderPlot *plot; 128 gui::Tab *plot_tab; 129 }; 138 130 } // end namespace sensor 139 131 } // end namespace framewor -
trunk/include/FlairSensorActuator/Mb800.h
r4 r13 17 17 #include <Gps.h> 18 18 19 namespace flair 20 { 21 namespace core 22 { 23 class FrameworkManager; 24 class SerialPort; 25 } 19 namespace flair { 20 namespace core { 21 class FrameworkManager; 22 class SerialPort; 23 } 26 24 } 27 25 28 namespace flair 29 { 30 namespace sensor 31 { 32 /*! \class Mb800 33 * 34 * \brief Class for mb800 gps receiver 35 */ 36 class Mb800 : public core::Thread, public Gps 37 { 38 public: 39 /*! 40 * \brief Constructor 41 * 42 * Construct a Mb800. 43 * 44 * \param parent parent 45 * \param name name 46 * \param serialport serialport 47 * \param NMEAFlags NMEA sentances to enable 48 * \param priority priority of the Thread 49 */ 50 Mb800(const core::FrameworkManager* parent,std::string name,core::SerialPort *serialport,Gps::NMEAFlags_t NMEAFlags,uint8_t priority); 26 namespace flair { 27 namespace sensor { 28 /*! \class Mb800 29 * 30 * \brief Class for mb800 gps receiver 31 */ 32 class Mb800 : public core::Thread, public Gps { 33 public: 34 /*! 35 * \brief Constructor 36 * 37 * Construct a Mb800. 38 * 39 * \param parent parent 40 * \param name name 41 * \param serialport serialport 42 * \param NMEAFlags NMEA sentances to enable 43 * \param priority priority of the Thread 44 */ 45 Mb800(const core::FrameworkManager *parent, std::string name, 46 core::SerialPort *serialport, Gps::NMEAFlags_t NMEAFlags, 47 uint8_t priority); 51 48 52 53 54 55 56 49 /*! 50 * \brief Destructor 51 * 52 */ 53 ~Mb800(); 57 54 58 59 60 61 62 63 64 65 66 55 private: 56 /*! 57 * \brief Update using provided datas 58 * 59 * Reimplemented from IODevice. 60 * 61 * \param data data from the parent to process 62 */ 63 void UpdateFrom(const core::io_data *data){}; 67 64 68 69 70 71 72 73 74 65 /*! 66 * \brief Run function 67 * 68 * Reimplemented from Thread. 69 * 70 */ 71 void Run(void); 75 72 76 77 78 73 void Sync(void); 74 core::SerialPort *serialport; 75 }; 79 76 } // end namespace sensor 80 77 } // end namespace framewor -
trunk/include/FlairSensorActuator/Novatel.h
r4 r13 17 17 #include <Gps.h> 18 18 19 namespace flair 20 { 21 namespace core 22 { 23 class FrameworkManager; 24 class SerialPort; 25 } 19 namespace flair { 20 namespace core { 21 class FrameworkManager; 22 class SerialPort; 23 } 26 24 } 27 25 28 namespace flair 29 { 30 namespace sensor 31 { 32 /*! \class Novatel 33 * 34 * \brief Class for Novatel gps receiver 35 */ 36 class Novatel : public core::Thread, public Gps 37 { 38 public: 39 /*! 40 * \brief Constructor 41 * 42 * Construct a Novatel. 43 * 44 * \param parent parent 45 * \param name name 46 * \param serialport serialport 47 * \param NMEAFlags NMEA sentances to enable 48 * \param priority priority of the Thread 49 */ 50 Novatel(const core::FrameworkManager* parent,std::string name,core::SerialPort *serialport,Gps::NMEAFlags_t NMEAFlags,uint8_t priority); 26 namespace flair { 27 namespace sensor { 28 /*! \class Novatel 29 * 30 * \brief Class for Novatel gps receiver 31 */ 32 class Novatel : public core::Thread, public Gps { 33 public: 34 /*! 35 * \brief Constructor 36 * 37 * Construct a Novatel. 38 * 39 * \param parent parent 40 * \param name name 41 * \param serialport serialport 42 * \param NMEAFlags NMEA sentances to enable 43 * \param priority priority of the Thread 44 */ 45 Novatel(const core::FrameworkManager *parent, std::string name, 46 core::SerialPort *serialport, Gps::NMEAFlags_t NMEAFlags, 47 uint8_t priority); 51 48 52 53 54 55 56 49 /*! 50 * \brief Destructor 51 * 52 */ 53 ~Novatel(); 57 54 58 59 60 61 62 63 64 65 66 55 private: 56 /*! 57 * \brief Update using provided datas 58 * 59 * Reimplemented from IODevice. 60 * 61 * \param data data from the parent to process 62 */ 63 void UpdateFrom(const core::io_data *data){}; 67 64 68 69 70 71 72 73 74 65 /*! 66 * \brief Run function 67 * 68 * Reimplemented from Thread. 69 * 70 */ 71 void Run(void); 75 72 76 77 78 73 core::SerialPort *serialport; 74 void Sync(void); 75 }; 79 76 } // end namespace sensor 80 77 } // end namespace framewor -
trunk/include/FlairSensorActuator/Ps3Eye.h
r4 r13 16 16 #include "V4LCamera.h" 17 17 18 namespace flair 19 { 20 namespace core 21 { 22 class cvimage; 23 class FrameworkManager; 24 } 25 namespace gui 26 { 27 class GridLayout; 28 class DoubleSpinBox; 29 class CheckBox; 30 } 18 namespace flair { 19 namespace core { 20 class cvimage; 21 class FrameworkManager; 22 } 23 namespace gui { 24 class GridLayout; 25 class DoubleSpinBox; 26 class CheckBox; 27 } 31 28 } 32 29 33 namespace flair 34 { 35 namespace sensor 36 { 37 /*! \class Ps3Eye 38 * 39 * \brief Class for Ps3Eye camera 40 */ 41 class Ps3Eye : public V4LCamera 42 { 30 namespace flair { 31 namespace sensor { 32 /*! \class Ps3Eye 33 * 34 * \brief Class for Ps3Eye camera 35 */ 36 class Ps3Eye : public V4LCamera { 43 37 44 public: 45 /*! 46 * \brief Constructor 47 * 48 * Construct a Ps3Eye. 49 * 50 * \param parent parent 51 * \param name name 52 * \param camera_index index of the camera, ie /dev/videox 53 * \param priority priority of the Thread 54 */ 55 Ps3Eye(const core::FrameworkManager* parent,std::string name,int camera_index,uint8_t priority); 38 public: 39 /*! 40 * \brief Constructor 41 * 42 * Construct a Ps3Eye. 43 * 44 * \param parent parent 45 * \param name name 46 * \param camera_index index of the camera, ie /dev/videox 47 * \param priority priority of the Thread 48 */ 49 Ps3Eye(const core::FrameworkManager *parent, std::string name, 50 int camera_index, uint8_t priority); 56 51 57 58 59 60 61 52 /*! 53 * \brief Destructor 54 * 55 */ 56 ~Ps3Eye(); 62 57 63 64 58 private: 59 }; 65 60 } // end namespace sensor 66 61 } // end namespace flair -
trunk/include/FlairSensorActuator/RadioReceiver.h
r4 r13 17 17 #include <stdint.h> 18 18 19 namespace flair 20 { 21 namespace core 22 { 23 class FrameworkManager; 24 class cvmatrix; 25 } 26 namespace gui 27 { 28 class Tab; 29 class TabWidget; 30 class Layout; 31 } 19 namespace flair { 20 namespace core { 21 class FrameworkManager; 22 class cvmatrix; 23 } 24 namespace gui { 25 class Tab; 26 class TabWidget; 27 class Layout; 28 } 32 29 } 33 30 34 namespace flair 35 { 36 namespace sensor 37 { 38 /*! \class RadioReceiver 39 * 40 * \brief Base class for radio receiver 41 */ 42 class RadioReceiver : public core::IODevice 43 { 44 public: 45 /*! 46 * \brief Constructor 47 * 48 * Construct a RadioReceiver. 49 * 50 * \param parent parent 51 * \param name name 52 * \param nb_channels number of supported channels 53 */ 54 RadioReceiver(const core::FrameworkManager* parent,std::string name,unsigned int nb_channels); 31 namespace flair { 32 namespace sensor { 33 /*! \class RadioReceiver 34 * 35 * \brief Base class for radio receiver 36 */ 37 class RadioReceiver : public core::IODevice { 38 public: 39 /*! 40 * \brief Constructor 41 * 42 * Construct a RadioReceiver. 43 * 44 * \param parent parent 45 * \param name name 46 * \param nb_channels number of supported channels 47 */ 48 RadioReceiver(const core::FrameworkManager *parent, std::string name, 49 unsigned int nb_channels); 55 50 56 57 58 59 60 51 /*! 52 * \brief Destructor 53 * 54 */ 55 ~RadioReceiver(); 61 56 62 63 64 65 66 67 68 69 57 /*! 58 * \brief get channel value 59 * 60 * \param id channel id 61 * \return value of the channel, between 0 and 1. 62 * Returns -1 if channel is out of bound 63 */ 64 float ChannelValue(unsigned int id) const; 70 65 71 72 73 74 75 76 66 /*! 67 * \brief Is transmitter connected? 68 * 69 * \return true if transmitter is connected 70 */ 71 bool IsConnected(void) const; 77 72 78 79 80 81 82 83 gui::Layout*GetLayout(void) const;73 /*! 74 * \brief Setup Layout 75 * 76 * \return a Layout available 77 */ 78 gui::Layout *GetLayout(void) const; 84 79 85 86 87 88 89 90 91 92 93 80 private: 81 /*! 82 * \brief Update using provided datas 83 * 84 * Reimplemented from IODevice. 85 * 86 * \param data data from the parent to process 87 */ 88 void UpdateFrom(const core::io_data *data){}; 94 89 95 96 97 98 gui::Tab*main_tab;99 gui::TabWidget*tab;100 gui::Tab*setup_tab;101 90 core::cvmatrix *output; 91 bool is_connected; 92 unsigned int nb_channels; 93 gui::Tab *main_tab; 94 gui::TabWidget *tab; 95 gui::Tab *setup_tab; 96 }; 102 97 } // end namespace sensor 103 98 } // end namespace flair -
trunk/include/FlairSensorActuator/SimuBldc.h
r4 r13 16 16 #include <Bldc.h> 17 17 18 namespace flair 19 { 20 namespace core 21 { 22 class SharedMem; 23 class IODevice; 24 class cvmatrix; 25 } 26 namespace gui 27 { 28 class DoubleSpinBox; 29 class Layout; 30 } 18 namespace flair { 19 namespace core { 20 class SharedMem; 21 class IODevice; 22 class cvmatrix; 23 } 24 namespace gui { 25 class DoubleSpinBox; 26 class Layout; 27 } 31 28 } 32 29 33 namespace flair 34 { 35 namespace actuator 36 { 37 /*! \class SimuBldc 38 * 39 * \brief Class for a simulation bldc 40 * 41 */ 42 class SimuBldc : public Bldc 43 { 44 public: 45 /*! 46 * \brief Constructor 47 * 48 * Construct a SimuBldc. Control part. 49 * 50 * \param parent parent 51 * \param layout layout 52 * \param name name 53 * \param motors_count number of motors 54 * \param dev_id device id 55 */ 56 SimuBldc(const core::IODevice* parent,gui::Layout* layout,std::string name,uint8_t motors_count,uint32_t dev_id); 30 namespace flair { 31 namespace actuator { 32 /*! \class SimuBldc 33 * 34 * \brief Class for a simulation bldc 35 * 36 */ 37 class SimuBldc : public Bldc { 38 public: 39 /*! 40 * \brief Constructor 41 * 42 * Construct a SimuBldc. Control part. 43 * 44 * \param parent parent 45 * \param layout layout 46 * \param name name 47 * \param motors_count number of motors 48 * \param dev_id device id 49 */ 50 SimuBldc(const core::IODevice *parent, gui::Layout *layout, std::string name, 51 uint8_t motors_count, uint32_t dev_id); 57 52 58 /*! 59 * \brief Constructor 60 * 61 * Construct a SimuBldc. Simulation part. 62 * 63 * \param parent parent 64 * \param name name 65 * \param motors_count number of motors 66 * \param dev_id device id 67 */ 68 SimuBldc(const core::Object* parent,std::string name,uint8_t motors_count,uint32_t dev_id); 53 /*! 54 * \brief Constructor 55 * 56 * Construct a SimuBldc. Simulation part. 57 * 58 * \param parent parent 59 * \param name name 60 * \param motors_count number of motors 61 * \param dev_id device id 62 */ 63 SimuBldc(const core::Object *parent, std::string name, uint8_t motors_count, 64 uint32_t dev_id); 69 65 70 71 72 73 74 66 /*! 67 * \brief Destructor 68 * 69 */ 70 ~SimuBldc(); 75 71 76 77 78 79 80 81 82 83 void GetSpeeds(float*value) const;72 /*! 73 * \brief Get motors speeds. 74 * 75 * This function should only be used for the simulation part. 76 * 77 * \param value array to store motors speeds 78 */ 79 void GetSpeeds(float *value) const; 84 80 85 86 87 88 89 90 91 92 bool HasSpeedMeasurement(void) const{return false;};81 /*! 82 * \brief Has speed measurement 83 * 84 * Reimplemented from Bldc. \n 85 * 86 * \return true if it has speed measurement 87 */ 88 bool HasSpeedMeasurement(void) const { return false; }; 93 89 94 95 96 97 98 99 100 101 bool HasCurrentMeasurement(void) const{return false;};90 /*! 91 * \brief Has current measurement 92 * 93 * Reimplemented from Bldc. \n 94 * 95 * \return true if it has current measurement 96 */ 97 bool HasCurrentMeasurement(void) const { return false; }; 102 98 103 104 105 106 107 108 109 110 111 112 void SetMotors(float*value);99 private: 100 /*! 101 * \brief Set motors values 102 * 103 * Reimplemented from Bldc. \n 104 * Values size must be the same as MotorsCount() 105 * 106 * \param values motor values 107 */ 108 void SetMotors(float *value); 113 109 114 115 116 110 core::SharedMem *shmem; 111 gui::DoubleSpinBox *k; 112 }; 117 113 } // end namespace actuator 118 114 } // end namespace flair -
trunk/include/FlairSensorActuator/SimuCamera.h
r4 r13 18 18 #include <cxcore.h> 19 19 20 namespace flair 21 { 22 namespace core 23 { 24 class SharedMem; 25 } 26 namespace gui 27 { 28 class SpinBox; 29 } 20 namespace flair { 21 namespace core { 22 class SharedMem; 23 } 24 namespace gui { 25 class SpinBox; 26 } 30 27 } 31 28 32 namespace flair 33 { 34 namespace sensor 35 { 36 /*! \class SimuCamera 37 * 38 * \brief Class for a simulation camera 39 */ 40 class SimuCamera : public core::Thread, public Camera 41 { 42 public: 43 /*! 44 * \brief Constructor 45 * 46 * Construct a SimuCamera. Control part. 47 * 48 * \param parent parent 49 * \param name name 50 * \param width width 51 * \param height height 52 * \param channels number of channels 53 * \param dev_id device id 54 * \param priority priority of the Thread 55 */ 56 SimuCamera(const core::FrameworkManager* parent,std::string name,uint16_t width,uint16_t height,uint8_t channels,uint32_t dev_id,uint8_t priority); 29 namespace flair { 30 namespace sensor { 31 /*! \class SimuCamera 32 * 33 * \brief Class for a simulation camera 34 */ 35 class SimuCamera : public core::Thread, public Camera { 36 public: 37 /*! 38 * \brief Constructor 39 * 40 * Construct a SimuCamera. Control part. 41 * 42 * \param parent parent 43 * \param name name 44 * \param width width 45 * \param height height 46 * \param channels number of channels 47 * \param dev_id device id 48 * \param priority priority of the Thread 49 */ 50 SimuCamera(const core::FrameworkManager *parent, std::string name, 51 uint16_t width, uint16_t height, uint8_t channels, uint32_t dev_id, 52 uint8_t priority); 57 53 58 /*! 59 * \brief Constructor 60 * 61 * Construct a SimuCamera. Simulation part.\n 62 * The Thread of this class should not be run. 63 * 64 * \param parent parent 65 * \param name name 66 * \param width width 67 * \param height height 68 * \param channels number of channels 69 * \param dev_id device id 70 */ 71 SimuCamera(const core::IODevice* parent,std::string name,uint16_t width,uint16_t height,uint8_t channels,uint32_t dev_id); 54 /*! 55 * \brief Constructor 56 * 57 * Construct a SimuCamera. Simulation part.\n 58 * The Thread of this class should not be run. 59 * 60 * \param parent parent 61 * \param name name 62 * \param width width 63 * \param height height 64 * \param channels number of channels 65 * \param dev_id device id 66 */ 67 SimuCamera(const core::IODevice *parent, std::string name, uint16_t width, 68 uint16_t height, uint8_t channels, uint32_t dev_id); 72 69 73 74 75 76 77 70 /*! 71 * \brief Destructor 72 * 73 */ 74 ~SimuCamera(); 78 75 79 80 81 82 83 84 76 protected: 77 /*! 78 * \brief SharedMem to access datas 79 * 80 */ 81 core::SharedMem *shmem; 85 82 86 87 88 89 90 91 92 93 83 private: 84 /*! 85 * \brief Run function 86 * 87 * Reimplemented from Thread. 88 * 89 */ 90 void Run(void); 94 91 95 96 97 98 99 100 101 102 92 /*! 93 * \brief Update using provided datas 94 * 95 * Reimplemented from IODevice. 96 * 97 * \param data data from the parent to process 98 */ 99 void UpdateFrom(const core::io_data *data){}; 103 100 104 105 106 IplImage*img;107 101 gui::SpinBox *data_rate; 102 size_t buf_size; 103 IplImage *img; 104 }; 108 105 } // end namespace sensor 109 106 } // end namespace flair -
trunk/include/FlairSensorActuator/SimuGps.h
r4 r13 17 17 #include <Gps.h> 18 18 19 namespace flair 20 { 21 namespace core 22 { 23 class FrameworkManager; 24 } 19 namespace flair { 20 namespace core { 21 class FrameworkManager; 22 } 25 23 } 26 24 27 namespace flair 28 { 29 namespace sensor 30 { 31 /*! \class SimuGps 32 * 33 * \brief Class for a simulation GPS 34 */ 35 class SimuGps : public core::Thread, public Gps 36 { 37 public: 38 /*! 39 * \brief Constructor 40 * 41 * Construct a Novatel. 42 * 43 * \param parent parent 44 * \param name name 45 * \param NMEAFlags NMEA sentances to enable 46 * \param priority priority of the Thread 47 */ 48 SimuGps(const core::FrameworkManager* parent,std::string name,Gps::NMEAFlags_t NMEAFlags,uint8_t priority); 25 namespace flair { 26 namespace sensor { 27 /*! \class SimuGps 28 * 29 * \brief Class for a simulation GPS 30 */ 31 class SimuGps : public core::Thread, public Gps { 32 public: 33 /*! 34 * \brief Constructor 35 * 36 * Construct a Novatel. 37 * 38 * \param parent parent 39 * \param name name 40 * \param NMEAFlags NMEA sentances to enable 41 * \param priority priority of the Thread 42 */ 43 SimuGps(const core::FrameworkManager *parent, std::string name, 44 Gps::NMEAFlags_t NMEAFlags, uint8_t priority); 49 45 50 51 52 53 54 46 /*! 47 * \brief Destructor 48 * 49 */ 50 ~SimuGps(); 55 51 56 57 58 59 60 61 62 63 64 52 private: 53 /*! 54 * \brief Update using provided datas 55 * 56 * Reimplemented from IODevice. 57 * 58 * \param data data from the parent to process 59 */ 60 void UpdateFrom(const core::io_data *data){}; 65 61 66 67 68 69 70 71 72 73 62 /*! 63 * \brief Run function 64 * 65 * Reimplemented from Thread. 66 * 67 */ 68 void Run(void); 69 }; 74 70 } // end namespace sensor 75 71 } // end namespace framewor -
trunk/include/FlairSensorActuator/SimuImu.h
r4 r13 18 18 19 19 namespace flair { 20 namespace core{21 22 23 24 25 26 20 namespace core { 21 class SharedMem; 22 class AhrsData; 23 } 24 namespace gui { 25 class SpinBox; 26 } 27 27 } 28 28 29 namespace flair { namespace sensor { 30 /*! \class SimuImu 31 * 32 * \brief Class for a simulation Imu 33 */ 34 class SimuImu : public Imu, public core::Thread { 35 public: 36 /*! 37 * \brief Constructor 38 * 39 * Construct a SimuImu. Control part. 40 * 41 * \param parent parent 42 * \param name name 43 * \param dev_id device id 44 * \param priority priority of the Thread 45 */ 46 SimuImu(const core::FrameworkManager* parent,std::string name,uint32_t dev_id,uint8_t priority); 29 namespace flair { 30 namespace sensor { 31 /*! \class SimuImu 32 * 33 * \brief Class for a simulation Imu 34 */ 35 class SimuImu : public Imu, public core::Thread { 36 public: 37 /*! 38 * \brief Constructor 39 * 40 * Construct a SimuImu. Control part. 41 * 42 * \param parent parent 43 * \param name name 44 * \param dev_id device id 45 * \param priority priority of the Thread 46 */ 47 SimuImu(const core::FrameworkManager *parent, std::string name, 48 uint32_t dev_id, uint8_t priority); 47 49 48 49 50 51 52 53 54 55 56 57 58 SimuImu(const core::IODevice* parent,std::string name,uint32_t dev_id);50 /*! 51 * \brief Constructor 52 * 53 * Construct a SimuImu. Simulation part.\n 54 * The Thread of this class should not be run. 55 * 56 * \param parent parent 57 * \param name name 58 * \param dev_id device id 59 */ 60 SimuImu(const core::IODevice *parent, std::string name, uint32_t dev_id); 59 61 60 61 62 63 64 62 /*! 63 * \brief Destructor 64 * 65 */ 66 ~SimuImu(); 65 67 66 67 68 69 70 71 72 73 68 private: 69 /*! 70 * \brief Run function 71 * 72 * Reimplemented from Thread. 73 * 74 */ 75 void Run(void); 74 76 75 76 77 78 79 80 81 82 77 /*! 78 * \brief Update using provided datas 79 * 80 * Reimplemented from IODevice. 81 * 82 * \param data data from the parent to process 83 */ 84 void UpdateFrom(const core::io_data *data); 83 85 84 85 86 87 88 89 90 91 92 93 94 95 96 86 typedef struct { 87 float q0; 88 float q1; 89 float q2; 90 float q3; 91 float wx; 92 float wy; 93 float wz; 94 } imu_states_t; 95 gui::SpinBox *data_rate; 96 core::SharedMem *shmem; 97 core::AhrsData *ahrsData; 98 }; 97 99 } // end namespace sensor 98 100 } // end namespace flair -
trunk/include/FlairSensorActuator/SimuLaser.h
r4 r13 17 17 #include <Thread.h> 18 18 19 namespace flair 20 { 21 namespace core 22 { 23 class SharedMem; 24 } 25 namespace gui 26 { 27 class SpinBox; 28 } 19 namespace flair { 20 namespace core { 21 class SharedMem; 22 } 23 namespace gui { 24 class SpinBox; 25 } 29 26 } 30 27 31 namespace flair 32 { 33 namespace sensor 34 { 35 /*! \class SimuUs 36 * 37 * \brief Class for a simulation UsRangeFinder 38 */ 39 class SimuLaser : public core::Thread, public LaserRangeFinder 40 { 41 public: 42 /*! 43 * \brief Constructor 44 * 45 * Construct a SimuUs. Control part. 46 * 47 * \param parent parent 48 * \param name name 49 * \param dev_id device id 50 * \param priority priority of the Thread 51 */ 52 SimuLaser(const core::FrameworkManager* parent,std::string name,uint32_t dev_id,uint8_t priority); 28 namespace flair { 29 namespace sensor { 30 /*! \class SimuUs 31 * 32 * \brief Class for a simulation UsRangeFinder 33 */ 34 class SimuLaser : public core::Thread, public LaserRangeFinder { 35 public: 36 /*! 37 * \brief Constructor 38 * 39 * Construct a SimuUs. Control part. 40 * 41 * \param parent parent 42 * \param name name 43 * \param dev_id device id 44 * \param priority priority of the Thread 45 */ 46 SimuLaser(const core::FrameworkManager *parent, std::string name, 47 uint32_t dev_id, uint8_t priority); 53 48 54 55 56 57 58 59 60 61 62 63 64 SimuLaser(const core::IODevice* parent,std::string name,uint32_t dev_id);49 /*! 50 * \brief Constructor 51 * 52 * Construct a SimuUs. Simulation part.\n 53 * The Thread of this class should not be run. 54 * 55 * \param parent parent 56 * \param name name 57 * \param dev_id device id 58 */ 59 SimuLaser(const core::IODevice *parent, std::string name, uint32_t dev_id); 65 60 66 67 68 69 70 61 /*! 62 * \brief Destructor 63 * 64 */ 65 ~SimuLaser(); 71 66 72 73 74 75 76 77 67 protected: 68 /*! 69 * \brief SharedMem to access datas 70 * 71 */ 72 core::SharedMem *shmem; 78 73 79 80 81 82 83 84 85 86 87 74 private: 75 /*! 76 * \brief Update using provided datas 77 * 78 * Reimplemented from IODevice. 79 * 80 * \param data data from the parent to process 81 */ 82 void UpdateFrom(const core::io_data *data){}; 88 83 89 90 91 92 93 94 95 84 /*! 85 * \brief Run function 86 * 87 * Reimplemented from Thread. 88 * 89 */ 90 void Run(void); 96 91 97 98 92 gui::SpinBox *data_rate; 93 }; 99 94 } // end namespace sensor 100 95 } // end namespace flair -
trunk/include/FlairSensorActuator/SimuUs.h
r4 r13 17 17 #include <Thread.h> 18 18 19 namespace flair 20 { 21 namespace core 22 { 23 class SharedMem; 24 } 25 namespace gui 26 { 27 class SpinBox; 28 } 19 namespace flair { 20 namespace core { 21 class SharedMem; 22 } 23 namespace gui { 24 class SpinBox; 25 } 29 26 } 30 27 31 namespace flair 32 { 33 namespace sensor 34 { 35 /*! \class SimuUs 36 * 37 * \brief Class for a simulation UsRangeFinder 38 */ 39 class SimuUs : public core::Thread, public UsRangeFinder 40 { 41 public: 42 /*! 43 * \brief Constructor 44 * 45 * Construct a SimuUs. Control part. 46 * 47 * \param parent parent 48 * \param name name 49 * \param dev_id device id 50 * \param priority priority of the Thread 51 */ 52 SimuUs(const core::FrameworkManager* parent,std::string name,uint32_t dev_id,uint8_t priority); 28 namespace flair { 29 namespace sensor { 30 /*! \class SimuUs 31 * 32 * \brief Class for a simulation UsRangeFinder 33 */ 34 class SimuUs : public core::Thread, public UsRangeFinder { 35 public: 36 /*! 37 * \brief Constructor 38 * 39 * Construct a SimuUs. Control part. 40 * 41 * \param parent parent 42 * \param name name 43 * \param dev_id device id 44 * \param priority priority of the Thread 45 */ 46 SimuUs(const core::FrameworkManager *parent, std::string name, 47 uint32_t dev_id, uint8_t priority); 53 48 54 55 56 57 58 59 60 61 62 63 64 SimuUs(const core::IODevice* parent,std::string name,uint32_t dev_id);49 /*! 50 * \brief Constructor 51 * 52 * Construct a SimuUs. Simulation part.\n 53 * The Thread of this class should not be run. 54 * 55 * \param parent parent 56 * \param name name 57 * \param dev_id device id 58 */ 59 SimuUs(const core::IODevice *parent, std::string name, uint32_t dev_id); 65 60 66 67 68 69 70 61 /*! 62 * \brief Destructor 63 * 64 */ 65 ~SimuUs(); 71 66 72 73 74 75 76 77 67 protected: 68 /*! 69 * \brief SharedMem to access datas 70 * 71 */ 72 core::SharedMem *shmem; 78 73 79 80 81 82 83 84 85 86 87 74 private: 75 /*! 76 * \brief Update using provided datas 77 * 78 * Reimplemented from IODevice. 79 * 80 * \param data data from the parent to process 81 */ 82 void UpdateFrom(const core::io_data *data){}; 88 83 89 90 91 92 93 94 95 84 /*! 85 * \brief Run function 86 * 87 * Reimplemented from Thread. 88 * 89 */ 90 void Run(void); 96 91 97 98 92 gui::SpinBox *data_rate; 93 }; 99 94 } // end namespace sensor 100 95 } // end namespace flair -
trunk/include/FlairSensorActuator/Srf08.h
r4 r13 17 17 #include <UsRangeFinder.h> 18 18 19 namespace flair 20 { 21 namespace core 22 { 23 class FrameworkManager; 24 class I2cPort; 25 } 26 namespace gui 27 { 28 class SpinBox;; 29 } 19 namespace flair { 20 namespace core { 21 class FrameworkManager; 22 class I2cPort; 23 } 24 namespace gui { 25 class SpinBox; 26 ; 27 } 30 28 } 31 29 32 namespace flair 33 { 34 namespace sensor 35 { 36 /*! \class Srf08 37 * 38 * \brief Class for ultra sonic SRF08 39 */ 40 class Srf08 : public core::Thread, public UsRangeFinder 41 { 30 namespace flair { 31 namespace sensor { 32 /*! \class Srf08 33 * 34 * \brief Class for ultra sonic SRF08 35 */ 36 class Srf08 : public core::Thread, public UsRangeFinder { 42 37 43 public: 44 /*! 45 * \brief Constructor 46 * 47 * Construct a SimuUs. Control part. 48 * 49 * \param parent parent 50 * \param name name 51 * \param i2cport i2c port 52 * \param address i2c slave address 53 * \param priority priority of the Thread 54 */ 55 Srf08(const core::FrameworkManager* parent,std::string name,core::I2cPort* i2cport,uint16_t address,uint8_t priority); 38 public: 39 /*! 40 * \brief Constructor 41 * 42 * Construct a SimuUs. Control part. 43 * 44 * \param parent parent 45 * \param name name 46 * \param i2cport i2c port 47 * \param address i2c slave address 48 * \param priority priority of the Thread 49 */ 50 Srf08(const core::FrameworkManager *parent, std::string name, 51 core::I2cPort *i2cport, uint16_t address, uint8_t priority); 56 52 57 58 59 60 61 53 /*! 54 * \brief Destructor 55 * 56 */ 57 ~Srf08(); 62 58 63 64 65 66 67 68 59 /*! 60 * \brief Set Range 61 * 62 * check datasheet for values 63 */ 64 void SetRange(void); 69 65 70 71 72 73 74 75 66 /*! 67 * \brief Set Max Gain 68 * 69 * check datasheet for values 70 */ 71 void SetMaxGain(void); 76 72 77 78 79 80 81 82 83 84 85 73 private: 74 /*! 75 * \brief Update using provided datas 76 * 77 * Reimplemented from IODevice. 78 * 79 * \param data data from the parent to process 80 */ 81 void UpdateFrom(const core::io_data *data){}; 86 82 87 88 89 90 91 92 93 83 /*! 84 * \brief Run function 85 * 86 * Reimplemented from Thread. 87 * 88 */ 89 void Run(void); 94 90 95 96 91 void SendEcho(void); 92 void GetEcho(void); 97 93 98 99 100 float z_1,z_2;101 gui::SpinBox *gain,*range;102 103 core::I2cPort*i2cport;104 94 bool is_init; 95 core::Time echo_time; 96 float z_1, z_2; 97 gui::SpinBox *gain, *range; 98 uint16_t address; 99 core::I2cPort *i2cport; 100 }; 105 101 } // end namespace sensor 106 102 } // end namespace flair -
trunk/include/FlairSensorActuator/TargetController.h
r4 r13 25 25 26 26 namespace flair { 27 28 29 30 31 32 33 34 35 36 37 27 namespace core { 28 class FrameworkManager; 29 class cvmatrix; 30 class Socket; 31 class io_data; 32 } 33 namespace gui { 34 class Tab; 35 class TabWidget; 36 class DataPlot1D; 37 } 38 38 } 39 39 40 namespace flair { namespace sensor { 41 enum class ControllerAction; 40 namespace flair { 41 namespace sensor { 42 enum class ControllerAction; 42 43 43 /*! \class TargetController 44 * 45 * \brief Base Class for target side remote controls 46 * 47 */ 48 class TargetController : public core::Thread, public core::IODevice { 49 public: 50 TargetController(const core::FrameworkManager* parent,std::string name,uint8_t priority=0); 51 ~TargetController(); 52 //void DrawUserInterface(); 53 virtual bool IsConnected() const=0; 54 virtual bool IsDataFrameReady()=0; 55 //axis stuff 56 unsigned int GetAxisNumber() const; 57 virtual std::string GetAxisName(unsigned int axisId) const; 58 float GetAxisValue(unsigned int axisId) const;// always in the range [-1.0,1.0] 59 //button stuff 60 unsigned int GetButtonNumber() const; 61 bool IsButtonPressed(unsigned int buttonId) const; 62 virtual std::string GetButtonName(unsigned int axisId) const; 63 //controller state stuff 64 virtual bool IsControllerActionSupported(ControllerAction action) const {return false;}; 65 bool SetLedOn(unsigned int ledId); 66 bool SetLedOff(unsigned int ledId); 67 bool Rumble(unsigned int left_force,unsigned int left_timeout,unsigned int right_force,unsigned int right_timeout); 68 bool FlashLed(unsigned int ledId,unsigned int on_timeout,unsigned int off_timeout); 69 void UpdateFrom(const core::io_data *data){}; //TODO 70 gui::Tab* GetTab(void) const; 44 /*! \class TargetController 45 * 46 * \brief Base Class for target side remote controls 47 * 48 */ 49 class TargetController : public core::Thread, public core::IODevice { 50 public: 51 TargetController(const core::FrameworkManager *parent, std::string name, 52 uint8_t priority = 0); 53 ~TargetController(); 54 // void DrawUserInterface(); 55 virtual bool IsConnected() const = 0; 56 virtual bool IsDataFrameReady() = 0; 57 // axis stuff 58 unsigned int GetAxisNumber() const; 59 virtual std::string GetAxisName(unsigned int axisId) const; 60 float 61 GetAxisValue(unsigned int axisId) const; // always in the range [-1.0,1.0] 62 // button stuff 63 unsigned int GetButtonNumber() const; 64 bool IsButtonPressed(unsigned int buttonId) const; 65 virtual std::string GetButtonName(unsigned int axisId) const; 66 // controller state stuff 67 virtual bool IsControllerActionSupported(ControllerAction action) const { 68 return false; 69 }; 70 bool SetLedOn(unsigned int ledId); 71 bool SetLedOff(unsigned int ledId); 72 bool Rumble(unsigned int left_force, unsigned int left_timeout, 73 unsigned int right_force, unsigned int right_timeout); 74 bool FlashLed(unsigned int ledId, unsigned int on_timeout, 75 unsigned int off_timeout); 76 void UpdateFrom(const core::io_data *data){}; // TODO 77 gui::Tab *GetTab(void) const; 71 78 72 protected: 73 virtual bool ProcessMessage(core::Message *msg)=0; 74 void QueueMessage(core::Message msg); 75 virtual bool ControllerInitialization()=0;// {return true;}; 76 //axis stuff 77 unsigned int axisNumber; 78 core::cvmatrix* axis=NULL; 79 virtual void AcquireAxisData(core::cvmatrix &axis)=0; //responsible for getting the axis data from the hardware 80 uint16_t bitsPerAxis; 81 //button stuff 82 unsigned int buttonNumber; 83 core::cvmatrix* button=NULL; 84 virtual void AcquireButtonData(core::cvmatrix &button)=0; //responsible for getting the button data from the hardware 85 //controller state stuff 86 unsigned int ledNumber; 87 private: 88 void Run(); 89 std::queue<core::Message *> changeStateQueue; 90 flair::gui::Tab* main_tab; 91 flair::gui::Tab* setup_tab; 92 }; 79 protected: 80 virtual bool ProcessMessage(core::Message *msg) = 0; 81 void QueueMessage(core::Message msg); 82 virtual bool ControllerInitialization() = 0; // {return true;}; 83 // axis stuff 84 unsigned int axisNumber; 85 core::cvmatrix *axis = NULL; 86 virtual void AcquireAxisData(core::cvmatrix &axis) = 0; // responsible for 87 // getting the axis 88 // data from the 89 // hardware 90 uint16_t bitsPerAxis; 91 // button stuff 92 unsigned int buttonNumber; 93 core::cvmatrix *button = NULL; 94 virtual void AcquireButtonData(core::cvmatrix &button) = 0; // responsible for 95 // getting the 96 // button data 97 // from the 98 // hardware 99 // controller state stuff 100 unsigned int ledNumber; 93 101 94 }} 102 private: 103 void Run(); 104 std::queue<core::Message *> changeStateQueue; 105 flair::gui::Tab *main_tab; 106 flair::gui::Tab *setup_tab; 107 }; 108 } 109 } 95 110 96 111 #endif // TARGETCONTROLLER_H -
trunk/include/FlairSensorActuator/TargetEthController.h
r4 r13 12 12 // 13 13 // purpose: class that gets remote controls through an ethernet connection. 14 // Typical use case: a remote control is plugged in a workstation and sends remote control 14 // Typical use case: a remote control is plugged in a workstation 15 // and sends remote control 15 16 // data to a distant target (this class) through Wifi 16 17 // … … 24 25 25 26 namespace flair { 26 27 28 29 30 31 32 33 34 35 36 27 namespace core { 28 class FrameworkManager; 29 class cvmatrix; 30 class TcpSocket; 31 class Socket; 32 } 33 namespace gui { 34 class Tab; 35 class TabWidget; 36 class DataPlot1D; 37 } 37 38 } 38 39 39 namespace flair { namespace sensor { 40 /*! \class TargetController 41 * 42 * \brief Base Class for target side remote controls 43 * 44 */ 45 class TargetEthController : public TargetController { 46 public: 47 TargetEthController(const core::FrameworkManager* parent,std::string name,uint16_t port,uint8_t priority=0); 48 ~TargetEthController(); 49 //void DrawUserInterface(); 50 protected: 51 bool IsConnected() const; 52 //axis stuff 53 std::string GetAxisName(unsigned int axisId) const; 54 //button stuff 55 std::string GetButtonName(unsigned int axisId) const; 56 //controller state stuff 57 bool ProcessMessage(core::Message *msg); 58 bool IsControllerActionSupported(ControllerAction action) const; 40 namespace flair { 41 namespace sensor { 42 /*! \class TargetController 43 * 44 * \brief Base Class for target side remote controls 45 * 46 */ 47 class TargetEthController : public TargetController { 48 public: 49 TargetEthController(const core::FrameworkManager *parent, std::string name, 50 uint16_t port, uint8_t priority = 0); 51 ~TargetEthController(); 52 // void DrawUserInterface(); 53 protected: 54 bool IsConnected() const; 55 // axis stuff 56 std::string GetAxisName(unsigned int axisId) const; 57 // button stuff 58 std::string GetButtonName(unsigned int axisId) const; 59 // controller state stuff 60 bool ProcessMessage(core::Message *msg); 61 bool IsControllerActionSupported(ControllerAction action) const; 59 62 60 bool IsDataFrameReady(); 61 void AcquireAxisData(core::cvmatrix &axis); //responsible for getting the axis data from the hardware 62 void AcquireButtonData(core::cvmatrix &button); //responsible for getting the button data from the hardware 63 bool IsDataFrameReady(); 64 void AcquireAxisData(core::cvmatrix &axis); // responsible for getting the 65 // axis data from the hardware 66 void AcquireButtonData(core::cvmatrix &button); // responsible for getting the 67 // button data from the 68 // hardware 63 69 64 70 bool ControllerInitialization(); 65 71 66 private: 67 uint16_t readBits(uint8_t offsetInBits,uint8_t valueSizeInBits,char *buffer,size_t bufferSize); 68 uint8_t getByteOrNull(char *buffer,int byte,size_t bufferSize); 69 uint32_t charBufferToUint32(char *buffer, size_t bufferSize); 70 core::TcpSocket *listeningSocket; 71 int listeningPort; 72 core::TcpSocket *controlSocket=NULL; 73 core::Socket *dataSocket; 74 std::string *axisName=NULL; 75 std::string *buttonName=NULL; 76 size_t dataFrameSize; 77 char *dataFrameBuffer; 78 char *receiveFrameBuffer; 79 size_t receiveCurrentPosition; 80 uint8_t buttonOffset; 81 }; 82 83 }} 72 private: 73 uint16_t readBits(uint8_t offsetInBits, uint8_t valueSizeInBits, char *buffer, 74 size_t bufferSize); 75 uint8_t getByteOrNull(char *buffer, int byte, size_t bufferSize); 76 uint32_t charBufferToUint32(char *buffer, size_t bufferSize); 77 core::TcpSocket *listeningSocket; 78 int listeningPort; 79 core::TcpSocket *controlSocket = NULL; 80 core::Socket *dataSocket; 81 std::string *axisName = NULL; 82 std::string *buttonName = NULL; 83 size_t dataFrameSize; 84 char *dataFrameBuffer; 85 char *receiveFrameBuffer; 86 size_t receiveCurrentPosition; 87 uint8_t buttonOffset; 88 }; 89 } 90 } 84 91 85 92 #endif // TARGETCONTROLLER_H -
trunk/include/FlairSensorActuator/UsRangeFinder.h
r4 r13 16 16 #include <IODevice.h> 17 17 18 namespace flair 19 { 20 namespace core 21 { 22 class cvmatrix; 23 } 24 namespace gui 25 { 26 class Tab; 27 class TabWidget; 28 class GroupBox; 29 class Layout; 30 class DataPlot1D; 31 } 18 namespace flair { 19 namespace core { 20 class cvmatrix; 21 } 22 namespace gui { 23 class Tab; 24 class TabWidget; 25 class GroupBox; 26 class Layout; 27 class DataPlot1D; 28 } 32 29 } 33 30 34 namespace flair 35 { 36 namespace sensor 37 { 38 /*! \class UsRangeFinder 39 * 40 * \brief Base class for UsRangeFinder 41 * 42 * Use this class to define a custom UsRangeFinder. 43 * 44 */ 45 class UsRangeFinder : public core::IODevice 46 { 47 public: 48 /*! 49 * \brief Constructor 50 * 51 * Construct a UsRangeFinder. Control part. 52 * 53 * \param parent parent 54 * \param name name 55 */ 56 UsRangeFinder(const core::FrameworkManager* parent,std::string name); 31 namespace flair { 32 namespace sensor { 33 /*! \class UsRangeFinder 34 * 35 * \brief Base class for UsRangeFinder 36 * 37 * Use this class to define a custom UsRangeFinder. 38 * 39 */ 40 class UsRangeFinder : public core::IODevice { 41 public: 42 /*! 43 * \brief Constructor 44 * 45 * Construct a UsRangeFinder. Control part. 46 * 47 * \param parent parent 48 * \param name name 49 */ 50 UsRangeFinder(const core::FrameworkManager *parent, std::string name); 57 51 58 59 60 61 62 63 64 65 66 UsRangeFinder(const core::IODevice* parent,std::string name);52 /*! 53 * \brief Constructor 54 * 55 * Construct a UsRangeFinder. Simulation part. 56 * 57 * \param parent parent 58 * \param name name 59 */ 60 UsRangeFinder(const core::IODevice *parent, std::string name); 67 61 68 69 70 71 72 62 /*! 63 * \brief Destructor 64 * 65 */ 66 ~UsRangeFinder(); 73 67 74 75 76 77 78 68 /*! 69 * \brief Lock user interface 70 * 71 */ 72 void LockUserInterface(void) const; 79 73 80 81 82 83 84 74 /*! 75 * \brief Unlock user interface 76 * 77 */ 78 void UnlockUserInterface(void) const; 85 79 86 87 88 89 90 91 80 /*! 81 * \brief Use default plot 82 * 83 * Should no be used for the simulation part. 84 */ 85 void UseDefaultPlot(void); 92 86 93 94 95 96 97 98 gui::DataPlot1D*GetPlot(void) const;87 /*! 88 * \brief Plot 89 * 90 * \return DataPlot1D 91 */ 92 gui::DataPlot1D *GetPlot(void) const; 99 93 100 101 102 103 104 105 gui::Layout*GetLayout(void) const;94 /*! 95 * \brief Setup Layout 96 * 97 * \return a Layout available 98 */ 99 gui::Layout *GetLayout(void) const; 106 100 107 108 109 110 111 112 gui::Tab*GetPlotTab(void) const;101 /*! 102 * \brief Plot tab 103 * 104 * \return plot Tab 105 */ 106 gui::Tab *GetPlotTab(void) const; 113 107 114 115 116 117 118 119 108 /*! 109 * \brief Value 110 * 111 * \return output value 112 */ 113 float Value(void) const; 120 114 121 122 123 124 125 126 127 115 protected: 116 /*! 117 * \brief Output matrix 118 * 119 * \return output matrix 120 */ 121 core::cvmatrix *output; 128 122 129 130 131 132 133 134 gui::GroupBox*GetGroupBox(void) const;123 /*! 124 * \brief Setup GroupBox 125 * 126 * \return a GroupBox available 127 */ 128 gui::GroupBox *GetGroupBox(void) const; 135 129 136 137 138 139 140 141 142 143 144 130 private: 131 /*! 132 * \brief Update using provided datas 133 * 134 * Reimplemented from IODevice. 135 * 136 * \param data data from the parent to process 137 */ 138 void UpdateFrom(const core::io_data *data){}; 145 139 146 gui::Tab*main_tab;147 148 gui::GroupBox*setup_groupbox;149 gui::Tab*sensor_tab;150 gui::DataPlot1D*plot;151 gui::Tab*plot_tab;152 140 gui::Tab *main_tab; 141 gui::TabWidget *tab; 142 gui::GroupBox *setup_groupbox; 143 gui::Tab *sensor_tab; 144 gui::DataPlot1D *plot; 145 gui::Tab *plot_tab; 146 }; 153 147 } // end namespace sensor 154 148 } // end namespace flair -
trunk/include/FlairSensorActuator/V4LCamera.h
r4 r13 18 18 #include <highgui.h> 19 19 20 namespace flair 21 { 22 namespace core 23 { 24 class cvimage; 25 class FrameworkManager; 26 } 27 namespace gui 28 { 29 class GridLayout; 30 class DoubleSpinBox; 31 class CheckBox; 32 class Label; 33 } 20 namespace flair { 21 namespace core { 22 class cvimage; 23 class FrameworkManager; 24 } 25 namespace gui { 26 class GridLayout; 27 class DoubleSpinBox; 28 class CheckBox; 29 class Label; 30 } 34 31 } 35 32 36 namespace flair 37 { 38 namespace sensor 39 { 40 /*! \class V4LCamera 41 * 42 * \brief Base class for V4l camera 43 */ 44 class V4LCamera : public core::Thread, public Camera 45 { 46 public: 47 /*! 48 * \brief Constructor 49 * 50 * Construct a Camera. 51 * 52 * \param parent parent 53 * \param name name 54 * \param camera_index camera index 55 * \param width width 56 * \param height height 57 * \param format image format 58 * \param priority priority of the Thread 59 */ 60 V4LCamera(const core::FrameworkManager* parent,std::string name,uint8_t camera_index,uint16_t width,uint16_t height,core::cvimage::Type::Format format,uint8_t priority); 33 namespace flair { 34 namespace sensor { 35 /*! \class V4LCamera 36 * 37 * \brief Base class for V4l camera 38 */ 39 class V4LCamera : public core::Thread, public Camera { 40 public: 41 /*! 42 * \brief Constructor 43 * 44 * Construct a Camera. 45 * 46 * \param parent parent 47 * \param name name 48 * \param camera_index camera index 49 * \param width width 50 * \param height height 51 * \param format image format 52 * \param priority priority of the Thread 53 */ 54 V4LCamera(const core::FrameworkManager *parent, std::string name, 55 uint8_t camera_index, uint16_t width, uint16_t height, 56 core::cvimage::Type::Format format, uint8_t priority); 61 57 62 63 64 65 66 58 /*! 59 * \brief Destructor 60 * 61 */ 62 ~V4LCamera(); 67 63 68 69 70 71 72 73 74 64 protected: 65 /*! 66 * \brief Set Gain 67 * 68 * \param value value between 0 and 1 69 */ 70 virtual void SetGain(float value); 75 71 76 77 78 79 80 81 72 /*! 73 * \brief Set Auto Gain 74 * 75 * \param value value 76 */ 77 virtual void SetAutoGain(bool value); 82 78 83 84 85 86 87 88 79 /*! 80 * \brief Set Exposure 81 * 82 * \param value value between 0 and 1 83 */ 84 virtual void SetExposure(float value); 89 85 90 91 92 93 94 95 86 /*! 87 * \brief Set Auto Exposure 88 * 89 * \param value value 90 */ 91 virtual void SetAutoExposure(bool value); 96 92 97 98 99 100 101 102 93 /*! 94 * \brief Set Brightness 95 * 96 * \param value value between 0 and 1 97 */ 98 virtual void SetBrightness(float value); 103 99 104 105 106 107 108 109 100 /*! 101 * \brief Set Saturation 102 * 103 * \param value value between 0 and 1 104 */ 105 virtual void SetSaturation(float value); 110 106 111 112 113 114 115 116 107 /*! 108 * \brief Set Hue 109 * 110 * \param value value between 0 and 1 111 */ 112 virtual void SetHue(float value); 117 113 118 119 120 121 122 123 114 /*! 115 * \brief Set Contrast 116 * 117 * \param value value between 0 and 1 118 */ 119 virtual void SetContrast(float value); 124 120 125 126 127 128 129 130 131 132 133 121 private: 122 /*! 123 * \brief Update using provided datas 124 * 125 * Reimplemented from IODevice. 126 * 127 * \param data data from the parent to process 128 */ 129 void UpdateFrom(const core::io_data *data){}; 134 130 135 136 137 138 139 140 141 131 /*! 132 * \brief Run function 133 * 134 * Reimplemented from Thread. 135 * 136 */ 137 void Run(void); 142 138 143 CvCapture*capture;139 CvCapture *capture; 144 140 145 gui::Tab* sensor_tab; 146 gui::DoubleSpinBox *bright,*exposure,*gain,*contrast,*hue,*sharpness,*sat; 147 gui::CheckBox *autogain,*awb,*autoexposure; 148 gui::Label *fps; 149 }; 141 gui::Tab *sensor_tab; 142 gui::DoubleSpinBox *bright, *exposure, *gain, *contrast, *hue, *sharpness, 143 *sat; 144 gui::CheckBox *autogain, *awb, *autoexposure; 145 gui::Label *fps; 146 }; 150 147 } // end namespace sensor 151 148 } // end namespace flair -
trunk/include/FlairSensorActuator/VrpnClient.h
r4 r13 6 6 * \file VrpnClient.h 7 7 * \brief Class to connect to a Vrpn server 8 * \author César Richard, Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253 8 * \author César Richard, Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 9 * 7253 9 10 * \date 2013/04/03 10 11 * \version 4.0 … … 16 17 #include <Thread.h> 17 18 18 namespace flair 19 { 20 namespace core 21 { 22 class FrameworkManager; 23 class SerialPort; 24 } 25 namespace gui 26 { 27 class TabWidget; 28 class Layout; 29 } 19 namespace flair { 20 namespace core { 21 class FrameworkManager; 22 class SerialPort; 23 } 24 namespace gui { 25 class TabWidget; 26 class Layout; 27 } 30 28 } 31 29 … … 33 31 class VrpnObject_impl; 34 32 35 namespace flair 36 { 37 namespace sensor 38 { 39 /*! \class VrpnClient 40 * 41 * \brief Class to connect to a Vrpn server 42 */ 43 class VrpnClient:public core::Thread 44 { 45 friend class ::VrpnObject_impl; 33 namespace flair { 34 namespace sensor { 35 /*! \class VrpnClient 36 * 37 * \brief Class to connect to a Vrpn server 38 */ 39 class VrpnClient : public core::Thread { 40 friend class ::VrpnObject_impl; 46 41 47 public: 48 /*! 49 * \brief Constructor 50 * 51 * Construct a VrpnClient. Connection is done by IP. 52 * 53 * \param parent parent 54 * \param name name 55 * \param address server address 56 * \param us_period Thread period in us 57 * \param priority priority of the Thread 58 */ 59 VrpnClient(const core::FrameworkManager* parent,std::string name,std::string address,uint16_t us_period,uint8_t priority); 42 public: 43 /*! 44 * \brief Constructor 45 * 46 * Construct a VrpnClient. Connection is done by IP. 47 * 48 * \param parent parent 49 * \param name name 50 * \param address server address 51 * \param us_period Thread period in us 52 * \param priority priority of the Thread 53 */ 54 VrpnClient(const core::FrameworkManager *parent, std::string name, 55 std::string address, uint16_t us_period, uint8_t priority); 60 56 61 /*! 62 * \brief Constructor 63 * 64 * Construct a VrpnClient. Connection is done by XBee modem. 65 * 66 * \param parent parent 67 * \param name name 68 * \param serialport SerialPort for XBee modem 69 * \param us_period Xbee RX timeout in us 70 * \param priority priority of the Thread 71 */ 72 VrpnClient(const core::FrameworkManager* parent,std::string name,core::SerialPort* serialport,uint16_t us_period,uint8_t priority); 57 /*! 58 * \brief Constructor 59 * 60 * Construct a VrpnClient. Connection is done by XBee modem. 61 * 62 * \param parent parent 63 * \param name name 64 * \param serialport SerialPort for XBee modem 65 * \param us_period Xbee RX timeout in us 66 * \param priority priority of the Thread 67 */ 68 VrpnClient(const core::FrameworkManager *parent, std::string name, 69 core::SerialPort *serialport, uint16_t us_period, 70 uint8_t priority); 73 71 74 75 76 77 78 72 /*! 73 * \brief Destructor 74 * 75 */ 76 ~VrpnClient(); 79 77 80 81 82 83 84 85 gui::Layout*GetLayout(void) const;78 /*! 79 * \brief Setup Layout 80 * 81 * \return a Layout available 82 */ 83 gui::Layout *GetLayout(void) const; 86 84 87 88 89 90 91 92 gui::TabWidget*GetTabWidget(void) const;85 /*! 86 * \brief Setup Tab 87 * 88 * \return a Tab available 89 */ 90 gui::TabWidget *GetTabWidget(void) const; 93 91 94 95 96 97 98 99 92 /*! 93 * \brief Is XBee used? 94 * 95 * \return true if connection is based on XBee modem 96 */ 97 bool UseXbee(void) const; 100 98 101 102 103 104 105 106 107 108 99 private: 100 /*! 101 * \brief Run function 102 * 103 * Reimplemented from Thread. 104 * 105 */ 106 void Run(void); 109 107 110 class VrpnClient_impl*pimpl_;111 108 class VrpnClient_impl *pimpl_; 109 }; 112 110 } // end namespace sensor 113 111 } // end namespace flair -
trunk/include/FlairSensorActuator/VrpnObject.h
r4 r13 6 6 * \file VrpnObject.h 7 7 * \brief Class for VRPN object 8 * \author César Richard, Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253 8 * \author César Richard, Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 9 * 7253 9 10 * \date 2013/04/03 10 11 * \version 4.0 … … 17 18 #include <stdint.h> 18 19 19 namespace flair 20 { 21 namespace core 22 { 23 class cvmatrix; 24 class Vector3D; 25 class Euler; 26 class Quaternion; 27 } 28 namespace gui 29 { 30 class TabWidget; 31 class Tab; 32 class DataPlot1D; 33 } 20 namespace flair { 21 namespace core { 22 class cvmatrix; 23 class Vector3D; 24 class Euler; 25 class Quaternion; 26 } 27 namespace gui { 28 class TabWidget; 29 class Tab; 30 class DataPlot1D; 31 } 34 32 } 35 33 … … 37 35 class VrpnClient_impl; 38 36 39 namespace flair 40 { 41 namespace sensor 42 { 43 class VrpnClient; 37 namespace flair { 38 namespace sensor { 39 class VrpnClient; 44 40 45 /*! \class VrpnObject 46 * 47 * \brief Class for VRPN object 48 */ 49 class VrpnObject: public core::IODevice 50 { 51 friend class ::VrpnObject_impl; 52 friend class ::VrpnClient_impl; 41 /*! \class VrpnObject 42 * 43 * \brief Class for VRPN object 44 */ 45 class VrpnObject : public core::IODevice { 46 friend class ::VrpnObject_impl; 47 friend class ::VrpnClient_impl; 53 48 54 public: 55 /*! 56 * \brief Constructor 57 * 58 * Construct a VrpnObject. Connection is done by IP. 59 * 60 * \param parent parent 61 * \param name VRPN object name, should be the same as defined in the server 62 * \param tab Tab for the user interface 63 */ 64 VrpnObject(const VrpnClient *parent,std::string name,const gui::TabWidget* tab); 49 public: 50 /*! 51 * \brief Constructor 52 * 53 * Construct a VrpnObject. Connection is done by IP. 54 * 55 * \param parent parent 56 * \param name VRPN object name, should be the same as defined in the server 57 * \param tab Tab for the user interface 58 */ 59 VrpnObject(const VrpnClient *parent, std::string name, 60 const gui::TabWidget *tab); 65 61 66 /*! 67 * \brief Constructor 68 * 69 * Construct a VrpnObject. Connection is done by IP. 70 * 71 * \param parent parent 72 * \param name name 73 * \param id VRPN object id, should be the same as defined in the server 74 * \param tab Tab for the user interface 75 */ 76 VrpnObject(const VrpnClient *parent,std::string name,uint8_t id,const gui::TabWidget* tab); 62 /*! 63 * \brief Constructor 64 * 65 * Construct a VrpnObject. Connection is done by IP. 66 * 67 * \param parent parent 68 * \param name name 69 * \param id VRPN object id, should be the same as defined in the server 70 * \param tab Tab for the user interface 71 */ 72 VrpnObject(const VrpnClient *parent, std::string name, uint8_t id, 73 const gui::TabWidget *tab); 77 74 78 79 80 81 82 75 /*! 76 * \brief Destructor 77 * 78 */ 79 ~VrpnObject(void); 83 80 84 85 86 87 88 89 gui::Tab*GetPlotTab(void) const;81 /*! 82 * \brief Plot tab 83 * 84 * \return plot Tab 85 */ 86 gui::Tab *GetPlotTab(void) const; 90 87 91 92 93 94 95 96 88 /*! 89 * \brief Get Last Packet Time 90 * 91 * \return Time of last received packe 92 */ 93 core::Time GetLastPacketTime(void) const; 97 94 98 99 100 101 102 103 104 95 /*! 96 * \brief Is object tracked? 97 * 98 * \param timeout_ms timeout 99 * \return true if object is tracked during timeout_ms time 100 */ 101 bool IsTracked(unsigned int timeout_ms) const; 105 102 106 107 108 109 110 111 103 /*! 104 * \brief Get Euler angles 105 * 106 * \param euler output datas 107 */ 108 void GetEuler(core::Euler &euler) const; 112 109 113 114 115 116 117 118 119 120 121 122 123 124 110 /*! 111 * \brief Get Quaternion 112 * 113 * \param quaternion output datas 114 */ 115 void GetQuaternion(core::Quaternion &quaternion) const; 116 /*! 117 * \brief Get Position 118 * 119 * \param point output datas 120 */ 121 void GetPosition(core::Vector3D &point) const; 125 122 126 127 128 129 130 131 132 133 134 135 136 137 138 139 123 /*! 124 * \brief Output matrix 125 * 126 * Matrix is of type float and as follows: \n 127 * (0,0) roll (rad) \n 128 * (1,0) pitch (rad) \n 129 * (2,0) yaw (rad) \n 130 * (3,0) x \n 131 * (4,0) y \n 132 * (5,0) z \n 133 * 134 * \return Output metrix 135 */ 136 core::cvmatrix *Output(void) const; 140 137 141 142 143 144 145 146 147 148 149 150 151 138 /*! 139 * \brief State matrix 140 * 141 * Matrix is of type float and as follows: \n 142 * (0,0) roll (deg) \n 143 * (1,0) pitch (deg) \n 144 * (2,0) yaw (deg) \n 145 * 146 * \return State metrix 147 */ 148 core::cvmatrix *State(void) const; 152 149 153 154 155 156 157 158 gui::DataPlot1D*xPlot(void) const;150 /*! 151 * \brief x plot 152 * 153 * \return x plot 154 */ 155 gui::DataPlot1D *xPlot(void) const; 159 156 160 161 162 163 164 165 gui::DataPlot1D*yPlot(void) const;157 /*! 158 * \brief y plot 159 * 160 * \return y plot 161 */ 162 gui::DataPlot1D *yPlot(void) const; 166 163 167 168 169 170 171 172 gui::DataPlot1D*zPlot(void) const;164 /*! 165 * \brief z plot 166 * 167 * \return z plot 168 */ 169 gui::DataPlot1D *zPlot(void) const; 173 170 174 175 176 177 178 179 180 181 182 171 private: 172 /*! 173 * \brief Update using provided datas 174 * 175 * Reimplemented from IODevice. 176 * 177 * \param data data from the parent to process 178 */ 179 void UpdateFrom(const core::io_data *data){}; 183 180 184 185 class VrpnObject_impl*pimpl_;186 181 void mainloop(void); 182 class VrpnObject_impl *pimpl_; 183 }; 187 184 } // end namespace sensor 188 185 } // end namespace flair -
trunk/include/FlairSensorActuator/XBldc.h
r4 r13 16 16 #include "Bldc.h" 17 17 18 namespace flair 19 { 20 namespace core 21 { 22 class IODevice; 23 class I2cPort; 24 } 25 namespace gui 26 { 27 class Layout; 28 } 18 namespace flair { 19 namespace core { 20 class IODevice; 21 class I2cPort; 22 } 23 namespace gui { 24 class Layout; 25 } 29 26 } 30 27 31 28 class XBldc_impl; 32 29 33 namespace flair 34 { 35 namespace actuator 36 { 37 /*! \class XBldc 38 * 39 * \brief Class for Xufo Bldc 40 */ 41 class XBldc : public Bldc 42 { 43 public: 44 /*! 45 * \brief Constructor 46 * 47 * Construct a XBldc. 48 * 49 * \param parent parent 50 * \param layout layout 51 * \param name name 52 * \param i2cport i2cport 53 */ 54 XBldc(const core::IODevice* parent,gui::Layout* layout,std::string name,core::I2cPort* i2cport); 30 namespace flair { 31 namespace actuator { 32 /*! \class XBldc 33 * 34 * \brief Class for Xufo Bldc 35 */ 36 class XBldc : public Bldc { 37 public: 38 /*! 39 * \brief Constructor 40 * 41 * Construct a XBldc. 42 * 43 * \param parent parent 44 * \param layout layout 45 * \param name name 46 * \param i2cport i2cport 47 */ 48 XBldc(const core::IODevice *parent, gui::Layout *layout, std::string name, 49 core::I2cPort *i2cport); 55 50 56 57 58 59 60 51 /*! 52 * \brief Destructor 53 * 54 */ 55 ~XBldc(); 61 56 62 63 64 65 66 67 68 69 bool HasSpeedMeasurement(void) const{return false;};57 /*! 58 * \brief Has speed measurement 59 * 60 * Reimplemented from Bldc. \n 61 * 62 * \return true if it has speed measurement 63 */ 64 bool HasSpeedMeasurement(void) const { return false; }; 70 65 71 72 73 74 75 76 77 78 bool HasCurrentMeasurement(void) const{return false;};66 /*! 67 * \brief Has current measurement 68 * 69 * Reimplemented from Bldc. \n 70 * 71 * \return true if it has current measurement 72 */ 73 bool HasCurrentMeasurement(void) const { return false; }; 79 74 80 81 82 83 84 85 86 87 88 89 void SetMotors(float*value);75 private: 76 /*! 77 * \brief Set motors values 78 * 79 * Reimplemented from Bldc. \n 80 * Values size must be the same as MotorsCount() 81 * 82 * \param values motor values 83 */ 84 void SetMotors(float *value); 90 85 91 class XBldc_impl*pimpl_;92 86 class XBldc_impl *pimpl_; 87 }; 93 88 } // end namespace actuator 94 89 } // end namespace flair
Note:
See TracChangeset
for help on using the changeset viewer.