core_sensors.hpp
Go to the documentation of this file.
00001 
00009 /*****************************************************************************
00010 ** Preprocessor
00011 *****************************************************************************/
00012 
00013 #ifndef KOBUKI_CORE_SENSORS_HPP__
00014 #define KOBUKI_CORE_SENSORS_HPP__
00015 
00016 /*****************************************************************************
00017 ** Include
00018 *****************************************************************************/
00019 
00020 #include "../packet_handler/payload_base.hpp"
00021 #include "../macros.hpp"
00022 #include <stdint.h>
00023 
00024 /*****************************************************************************
00025 ** Namespaces
00026 *****************************************************************************/
00027 
00028 namespace kobuki
00029 {
00030 
00031 /*****************************************************************************
00032 ** Interface
00033 *****************************************************************************/
00034 
00035 class kobuki_PUBLIC CoreSensors : public packet_handler::payloadBase
00036 {
00037 public:
00038   CoreSensors() : packet_handler::payloadBase(false, 15) {};
00039 
00040   struct Data {
00041     uint16_t time_stamp;
00042     uint8_t bumper;
00043     uint8_t wheel_drop;
00044     uint8_t cliff;
00045     uint16_t left_encoder;
00046     uint16_t right_encoder;
00047     char left_pwm;
00048     char right_pwm;
00049     uint8_t buttons;
00050     uint8_t charger;
00051     uint8_t battery;
00052     uint8_t over_current;
00053   } data;
00054 
00055   struct Flags {
00056     // buttons
00057     static const uint8_t Button0 = 0x01;
00058     static const uint8_t Button1 = 0x02;
00059     static const uint8_t Button2 = 0x04;
00060 
00061     // bumper
00062     static const uint8_t LeftBumper   = 0x04;
00063     static const uint8_t CenterBumper = 0x02;
00064     static const uint8_t RightBumper  = 0x01;
00065 
00066     // cliff sensor
00067     static const uint8_t LeftCliff    = 0x04;
00068     static const uint8_t CenterCliff  = 0x02;
00069     static const uint8_t RightCliff   = 0x01;
00070 
00071     // wheel drop sensor
00072     static const uint8_t LeftWheel    = 0x02;
00073     static const uint8_t RightWheel   = 0x01;
00074 
00075     // Charging source
00076     // - first four bits distinguish between adapter or docking base charging
00077     static const uint8_t AdapterType  = 0x10;
00078     // - last 4 bits specified the charging status (see Battery.hpp for details)
00079     static const uint8_t BatteryStateMask = 0x0F;
00080     static const uint8_t Discharging  = 0x00;
00081     static const uint8_t Charged      = 0x02;
00082     static const uint8_t Charging     = 0x06;
00083 
00084     // wheel drop sensor
00085     static const uint8_t LeftWheel_OC    = 0x01;
00086     static const uint8_t RightWheel_OC   = 0x02;
00087 
00088   };
00089 
00090   bool serialise(ecl::PushAndPop<unsigned char> & byteStream);
00091   bool deserialise(ecl::PushAndPop<unsigned char> & byteStream);
00092 };
00093 
00094 } // namespace kobuki
00095 
00096 #endif /* KOBUKI_CORE_SENSORS_HPP__ */


kobuki_driver
Author(s): Daniel Stonier , Younghun Ju , Jorge Santos Simon
autogenerated on Thu Jun 6 2019 20:24:37