sick_generic_imu.h
Go to the documentation of this file.
00001 //
00002 // Created by michael on 10/4/18.
00003 //
00004 
00005 #ifndef SICK_SCAN_SICK_GENERIC_IMU_H
00006 #define SICK_SCAN_SICK_GENERIC_IMU_H
00007 
00008 /*
00009  * Copyright (C) 2018, Ing.-Buero Dr. Michael Lehning, Hildesheim
00010  * Copyright (C) 2018, SICK AG, Waldkirch
00011  * All rights reserved.
00012  *
00013  * Redistribution and use in source and binary forms, with or without
00014  * modification, are permitted provided that the following conditions are met:
00015  *
00016  *     * Redistributions of source code must retain the above copyright
00017  *       notice, this list of conditions and the following disclaimer.
00018  *     * Redistributions in binary form must reproduce the above copyright
00019  *       notice, this list of conditions and the following disclaimer in the
00020  *       documentation and/or other materials provided with the distribution.
00021  *     * Neither the name of Osnabrück University nor the names of its
00022  *       contributors may be used to endorse or promote products derived from
00023  *       this software without specific prior written permission.
00024  *
00025  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00026  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00027  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00028  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00029  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00030  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00031  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00032  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00033  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00034  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00035  * POSSIBILITY OF SUCH DAMAGE.
00036  *
00037  *  Created on: 28th May 2018
00038  *
00039  *      Authors:
00040  *       Michael Lehning <michael.lehning@lehning.de>
00041  *
00042  */
00043 
00044 #include <stdio.h>
00045 #include <stdlib.h>
00046 #include <string>
00047 #include <string.h>
00048 #include <vector>
00049 
00050 #include <ros/ros.h>
00051 #include <sensor_msgs/LaserScan.h>
00052 #include <sensor_msgs/PointCloud.h>
00053 #include <sensor_msgs/PointCloud2.h>
00054 #include <std_msgs/String.h>
00055 
00056 #include <diagnostic_updater/diagnostic_updater.h>
00057 #include <diagnostic_updater/publisher.h>
00058 #include <sick_scan/sick_scan_common_nw.h>
00059 #include <sick_scan/RadarScan.h> // generated by msg-generator
00060 
00061 #ifndef _MSC_VER
00062 #include <dynamic_reconfigure/server.h>
00063 #include <sick_scan/SickScanConfig.h>
00064 #endif
00065 #include "sick_scan/sick_generic_parser.h"
00066 #include "sick_scan/sick_scan_common_nw.h"
00067 #include <ros/ros.h>
00068 #include <sensor_msgs/Imu.h>
00069 #include "softwarePLL.h"
00070 namespace sick_scan
00071   {
00072 
00073 
00074       class SickScanImuValue
00075       {
00076       public:
00077           UINT64 TimeStamp() const { return timeStamp; }
00078           void TimeStamp(UINT64 val) { timeStamp = val; }
00079           float QuaternionX() const { return quaternionX; }
00080           void QuaternionX(float val) { quaternionX = val; }
00081           float QuaternionY() const { return quaternionY; }
00082           void QuaternionY(float val) { quaternionY = val; }
00083           float QuaternionZ() const { return quaternionZ; }
00084           void QuaternionZ(float val) { quaternionZ = val; }
00085           float QuaternionW() const { return quaternionW; }
00086           void QuaternionW(float val) { quaternionW = val; }
00087 
00088           float QuaternionAccuracy() const { return quaternionAccuracy; }
00089           void QuaternionAccuracy(float val) { quaternionAccuracy = val; }
00090 
00091 
00092           float AngularVelocityX() const { return velocityX; }
00093           void AngularVelocityX(float val) { velocityX = val; }
00094           float AngularVelocityY() const { return velocityY; }
00095           void AngularVelocityY(float val) { velocityY = val; }
00096           float AngularVelocityZ() const { return velocityZ; }
00097           void AngularVelocityZ(float val) { velocityZ = val; }
00098 
00099           UINT16 AngularVelocityReliability() const {return velocityReliability;}
00100           void AngularVelocityReliability(UINT16 val) {velocityReliability = val;}
00101 
00102           float LinearAccelerationX() const { return linearAccelerationX; }
00103           void LinearAccelerationX(float val) { linearAccelerationX = val; }
00104           float LinearAccelerationY() const { return linearAccelerationY; }
00105           void LinearAccelerationY(float val) { linearAccelerationY = val; }
00106           float LinearAccelerationZ() const { return linearAccelerationZ; }
00107           void LinearAccelerationZ(float val) { linearAccelerationZ = val; }
00108 
00109           UINT16 LinearAccelerationReliability() const {return linearAccelerationReliability;}
00110           void LinearAccelerationReliability(UINT16 val) {linearAccelerationReliability = val;}
00111 
00112       private:
00113           UINT32 timeStamp;
00114           float quaternionX;
00115           float quaternionY;
00116           float quaternionZ;
00117           float quaternionW;
00118           float quaternionAccuracy;
00119           float velocityX;
00120           float velocityY;
00121           float velocityZ;
00122           UINT16 velocityReliability;
00123           float linearAccelerationX;
00124           float linearAccelerationY;
00125           float linearAccelerationZ;
00126           UINT16 linearAccelerationReliability;
00127 
00128           };
00129 
00130       class SickScanImu
00131           {
00132       public:
00133           SickScanImu(SickScanCommon *commonPtr_)
00134             {
00135             commonPtr = commonPtr_;
00136             }
00137           bool isImuDatagram(char *datagram, size_t datagram_length);
00138           bool isImuBinaryDatagram(char *datagram, size_t datagram_length);
00139           bool isImuAsciiDatagram(char *datagram, size_t datagram_length);
00140           bool isImuAckDatagram(char *datagram, size_t datagram_length);
00141 
00142           int parseDatagram(ros::Time timeStamp, unsigned char *receiveBuffer, int actual_length, bool useBinaryProtocol);
00143           int parseAsciiDatagram(char* datagram, size_t datagram_length, SickScanImuValue *imValuePtr);
00144           int parseBinaryDatagram(char* datagram, size_t datagram_length, SickScanImuValue *imValuePtr);
00145           static void imuParserTest();
00146           double simpleFmodTwoPi(double angle);
00147 
00148       private:
00149           SickScanCommon *commonPtr;
00150           bool emul;
00151           };
00152 
00153   } /* namespace sick_scan */
00154 
00155 
00156 #endif //SICK_SCAN_SICK_GENERIC_IMU_H


sick_scan
Author(s): Michael Lehning , Jochen Sprickerhof , Martin Günther
autogenerated on Tue Jul 9 2019 05:05:34