|
1 | | -/** |
2 | | -* \file |
3 | | -* \brief Laser Scanner Entry Point |
4 | | -* |
5 | | -* Copyright (C) 2019,2018,2017, Ing.-Buero Dr. Michael Lehning, Hildesheim |
6 | | -* Copyright (C) 2019,2018,2017, SICK AG, Waldkirch |
7 | | -* |
8 | | -* Licensed under the Apache License, Version 2.0 (the "License"); |
9 | | -* you may not use this file except in compliance with the License. |
10 | | -* You may obtain a copy of the License at |
11 | | -* |
12 | | -* http://www.apache.org/licenses/LICENSE-2.0 |
13 | | -* |
14 | | -* Unless required by applicable law or agreed to in writing, software |
15 | | -* distributed under the License is distributed on an "AS IS" BASIS, |
16 | | -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
17 | | -* See the License for the specific language governing permissions and |
18 | | -* limitations under the License. |
19 | | -* |
20 | | -* |
21 | | -* All rights reserved. |
22 | | -* |
23 | | -* Redistribution and use in source and binary forms, with or without |
24 | | -* modification, are permitted provided that the following conditions are met: |
25 | | -* |
26 | | -* * Redistributions of source code must retain the above copyright |
27 | | -* notice, this list of conditions and the following disclaimer. |
28 | | -* * Redistributions in binary form must reproduce the above copyright |
29 | | -* notice, this list of conditions and the following disclaimer in the |
30 | | -* documentation and/or other materials provided with the distribution. |
31 | | -* * Neither the name of Osnabrück University nor the names of its |
32 | | -* contributors may be used to endorse or promote products derived from |
33 | | -* this software without specific prior written permission. |
34 | | -* * Neither the name of SICK AG nor the names of its |
35 | | -* contributors may be used to endorse or promote products derived from |
36 | | -* this software without specific prior written permission |
37 | | -* * Neither the name of Ing.-Buero Dr. Michael Lehning nor the names of its |
38 | | -* contributors may be used to endorse or promote products derived from |
39 | | -* this software without specific prior written permission |
40 | | -* |
41 | | -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
42 | | -* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
43 | | -* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
44 | | -* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
45 | | -* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
46 | | -* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
47 | | -* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
48 | | -* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
49 | | -* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
50 | | -* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
51 | | -* POSSIBILITY OF SUCH DAMAGE. |
52 | | -* |
53 | | -* Last modified: 21st Aug 2018 |
54 | | -* |
55 | | -* Authors: |
56 | | -* Michael Lehning <[email protected]> |
57 | | -* Jochen Sprickerhof <[email protected]> |
58 | | -* Martin Günther <[email protected]> |
59 | | -* |
60 | | -* Based on the TiM communication example by SICK AG. |
61 | | -* |
62 | | -* |
63 | | -* |
64 | | -* Copyright 2018 SICK AG |
65 | | -* Copyright 2018 Ing.-Büro Dr. Michael Lehning |
66 | | -
|
67 | | -
|
68 | | -
|
69 | | -*/ |
70 | | - |
71 | | -#include <stdio.h> |
72 | | -#include <stdlib.h> |
73 | | -#include <string.h> |
74 | | - |
75 | | -#include "sick_scan/sick_generic_laser.h" |
76 | | -#include "sick_scan/sick_generic_imu.h" |
77 | | -#include "sick_scan/binScanf.hpp" |
78 | | -#include "sick_scan/binPrintf.hpp" |
79 | | -#include "sick_scan/dataDumper.h" |
80 | | - |
81 | | -#ifdef _MSC_VER |
82 | | -#include "sick_scan/rosconsole_simu.hpp" |
83 | | -#endif |
84 | | - |
85 | | -#define MAX_NAME_LEN (1024) |
86 | | - |
87 | | -// 001.001.000 Switch to multithreaded processing of data |
88 | | -// 001.001.001: Documentation added |
89 | | -// 001.002.001: Bug in bin_scanf fixed (number of counted arguments was always 1) |
90 | | -// 001.002.002: MRS1xxx/LMS1xxx - legacy device ident cmd. changed to new device ident cmd |
91 | | -// 001.002.003: MRS1xxx/LMS1xxx - support of hector_slam integrated |
92 | | -// 001.002.004: RMS3xx - profiling and radar support optimized |
93 | | -// 001.002.005: Startup process changed to state machine |
94 | | -// 001.002.006: Signal handler for ctrl-c added |
95 | | -// 001.002.007: Fix for multi echo handling with lookup table |
96 | | -// 001.002.008: IMU Parser structure added |
97 | | -// 001.002.009: Application setting modified for MRS1104 |
98 | | -// 001.002.010: First version of IMU parser |
99 | | -// 001.002.011: Ip Address change added, bugfixing |
100 | | -// 001.003.000: Jan 2019 release 0.0.14 |
101 | | -// 001.003.001: Jan 2019 release 0.0.14 address handling for ip v4 parsing fixed |
102 | | -// 001.003.002: Feb 2019 Fixing and optimizing console output |
103 | | -// 001.003.016: Feb 2019 Profiling+instructions, Caching of Ros-Params |
104 | | -// 001.003.017: May 2019 stability issues, scan rate and angular resolution settings added |
105 | | -// 001.003.018: May 2019 LMS1000 Min/Max angel settings added and tested |
106 | | - |
107 | | -#define SICK_GENERIC_MAJOR_VER "001" |
108 | | -#define SICK_GENERIC_MINOR_VER "003" |
109 | | -#define SICK_GENERIC_PATCH_LEVEL "018" |
110 | | - |
111 | | -#include <algorithm> // for std::min |
112 | | - |
113 | | - |
114 | | - |
115 | | - |
116 | | -std::string getVersionInfo(); |
117 | | -/*! |
118 | | -\brief Startup routine - if called with no argmuments we assume debug session. |
119 | | - Set scanner name variable by parsing for "__name:=". This will be changed in the future |
120 | | - by setting a parameter. Calls mainGenericLaser after parsing. |
121 | | -
|
122 | | -\param argc: Number of Arguments |
123 | | -\param argv: Argument variable |
124 | | -\return exit-code |
125 | | -\sa mainGenericLaser |
126 | | -*/ |
127 | | -int main(int argc, char **argv) |
128 | | -{ |
129 | | - |
130 | | - |
131 | | - DataDumper::instance().writeToFileNameWhenBufferIsFull("/tmp/sickscan_debug.csv"); |
132 | | - char nameId[] = "__name:="; |
133 | | - char nameVal[MAX_NAME_LEN] = { 0 }; |
134 | | - char **argv_tmp; // argv_tmp[0][0] argv_tmp[0] identisch ist zu (*argv_tmp) |
135 | | - int argc_tmp; |
136 | | - std::string scannerName = "????"; |
137 | | - |
138 | | - // sick_scan::SickScanImu::imuParserTest(); |
139 | | - |
140 | | - argc_tmp = argc; |
141 | | - argv_tmp = argv; |
142 | | - |
143 | | - const int MAX_STR_LEN = 1024; |
144 | | - char nameTagVal[MAX_STR_LEN] = { 0 }; |
145 | | - char logTagVal[MAX_STR_LEN] = { 0 }; |
146 | | - char internalDebugTagVal[MAX_STR_LEN] = { 0 }; |
147 | | - char sensorEmulVal[MAX_STR_LEN] = { 0 }; |
148 | | - |
149 | | - if (argc == 1) // just for testing without calling by roslaunch |
150 | | - { |
151 | | - // recommended call for internal debugging as an example: __name:=sick_rms_320 __internalDebug:=1 |
152 | | - // strcpy(nameTagVal, "__name:=sick_rms_3xx"); // sick_rms_320 -> radar |
153 | | - strcpy(nameTagVal, "__name:=sick_tim_5xx"); // sick_rms_320 -> radar |
154 | | - strcpy(logTagVal, "__log:=/tmp/tmp.log"); |
155 | | - strcpy(internalDebugTagVal, "__internalDebug:=1"); |
156 | | - // strcpy(sensorEmulVal, "__emulSensor:=1"); |
157 | | - strcpy(sensorEmulVal, "__emulSensor:=0"); |
158 | | - argc_tmp = 5; |
159 | | - argv_tmp = (char **)malloc(sizeof(char *) * argc_tmp); |
160 | | - |
161 | | - argv_tmp[0] = argv[0]; |
162 | | - argv_tmp[1] = nameTagVal; |
163 | | - argv_tmp[2] = logTagVal; |
164 | | - argv_tmp[3] = internalDebugTagVal; |
165 | | - argv_tmp[4] = sensorEmulVal; |
166 | | - |
167 | | - } |
168 | | - // |
169 | | - std::string versionInfo = "sick_generic_caller V. "; |
170 | | - versionInfo += std::string(SICK_GENERIC_MAJOR_VER) + '.'; |
171 | | - versionInfo += std::string(SICK_GENERIC_MINOR_VER) + '.'; |
172 | | - versionInfo += std::string(SICK_GENERIC_PATCH_LEVEL); |
173 | | - |
174 | | - setVersionInfo(versionInfo); |
175 | | - ROS_INFO("%s", versionInfo.c_str()); |
176 | | - for (int i = 0; i < argc_tmp; i++) |
177 | | - { |
178 | | - if (strstr(argv_tmp[i], nameId) == argv_tmp[i]) |
179 | | - { |
180 | | - strcpy(nameVal, argv_tmp[i] + strlen(nameId)); |
181 | | - scannerName = nameVal; |
182 | | - } |
183 | | - ROS_INFO("Program arguments: %s", argv_tmp[i]); |
184 | | - } |
185 | | - |
186 | | - int result = mainGenericLaser(argc_tmp, argv_tmp, scannerName); |
187 | | - return result; |
188 | | - |
189 | | -} |
| 1 | +/** |
| 2 | +* \file |
| 3 | +* \brief Laser Scanner Entry Point |
| 4 | +* |
| 5 | +* Copyright (C) 2019,2018,2017, Ing.-Buero Dr. Michael Lehning, Hildesheim |
| 6 | +* Copyright (C) 2019,2018,2017, SICK AG, Waldkirch |
| 7 | +* |
| 8 | +* Licensed under the Apache License, Version 2.0 (the "License"); |
| 9 | +* you may not use this file except in compliance with the License. |
| 10 | +* You may obtain a copy of the License at |
| 11 | +* |
| 12 | +* http://www.apache.org/licenses/LICENSE-2.0 |
| 13 | +* |
| 14 | +* Unless required by applicable law or agreed to in writing, software |
| 15 | +* distributed under the License is distributed on an "AS IS" BASIS, |
| 16 | +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 17 | +* See the License for the specific language governing permissions and |
| 18 | +* limitations under the License. |
| 19 | +* |
| 20 | +* |
| 21 | +* All rights reserved. |
| 22 | +* |
| 23 | +* Redistribution and use in source and binary forms, with or without |
| 24 | +* modification, are permitted provided that the following conditions are met: |
| 25 | +* |
| 26 | +* * Redistributions of source code must retain the above copyright |
| 27 | +* notice, this list of conditions and the following disclaimer. |
| 28 | +* * Redistributions in binary form must reproduce the above copyright |
| 29 | +* notice, this list of conditions and the following disclaimer in the |
| 30 | +* documentation and/or other materials provided with the distribution. |
| 31 | +* * Neither the name of Osnabrück University nor the names of its |
| 32 | +* contributors may be used to endorse or promote products derived from |
| 33 | +* this software without specific prior written permission. |
| 34 | +* * Neither the name of SICK AG nor the names of its |
| 35 | +* contributors may be used to endorse or promote products derived from |
| 36 | +* this software without specific prior written permission |
| 37 | +* * Neither the name of Ing.-Buero Dr. Michael Lehning nor the names of its |
| 38 | +* contributors may be used to endorse or promote products derived from |
| 39 | +* this software without specific prior written permission |
| 40 | +* |
| 41 | +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 42 | +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 43 | +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 44 | +* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
| 45 | +* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 46 | +* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 47 | +* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 48 | +* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 49 | +* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 50 | +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 51 | +* POSSIBILITY OF SUCH DAMAGE. |
| 52 | +* |
| 53 | +* Last modified: 29 May 2019 |
| 54 | +* |
| 55 | +* Authors: |
| 56 | +* Michael Lehning <[email protected]> |
| 57 | +* Jochen Sprickerhof <[email protected]> |
| 58 | +* Martin Günther <[email protected]> |
| 59 | +* |
| 60 | +* Based on the TiM communication example by SICK AG. |
| 61 | +* |
| 62 | +* |
| 63 | +* |
| 64 | +* Copyright 2018/2019 SICK AG |
| 65 | +* Copyright 2018/2019 Ing.-Büro Dr. Michael Lehning |
| 66 | +
|
| 67 | +
|
| 68 | +
|
| 69 | +*/ |
| 70 | + |
| 71 | +#include <stdio.h> |
| 72 | +#include <stdlib.h> |
| 73 | +#include <string.h> |
| 74 | + |
| 75 | +#include "sick_scan/sick_generic_laser.h" |
| 76 | +#include "sick_scan/sick_generic_imu.h" |
| 77 | +#include "sick_scan/binScanf.hpp" |
| 78 | +#include "sick_scan/binPrintf.hpp" |
| 79 | +#include "sick_scan/dataDumper.h" |
| 80 | + |
| 81 | +#ifdef _MSC_VER |
| 82 | +#include "sick_scan/rosconsole_simu.hpp" |
| 83 | +#endif |
| 84 | + |
| 85 | +#define MAX_NAME_LEN (1024) |
| 86 | + |
| 87 | +// 001.001.000 Switch to multithreaded processing of data |
| 88 | +// 001.001.001: Documentation added |
| 89 | +// 001.002.001: Bug in bin_scanf fixed (number of counted arguments was always 1) |
| 90 | +// 001.002.002: MRS1xxx/LMS1xxx - legacy device ident cmd. changed to new device ident cmd |
| 91 | +// 001.002.003: MRS1xxx/LMS1xxx - support of hector_slam integrated |
| 92 | +// 001.002.004: RMS3xx - profiling and radar support optimized |
| 93 | +// 001.002.005: Startup process changed to state machine |
| 94 | +// 001.002.006: Signal handler for ctrl-c added |
| 95 | +// 001.002.007: Fix for multi echo handling with lookup table |
| 96 | +// 001.002.008: IMU Parser structure added |
| 97 | +// 001.002.009: Application setting modified for MRS1104 |
| 98 | +// 001.002.010: First version of IMU parser |
| 99 | +// 001.002.011: Ip Address change added, bugfixing |
| 100 | +// 001.003.000: Jan 2019 release 0.0.14 |
| 101 | +// 001.003.001: Jan 2019 release 0.0.14 address handling for ip v4 parsing fixed |
| 102 | +// 001.003.002: Feb 2019 Fixing and optimizing console output |
| 103 | +// 001.003.016: Feb 2019 Profiling+instructions, Caching of Ros-Params |
| 104 | +// 001.003.017: May 2019 stability issues, scan rate and angular resolution settings added |
| 105 | +// 001.003.018: May 2019 LMS1000 Min/Max angel settings added and tested |
| 106 | +// 001.003.020: May 2019 Bloom process prepared |
| 107 | +#define SICK_GENERIC_MAJOR_VER "001" |
| 108 | +#define SICK_GENERIC_MINOR_VER "003" |
| 109 | +#define SICK_GENERIC_PATCH_LEVEL "020" |
| 110 | + |
| 111 | +#include <algorithm> // for std::min |
| 112 | + |
| 113 | + |
| 114 | + |
| 115 | + |
| 116 | +std::string getVersionInfo(); |
| 117 | +/*! |
| 118 | +\brief Startup routine - if called with no argmuments we assume debug session. |
| 119 | + Set scanner name variable by parsing for "__name:=". This will be changed in the future |
| 120 | + by setting a parameter. Calls mainGenericLaser after parsing. |
| 121 | +
|
| 122 | +\param argc: Number of Arguments |
| 123 | +\param argv: Argument variable |
| 124 | +\return exit-code |
| 125 | +\sa mainGenericLaser |
| 126 | +*/ |
| 127 | +int main(int argc, char **argv) |
| 128 | +{ |
| 129 | + |
| 130 | + |
| 131 | + DataDumper::instance().writeToFileNameWhenBufferIsFull("/tmp/sickscan_debug.csv"); |
| 132 | + char nameId[] = "__name:="; |
| 133 | + char nameVal[MAX_NAME_LEN] = { 0 }; |
| 134 | + char **argv_tmp; // argv_tmp[0][0] argv_tmp[0] identisch ist zu (*argv_tmp) |
| 135 | + int argc_tmp; |
| 136 | + std::string scannerName = "????"; |
| 137 | + |
| 138 | + // sick_scan::SickScanImu::imuParserTest(); |
| 139 | + |
| 140 | + argc_tmp = argc; |
| 141 | + argv_tmp = argv; |
| 142 | + |
| 143 | + const int MAX_STR_LEN = 1024; |
| 144 | + char nameTagVal[MAX_STR_LEN] = { 0 }; |
| 145 | + char logTagVal[MAX_STR_LEN] = { 0 }; |
| 146 | + char internalDebugTagVal[MAX_STR_LEN] = { 0 }; |
| 147 | + char sensorEmulVal[MAX_STR_LEN] = { 0 }; |
| 148 | + |
| 149 | + if (argc == 1) // just for testing without calling by roslaunch |
| 150 | + { |
| 151 | + // recommended call for internal debugging as an example: __name:=sick_rms_320 __internalDebug:=1 |
| 152 | + // strcpy(nameTagVal, "__name:=sick_rms_3xx"); // sick_rms_320 -> radar |
| 153 | + strcpy(nameTagVal, "__name:=sick_tim_5xx"); // sick_rms_320 -> radar |
| 154 | + strcpy(logTagVal, "__log:=/tmp/tmp.log"); |
| 155 | + strcpy(internalDebugTagVal, "__internalDebug:=1"); |
| 156 | + // strcpy(sensorEmulVal, "__emulSensor:=1"); |
| 157 | + strcpy(sensorEmulVal, "__emulSensor:=0"); |
| 158 | + argc_tmp = 5; |
| 159 | + argv_tmp = (char **)malloc(sizeof(char *) * argc_tmp); |
| 160 | + |
| 161 | + argv_tmp[0] = argv[0]; |
| 162 | + argv_tmp[1] = nameTagVal; |
| 163 | + argv_tmp[2] = logTagVal; |
| 164 | + argv_tmp[3] = internalDebugTagVal; |
| 165 | + argv_tmp[4] = sensorEmulVal; |
| 166 | + |
| 167 | + } |
| 168 | + // |
| 169 | + std::string versionInfo = "sick_generic_caller V. "; |
| 170 | + versionInfo += std::string(SICK_GENERIC_MAJOR_VER) + '.'; |
| 171 | + versionInfo += std::string(SICK_GENERIC_MINOR_VER) + '.'; |
| 172 | + versionInfo += std::string(SICK_GENERIC_PATCH_LEVEL); |
| 173 | + |
| 174 | + setVersionInfo(versionInfo); |
| 175 | + ROS_INFO("%s", versionInfo.c_str()); |
| 176 | + for (int i = 0; i < argc_tmp; i++) |
| 177 | + { |
| 178 | + if (strstr(argv_tmp[i], nameId) == argv_tmp[i]) |
| 179 | + { |
| 180 | + strcpy(nameVal, argv_tmp[i] + strlen(nameId)); |
| 181 | + scannerName = nameVal; |
| 182 | + } |
| 183 | + ROS_INFO("Program arguments: %s", argv_tmp[i]); |
| 184 | + } |
| 185 | + |
| 186 | + int result = mainGenericLaser(argc_tmp, argv_tmp, scannerName); |
| 187 | + return result; |
| 188 | + |
| 189 | +} |
0 commit comments