LidarDataMessage.h
Go to the documentation of this file.
00001 
00040 #ifndef LibMultiSense_LidarDataMessage
00041 #define LibMultiSense_LidarDataMessage
00042 
00043 #include <typeinfo>
00044 
00045 #include "details/utility/Portability.hh"
00046 
00047 namespace crl {
00048 namespace multisense {
00049 namespace details {
00050 namespace wire {
00051 
00052 class WIRE_HEADER_ATTRIBS_ LidarDataHeader {
00053 public:
00054 
00055     static CRL_CONSTEXPR IdType      ID          = ID_DATA_LIDAR_SCAN;
00056     static CRL_CONSTEXPR VersionType VERSION     = 1;
00057     static CRL_CONSTEXPR uint32_t    SCAN_POINTS = 1081;
00058 
00059 #ifdef SENSORPOD_FIRMWARE
00060     IdType      id;
00061     VersionType version;
00062 #endif // SENSORDPOD_FIRMWARE
00063 
00064     uint32_t           scanCount;
00065     uint32_t           timeStartSeconds;
00066     uint32_t           timeStartMicroSeconds;
00067     uint32_t           timeEndSeconds;
00068     uint32_t           timeEndMicroSeconds;
00069     int32_t            angleStart; // microradians
00070     int32_t            angleEnd;
00071     uint32_t           points;
00072 #ifdef SENSORPOD_FIRMWARE
00073     uint32_t           distanceP[SCAN_POINTS];   // millimeters
00074     uint32_t           intensityP[SCAN_POINTS];
00075 #else
00076     uint32_t          *distanceP;
00077     uint32_t          *intensityP;
00078 #endif // SENSORPOD_FIRMWARE
00079 
00080     LidarDataHeader()
00081         :
00082 #ifdef SENSORPOD_FIRMWARE
00083         id(ID),
00084         version(VERSION),
00085 #endif // SENSORPOD_FIRMWARE
00086         points(0) {};
00087 };
00088 
00089 #ifndef SENSORPOD_FIRMWARE
00090 
00091 class LidarData : public LidarDataHeader {
00092 public:
00093 
00094     //
00095     // Constructors
00096 
00097     LidarData(utility::BufferStreamReader&r, VersionType v) {serialize(r,v);};
00098     LidarData() {};
00099 
00100     //
00101     // Serialization routine
00102 
00103     template<class Archive>
00104         void serialize(Archive&          message,
00105                        const VersionType version)
00106     {
00107         message & scanCount;
00108         message & timeStartSeconds;
00109         message & timeStartMicroSeconds;
00110         message & timeEndSeconds;
00111         message & timeEndMicroSeconds;
00112         message & angleStart;
00113         message & angleEnd;
00114         message & points;
00115 
00116         const uint32_t rangeSize     = sizeof(uint32_t) * points;
00117         const uint32_t intensitySize = sizeof(uint32_t) * points;
00118 
00119         if (typeid(Archive) == typeid(utility::BufferStreamWriter)) {
00120 
00121             message.write(distanceP, rangeSize);
00122             message.write(intensityP, intensitySize);
00123 
00124         } else {
00125 
00126             distanceP = (uint32_t *) message.peek();
00127             message.seek(message.tell() + rangeSize);
00128 
00129             intensityP = (uint32_t *) message.peek();
00130             message.seek(message.tell() + intensitySize);
00131         }
00132     }
00133 };
00134 
00135 #endif // !SENSORPOD_FIRMWARE
00136 
00137 }}}}; // namespaces
00138 
00139 #endif


multisense_lib
Author(s):
autogenerated on Fri Apr 5 2019 02:28:24