SerialIMUDevice.hpp
Go to the documentation of this file.
00001 /*
00002  * SerialIMUDevice.hpp
00003  *
00004  *  Created on: Jul 11, 2012
00005  *      Author: mriedel
00006  */
00007 
00008 #ifndef SERIALIMUDEVICE_HPP_
00009 #define SERIALIMUDEVICE_HPP_
00010 
00011 #include <telekyb_defines/telekyb_defines.hpp>
00012 #include <telekyb_serial/ThreadedSerialDevice.hpp>
00013 
00014 #include <telekyb_base/Time.hpp>
00015 
00016 #include "SerialIMUDeviceOptions.hpp"
00017 
00018 // 10 Data + 1 CRC + \r
00019 #define SERIAL_MSG_SIZE 13
00020 
00021 // TODO: This Element is not copyable. (Because it's a Listener!!!)
00022 
00023 namespace TELEKYB_NAMESPACE {
00024 
00025 // 10bit 0-1024
00026 struct RawImuData {
00027         unsigned int accX;
00028         unsigned int accY;
00029         unsigned int accZ;
00030         unsigned int gyroRoll;
00031         unsigned int gyroPitch;
00032         unsigned int gyroYaw;
00033 };
00034 
00035 class RawImuDataListener {
00036 public:
00037         virtual ~RawImuDataListener() {};
00038         virtual void processRawIMUData(const RawImuData& data) = 0;
00039 };
00040 
00041 class SerialIMUDevice : public ThreadedSerialDevice, public SerialDeviceListener {
00042 private:
00043         SerialIMUDeviceOptions &options;
00044         unsigned char msgData[SERIAL_MSG_SIZE - 2];
00045 
00046         RawImuDataListener* rawImuDataListener;
00047 
00048         telekyb::Timer batteryTimer;
00049 
00050 public:
00051         SerialIMUDevice();
00052         virtual ~SerialIMUDevice();
00053 
00054         void handleReadSerialData(const std::vector<char>& data);
00055         void setRawImuDataListener(RawImuDataListener* listener);
00056 };
00057 
00058 }
00059 
00060 #endif /* SERIALIMUDEVICE_HPP_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Defines


tk_smurf_interface
Author(s): Martin Riedel
autogenerated on Mon Nov 11 2013 11:14:12