cliff.hpp
Go to the documentation of this file.
00001 
00009 /*****************************************************************************
00010 ** Preprocessor
00011 *****************************************************************************/
00012 
00013 #ifndef KOBUKI_CLIFF_DATA_HPP__
00014 #define KOBUKI_CLIFF_DATA_HPP__
00015 
00016 /*****************************************************************************
00017 ** Include
00018 *****************************************************************************/
00019 
00020 #include <vector>
00021 #include "../packet_handler/payload_base.hpp"
00022 #include "../packet_handler/payload_headers.hpp"
00023 
00024 /*****************************************************************************
00025 ** Namespace
00026 *****************************************************************************/
00027 
00028 namespace kobuki
00029 {
00030 
00031 /*****************************************************************************
00032 ** Interface
00033 *****************************************************************************/
00034 
00035 class Cliff : public packet_handler::payloadBase
00036 {
00037 public:
00038   struct Data {
00039     Data() : bottom(3) {}
00040     std::vector<uint16_t> bottom;
00041   } data;
00042 
00043   bool serialise(ecl::PushAndPop<unsigned char> & byteStream)
00044   {
00045     if (!(byteStream.size() > 0))
00046     {
00047       printf("kobuki_node: kobuki_cliff: serialise failed. empty byte stream.");
00048       return false;
00049     }
00050 
00051     unsigned char length = 6;
00052     buildBytes(Header::Cliff, byteStream);
00053     buildBytes(length, byteStream);
00054     buildBytes(data.bottom[0], byteStream);
00055     buildBytes(data.bottom[1], byteStream);
00056     buildBytes(data.bottom[2], byteStream);
00057     return true;
00058   }
00059 
00060   bool deserialise(ecl::PushAndPop<unsigned char> & byteStream)
00061   {
00062     if (!(byteStream.size() > 0))
00063     {
00064       printf("kobuki_node: kobuki_cliff: deserialise failed. empty byte stream.");
00065       return false;
00066     }
00067 
00068     unsigned char header_id, length;
00069     buildVariable(header_id, byteStream);
00070     buildVariable(length, byteStream);
00071     buildVariable(data.bottom[0], byteStream);
00072     buildVariable(data.bottom[1], byteStream);
00073     buildVariable(data.bottom[2], byteStream);
00074 
00075     //showMe();
00076     return constrain();
00077   }
00078 
00079   bool constrain()
00080   {
00081     return true;
00082   }
00083 
00084   void showMe()
00085   {
00086     //printf("--[%02x || %03d | %03d | %03d]\n", data.bump, bottom[2], bottom[1], bottom[0] );
00087   }
00088 };
00089 
00090 } // namespace kobuki
00091 
00092 #endif /* KOBUKI_IR_DATA_HPP__ */


kobuki_driver
Author(s): Daniel Stonier , Younghun Ju , Jorge Santos Simon
autogenerated on Mon Oct 6 2014 01:31:09