sick_generic_imu.h
Go to the documentation of this file.
1 //
2 // Created by michael on 10/4/18.
3 //
4 
5 #ifndef SICK_SCAN_SICK_GENERIC_IMU_H
6 #define SICK_SCAN_SICK_GENERIC_IMU_H
7 
8 /*
9  * Copyright (C) 2018, Ing.-Buero Dr. Michael Lehning, Hildesheim
10  * Copyright (C) 2018, SICK AG, Waldkirch
11  * All rights reserved.
12  *
13  * Redistribution and use in source and binary forms, with or without
14  * modification, are permitted provided that the following conditions are met:
15  *
16  * * Redistributions of source code must retain the above copyright
17  * notice, this list of conditions and the following disclaimer.
18  * * Redistributions in binary form must reproduce the above copyright
19  * notice, this list of conditions and the following disclaimer in the
20  * documentation and/or other materials provided with the distribution.
21  * * Neither the name of Osnabrück University nor the names of its
22  * contributors may be used to endorse or promote products derived from
23  * this software without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
29  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35  * POSSIBILITY OF SUCH DAMAGE.
36  *
37  * Created on: 28th May 2018
38  *
39  * Authors:
40  * Michael Lehning <michael.lehning@lehning.de>
41  *
42  */
43 
44 #include <stdio.h>
45 #include <stdlib.h>
46 #include <string>
47 #include <string.h>
48 #include <vector>
49 
50 #include <ros/ros.h>
51 #include <sensor_msgs/LaserScan.h>
52 #include <sensor_msgs/PointCloud.h>
53 #include <sensor_msgs/PointCloud2.h>
54 #include <std_msgs/String.h>
55 
59 #include <sick_scan/RadarScan.h> // generated by msg-generator
60 
61 #ifndef _MSC_VER
62 
63 #include <dynamic_reconfigure/server.h>
64 #include <sick_scan/SickScanConfig.h>
65 
66 #endif
67 
70 #include <ros/ros.h>
71 #include <sensor_msgs/Imu.h>
72 #include "softwarePLL.h"
73 
74 namespace sick_scan
75 {
76 
77 
79  {
80  public:
81  UINT64 TimeStamp() const
82  { return timeStamp; }
83 
84  void TimeStamp(UINT64 val)
85  { timeStamp = val; }
86 
87  float QuaternionX() const
88  { return quaternionX; }
89 
90  void QuaternionX(float val)
91  { quaternionX = val; }
92 
93  float QuaternionY() const
94  { return quaternionY; }
95 
96  void QuaternionY(float val)
97  { quaternionY = val; }
98 
99  float QuaternionZ() const
100  { return quaternionZ; }
101 
102  void QuaternionZ(float val)
103  { quaternionZ = val; }
104 
105  float QuaternionW() const
106  { return quaternionW; }
107 
108  void QuaternionW(float val)
109  { quaternionW = val; }
110 
111  float QuaternionAccuracy() const
112  { return quaternionAccuracy; }
113 
114  void QuaternionAccuracy(float val)
115  { quaternionAccuracy = val; }
116 
117 
118  float AngularVelocityX() const
119  { return velocityX; }
120 
121  void AngularVelocityX(float val)
122  { velocityX = val; }
123 
124  float AngularVelocityY() const
125  { return velocityY; }
126 
127  void AngularVelocityY(float val)
128  { velocityY = val; }
129 
130  float AngularVelocityZ() const
131  { return velocityZ; }
132 
133  void AngularVelocityZ(float val)
134  { velocityZ = val; }
135 
137  { return velocityReliability; }
138 
140  { velocityReliability = val; }
141 
142  float LinearAccelerationX() const
143  { return linearAccelerationX; }
144 
145  void LinearAccelerationX(float val)
146  { linearAccelerationX = val; }
147 
148  float LinearAccelerationY() const
149  { return linearAccelerationY; }
150 
151  void LinearAccelerationY(float val)
152  { linearAccelerationY = val; }
153 
154  float LinearAccelerationZ() const
155  { return linearAccelerationZ; }
156 
157  void LinearAccelerationZ(float val)
158  { linearAccelerationZ = val; }
159 
162 
165 
166  private:
168  float quaternionX;
169  float quaternionY;
170  float quaternionZ;
171  float quaternionW;
173  float velocityX;
174  float velocityY;
175  float velocityZ;
181 
182  };
183 
185  {
186  public:
188  {
189  commonPtr = commonPtr_;
190  }
191 
192  bool isImuDatagram(char *datagram, size_t datagram_length);
193 
194  bool isImuBinaryDatagram(char *datagram, size_t datagram_length);
195 
196  bool isImuAsciiDatagram(char *datagram, size_t datagram_length);
197 
198  bool isImuAckDatagram(char *datagram, size_t datagram_length);
199 
200  int parseDatagram(ros::Time timeStamp, unsigned char *receiveBuffer, int actual_length, bool useBinaryProtocol);
201 
202  int parseAsciiDatagram(char *datagram, size_t datagram_length, SickScanImuValue *imValuePtr);
203 
204  int parseBinaryDatagram(char *datagram, size_t datagram_length, SickScanImuValue *imValuePtr);
205 
206  static void imuParserTest();
207 
208  static void quaternion2rpyTest(); // test for converting quaternion to rpy
209 
210  double simpleFmodTwoPi(double angle);
211 
212  private:
214  bool emul;
215  };
216 
217 } /* namespace sick_scan */
218 
219 
220 #endif //SICK_SCAN_SICK_GENERIC_IMU_H
UINT16
uint16_t UINT16
Definition: BasicDatatypes.hpp:27
sick_scan::SickScanImuValue::LinearAccelerationReliability
void LinearAccelerationReliability(UINT16 val)
Definition: sick_generic_imu.h:163
sick_scan::SickScanImu::imuParserTest
static void imuParserTest()
Definition: sick_generic_imu.cpp:500
sick_scan::SickScanImuValue::QuaternionAccuracy
float QuaternionAccuracy() const
Definition: sick_generic_imu.h:111
sick_scan::SickScanImuValue::linearAccelerationY
float linearAccelerationY
Definition: sick_generic_imu.h:178
sick_scan::SickScanImuValue::velocityY
float velocityY
Definition: sick_generic_imu.h:174
sick_scan::SickScanImu::isImuDatagram
bool isImuDatagram(char *datagram, size_t datagram_length)
Definition: sick_generic_imu.cpp:85
sick_scan::SickScanImuValue::linearAccelerationReliability
UINT16 linearAccelerationReliability
Definition: sick_generic_imu.h:180
ros.h
sick_scan::SickScanImuValue::QuaternionY
void QuaternionY(float val)
Definition: sick_generic_imu.h:96
sick_scan::SickScanImuValue
Definition: sick_generic_imu.h:78
sick_scan::SickScanImuValue::velocityReliability
UINT16 velocityReliability
Definition: sick_generic_imu.h:176
sick_scan::SickScanImuValue::linearAccelerationX
float linearAccelerationX
Definition: sick_generic_imu.h:177
sick_scan::SickScanImuValue::QuaternionW
void QuaternionW(float val)
Definition: sick_generic_imu.h:108
sick_scan::SickScanImuValue::LinearAccelerationY
float LinearAccelerationY() const
Definition: sick_generic_imu.h:148
sick_scan::SickScanImuValue::quaternionX
float quaternionX
Definition: sick_generic_imu.h:168
sick_scan::SickScanCommon
Definition: sick_scan_common.h:86
sick_scan::SickScanImuValue::QuaternionZ
float QuaternionZ() const
Definition: sick_generic_imu.h:99
sick_scan::SickScanImuValue::QuaternionW
float QuaternionW() const
Definition: sick_generic_imu.h:105
sick_scan::SickScanImuValue::LinearAccelerationX
float LinearAccelerationX() const
Definition: sick_generic_imu.h:142
sick_scan::SickScanImuValue::LinearAccelerationY
void LinearAccelerationY(float val)
Definition: sick_generic_imu.h:151
publisher.h
diagnostic_updater.h
sick_scan::SickScanImuValue::quaternionY
float quaternionY
Definition: sick_generic_imu.h:169
sick_scan::SickScanImuValue::quaternionZ
float quaternionZ
Definition: sick_generic_imu.h:170
softwarePLL.h
sick_scan::SickScanImuValue::LinearAccelerationX
void LinearAccelerationX(float val)
Definition: sick_generic_imu.h:145
sick_generic_parser.h
sick_scan::SickScanImu::quaternion2rpyTest
static void quaternion2rpyTest()
Test barebone implemetation from quaternio to euler (Roll-Pitch-Yaw-Sequence) to avoid problems using...
Definition: sick_generic_imu.cpp:437
sick_scan::SickScanImuValue::AngularVelocityY
void AngularVelocityY(float val)
Definition: sick_generic_imu.h:127
sick_scan::SickScanImu::parseAsciiDatagram
int parseAsciiDatagram(char *datagram, size_t datagram_length, SickScanImuValue *imValuePtr)
Parsing Ascii datagram.
Definition: sick_generic_imu.cpp:293
sick_scan::SickScanImuValue::QuaternionAccuracy
void QuaternionAccuracy(float val)
Definition: sick_generic_imu.h:114
sick_scan::SickScanImuValue::AngularVelocityReliability
void AngularVelocityReliability(UINT16 val)
Definition: sick_generic_imu.h:139
sick_scan::SickScanImuValue::TimeStamp
UINT64 TimeStamp() const
Definition: sick_generic_imu.h:81
UINT64
uint64_t UINT64
Definition: BasicDatatypes.hpp:24
sick_scan::SickScanImuValue::AngularVelocityX
void AngularVelocityX(float val)
Definition: sick_generic_imu.h:121
sick_scan::SickScanImuValue::AngularVelocityX
float AngularVelocityX() const
Definition: sick_generic_imu.h:118
sick_scan::SickScanImu::isImuBinaryDatagram
bool isImuBinaryDatagram(char *datagram, size_t datagram_length)
Checking ASCII diagram for imu message type.
Definition: sick_generic_imu.cpp:160
sick_scan::SickScanImu::SickScanImu
SickScanImu(SickScanCommon *commonPtr_)
Definition: sick_generic_imu.h:187
sick_scan::SickScanImu::parseDatagram
int parseDatagram(ros::Time timeStamp, unsigned char *receiveBuffer, int actual_length, bool useBinaryProtocol)
Definition: sick_generic_imu.cpp:557
sick_scan::SickScanImu::emul
bool emul
Definition: sick_generic_imu.h:214
sick_scan
Definition: abstract_parser.cpp:50
sick_scan::SickScanImuValue::velocityX
float velocityX
Definition: sick_generic_imu.h:173
sick_scan::SickScanImu::simpleFmodTwoPi
double simpleFmodTwoPi(double angle)
Checking angle to be in the interval [-M_PI,M_PI] Of course you can also use fmod,...
Definition: sick_generic_imu.cpp:117
sick_scan::SickScanImuValue::TimeStamp
void TimeStamp(UINT64 val)
Definition: sick_generic_imu.h:84
sick_scan::SickScanImuValue::quaternionW
float quaternionW
Definition: sick_generic_imu.h:171
sick_scan::SickScanImuValue::timeStamp
UINT32 timeStamp
Definition: sick_generic_imu.h:167
sick_scan::SickScanImu::parseBinaryDatagram
int parseBinaryDatagram(char *datagram, size_t datagram_length, SickScanImuValue *imValuePtr)
Parsing Ascii datagram.
Definition: sick_generic_imu.cpp:197
sick_scan::SickScanImu::isImuAckDatagram
bool isImuAckDatagram(char *datagram, size_t datagram_length)
Definition: sick_generic_imu.cpp:130
sick_scan::SickScanImuValue::LinearAccelerationZ
float LinearAccelerationZ() const
Definition: sick_generic_imu.h:154
sick_scan::SickScanImuValue::QuaternionY
float QuaternionY() const
Definition: sick_generic_imu.h:93
sick_scan::SickScanImuValue::AngularVelocityZ
float AngularVelocityZ() const
Definition: sick_generic_imu.h:130
sick_scan::SickScanImuValue::QuaternionX
void QuaternionX(float val)
Definition: sick_generic_imu.h:90
sick_scan::SickScanImuValue::quaternionAccuracy
float quaternionAccuracy
Definition: sick_generic_imu.h:172
sick_scan::SickScanImuValue::velocityZ
float velocityZ
Definition: sick_generic_imu.h:175
sick_scan::SickScanImuValue::AngularVelocityReliability
UINT16 AngularVelocityReliability() const
Definition: sick_generic_imu.h:136
sick_scan::SickScanImu::commonPtr
SickScanCommon * commonPtr
Definition: sick_generic_imu.h:213
sick_scan::SickScanImuValue::LinearAccelerationZ
void LinearAccelerationZ(float val)
Definition: sick_generic_imu.h:157
sick_scan::SickScanImuValue::AngularVelocityY
float AngularVelocityY() const
Definition: sick_generic_imu.h:124
ros::Time
sick_scan::SickScanImuValue::QuaternionZ
void QuaternionZ(float val)
Definition: sick_generic_imu.h:102
sick_scan::SickScanImuValue::LinearAccelerationReliability
UINT16 LinearAccelerationReliability() const
Definition: sick_generic_imu.h:160
sick_scan::SickScanImuValue::QuaternionX
float QuaternionX() const
Definition: sick_generic_imu.h:87
sick_scan_common_nw.h
sick_scan::SickScanImu::isImuAsciiDatagram
bool isImuAsciiDatagram(char *datagram, size_t datagram_length)
Checking ASCII diagram for imu message type.
Definition: sick_generic_imu.cpp:266
UINT32
uint32_t UINT32
Definition: BasicDatatypes.hpp:26
sick_scan::SickScanImuValue::linearAccelerationZ
float linearAccelerationZ
Definition: sick_generic_imu.h:179
sick_scan::SickScanImu
Definition: sick_generic_imu.h:184
sick_scan::SickScanImuValue::AngularVelocityZ
void AngularVelocityZ(float val)
Definition: sick_generic_imu.h:133


sick_scan
Author(s): Michael Lehning , Jochen Sprickerhof , Martin Günther
autogenerated on Thu Sep 8 2022 02:30:19