25 #include <sys/socket.h> 26 #include <arpa/inet.h> 27 #include <sys/ioctl.h> 29 #include <sys/types.h> 51 SickLD::SickLD(
const std::string sick_ip_address,
const uint16_t sick_tcp_port ) :
53 _sick_ip_address(sick_ip_address),
54 _sick_tcp_port(sick_tcp_port),
55 _sick_sensor_mode(SICK_SENSOR_MODE_UNKNOWN),
56 _sick_motor_mode(SICK_MOTOR_MODE_UNKNOWN),
57 _sick_streaming_range_data(false),
58 _sick_streaming_range_and_echo_data(false)
93 std::cout <<
"\t*** Attempting to initialize the Sick LD..." << std::endl;
100 std::cout <<
"\t\tConnected to Sick LD!" << std::endl;
103 std::cout <<
"\tAttempting to start buffer monitor..." << std::endl;
105 std::cout <<
"\t\tBuffer monitor started!" << std::endl;
108 std::cout <<
"\tAttempting to sync driver with Sick LD..." << std::endl;
113 catch(SickIOException &sick_io_exception) {
114 std::cerr << sick_io_exception.
what() << std::endl;
118 catch(SickThreadException &sick_thread_exception) {
119 std::cerr << sick_thread_exception.
what() << std::endl;
123 catch(SickTimeoutException &sick_timeout_exception) {
124 std::cerr << sick_timeout_exception.
what() << std::endl;
129 std::cerr <<
"SickLD::Initialize - Unknown exception!" << std::endl;
133 std::cout <<
"\t\tSynchronized!" << std::endl;
151 throw SickIOException(
"SickLD::GetSickStatus: Device NOT Initialized!!!");
160 std::cerr << sick_timeout_exception.
what() << std::endl;
165 std::cerr << sick_io_exception.
what() << std::endl;
170 std::cerr <<
"SickLD::GetSickStatus - Unknown exception!" << std::endl;
191 const unsigned int num_active_sectors )
203 std::cout <<
"\tAttempting to set desired scan config..." << std::endl;
205 std::cout <<
"\t\tUsing desired scan area(s)!" << std::endl;
210 std::cerr << sick_io_exception.
what() << std::endl;
215 std::cerr << sick_timeout_exception.
what() << std::endl;
220 std::cerr << sick_config_exception.
what() << std::endl;
225 std::cerr <<
"SickLD::Initialize - Unknown exception!" << std::endl;
259 std::cerr << sick_timeout_exception.
what() << std::endl;
265 std::cerr << sick_io_exception.
what() << std::endl;
271 std::cerr << sick_error_exception.
what() << std::endl;
277 std::cerr <<
"SickLMS::SetSickTimeAbsolute: Unknown exception!!!" << std::endl;
283 std::cout <<
"\tSetting Sick LD absolute clock time..." << std::endl;
294 memcpy(&payload_buffer[2],&temp_buffer,2);
307 std::cerr << sick_timeout_exception.
what() << std::endl;
313 std::cerr << sick_io_exception.
what() << std::endl;
319 std::cerr <<
"SickLMS::_setSickSensorMode: Unknown exception!!!" << std::endl;
324 memset(payload_buffer,0,4);
331 memcpy(&clock_time,&payload_buffer[2],2);
334 std::cout <<
"\t\tClock time set!" << std::endl;
365 std::cerr << sick_timeout_exception.
what() << std::endl;
371 std::cerr << sick_io_exception.
what() << std::endl;
377 std::cerr << sick_error_exception.
what() << std::endl;
383 std::cerr <<
"SickLMS::SetSickTimeRelative: Unknown exception!!!" << std::endl;
389 std::cout <<
"\tSetting Sick LD relative clock time..." << std::endl;
400 memcpy(&payload_buffer[2],&temp_buffer,2);
413 std::cerr << sick_timeout_exception.
what() << std::endl;
419 std::cerr << sick_io_exception.
what() << std::endl;
425 std::cerr <<
"SickLMS::_setSickTimeRelative: Unknown exception!!!" << std::endl;
430 memset(payload_buffer,0,4);
437 memcpy(&clock_time,&payload_buffer[2],2);
440 std::cout <<
"\t\tClock time set!" << std::endl;
468 std::cerr << sick_timeout_exception.
what() << std::endl;
474 std::cerr << sick_io_exception.
what() << std::endl;
480 std::cerr << sick_error_exception.
what() << std::endl;
486 std::cerr <<
"SickLMS::_syncDriverWithSick: Unknown exception!!!" << std::endl;
501 throw SickIOException(
"SickLD::GetSickSignals: Device NOT Initialized!!!");
505 sick_signal_flags = 0;
525 std::cerr << sick_timeout_exception.
what() << std::endl;
531 std::cerr << sick_io_exception.
what() << std::endl;
537 std::cerr <<
"SickLMS::GetSickSignals: Unknown exception!!!" << std::endl;
542 memset(payload_buffer,0,2);
548 sick_signal_flags = payload_buffer[3];
562 throw SickIOException(
"SickLD::GetSickTime: Device NOT Initialized!!!");
583 std::cerr << sick_timeout_exception.
what() << std::endl;
589 std::cerr << sick_io_exception.
what() << std::endl;
595 std::cerr <<
"SickLMS::GetSickTime: Unknown exception!!!" << std::endl;
600 memset(payload_buffer,0,2);
606 uint16_t current_time;
607 memcpy(¤t_time,&payload_buffer[2],2);
624 throw SickIOException(
"SickLD::EnableNearfieldSuppression: Device NOT Initialized!!!");
628 std::cout <<
"\tEnabling nearfield suppression..." << std::endl;
634 catch (SickTimeoutException &sick_timeout_exception) {
635 std::cerr << sick_timeout_exception.
what() << std::endl;
640 catch (SickIOException &sick_io_exception) {
641 std::cerr << sick_io_exception.
what() << std::endl;
646 catch (SickErrorException &sick_error_exception) {
647 std::cerr << sick_error_exception.
what() << std::endl;
653 std::cerr <<
"SickLMS::EnableNearfieldSuppression: Unknown exception!!!" << std::endl;
657 std::cout <<
"\t\tSuppression is enabled!" << std::endl;
673 throw SickIOException(
"SickLD::DisableNearfieldSuppression: Device NOT Initialized!!!");
677 std::cout <<
"\tDisabling nearfield suppression..." << std::endl;
683 catch (SickTimeoutException &sick_timeout_exception) {
684 std::cerr << sick_timeout_exception.
what() << std::endl;
689 catch (SickIOException &sick_io_exception) {
690 std::cerr << sick_io_exception.
what() << std::endl;
695 catch (SickErrorException &sick_error_exception) {
696 std::cerr << sick_error_exception.
what() << std::endl;
702 std::cerr <<
"SickLMS::DisableNearfieldSuppression: Unknown exception!!!" << std::endl;
706 std::cout <<
"\t\tSuppression is disabled!" << std::endl;
741 unsigned int *
const echo_measurements,
742 unsigned int *
const num_measurements,
743 unsigned int *
const sector_ids,
744 unsigned int *
const sector_data_offsets,
745 double *
const sector_step_angles,
746 double *
const sector_start_angles,
747 double *
const sector_stop_angles,
748 unsigned int *
const sector_start_timestamps,
749 unsigned int *
const sector_stop_timestamps )
754 throw SickIOException(
"SickLD::GetSickMeasurements: Device NOT Initialized!!!");
774 std::cerr << sick_timeout_exception.
what() << std::endl;
780 std::cerr << sick_io_exception.
what() << std::endl;
786 std::cerr << sick_error_exception.
what() << std::endl;
792 std::cerr <<
"SickLMS::GetSickMeasurements: Unknown exception!!!" << std::endl;
815 std::cerr << sick_timeout_exception.
what() << std::endl;
821 std::cerr << sick_io_exception.
what() << std::endl;
827 std::cerr << sick_error_exception.
what() << std::endl;
833 std::cerr <<
"SickLMS::GetSickMeasurements: Unknown exception!!!" << std::endl;
845 if (echo_measurements != NULL) {
862 std::cerr << sick_timeout_exception.
what() << std::endl;
868 std::cerr << sick_io_exception.
what() << std::endl;
874 std::cerr << sick_error_exception.
what() << std::endl;
880 std::cerr <<
"SickLMS::_setSickSensorMode: Unknown exception!!!" << std::endl;
895 std::cerr << sick_timeout_exception.
what() << std::endl;
900 std::cerr <<
"SickLD::GetSickMeasurements - Unknown exception!" << std::endl;
923 throw SickConfigException(
"SickLD::GetSickMeasurements: Unexpected motor mode! (Are you using a valid motor speed!)");
934 if (echo_measurements != NULL) {
940 if (num_measurements != NULL) {
945 if (sector_ids != NULL) {
950 if (sector_data_offsets != NULL) {
951 sector_data_offsets[i] = total_measurements;
955 if (sector_step_angles != NULL) {
960 if (sector_start_angles != NULL) {
965 if (sector_stop_angles != NULL) {
970 if (sector_start_timestamps != NULL) {
975 if (sector_stop_timestamps != NULL) {
1011 std::cerr << sick_timeout_exception.
what() << std::endl;
1017 std::cerr << sick_io_exception.
what() << std::endl;
1023 std::cerr << sick_error_exception.
what() << std::endl;
1029 std::cerr <<
"SickLMS::SetSickSensorID: Unknown exception!!!" << std::endl;
1045 throw SickIOException(
"SickLD::SetSickMotorSpeed: Device NOT Initialized!!!");
1065 std::cerr << sick_timeout_exception.
what() << std::endl;
1071 std::cerr << sick_io_exception.
what() << std::endl;
1077 std::cerr << sick_error_exception.
what() << std::endl;
1083 std::cerr <<
"SickLMS::SetSickMotorSpeed: Unknown exception!!!" << std::endl;
1107 throw SickIOException(
"SickLD::SetSickScanResolution: Device NOT Initialized!!!");
1123 active_sector_start_angles,active_sector_stop_angles,
1141 const double sick_angle_step,
1142 const double *
const active_sector_start_angles,
1143 const double *
const active_sector_stop_angles,
1144 const unsigned int num_active_sectors )
1149 throw SickIOException(
"SickLD::SetSickGlobalParamsAndScanAreas: Device NOT Initialized!!!");
1155 active_sector_start_angles,active_sector_stop_angles,num_active_sectors);
1160 std::cerr << sick_timeout_exception.
what() << std::endl;
1166 std::cerr << sick_io_exception.
what() << std::endl;
1172 std::cerr << sick_config_exception.
what() << std::endl;
1178 std::cerr << sick_error_exception.
what() << std::endl;
1184 std::cerr <<
"SickLMS::SetSickGlobalParamsAndScanAreas: Unknown exception!!!" << std::endl;
1199 const double *
const active_sector_stop_angles,
1200 const unsigned int num_active_sectors )
1205 throw SickIOException(
"SickLD::SetSickScanAreas: Device NOT Initialized!!!");
1211 active_sector_start_angles,active_sector_stop_angles,num_active_sectors);
1216 std::cerr << sick_timeout_exception.
what() << std::endl;
1222 std::cerr << sick_io_exception.
what() << std::endl;
1228 std::cerr << sick_config_exception.
what() << std::endl;
1234 std::cerr << sick_error_exception.
what() << std::endl;
1240 std::cerr <<
"SickLMS::SetSickScanAreas: Unknown exception!!!" << std::endl;
1257 throw SickIOException(
"SickLD::ResetSick: Device NOT Initialized!!!");
1271 payload_buffer[3] = (uint8_t)reset_level;
1284 std::cerr << sick_timeout_exception.
what() << std::endl;
1290 std::cerr << sick_io_exception.
what() << std::endl;
1296 std::cerr <<
"SickLMS::_setSickSensorMode: Unknown exception!!!" << std::endl;
1301 memset(payload_buffer,0,4);
1307 uint16_t current_reset_level;
1308 memcpy(¤t_reset_level,&payload_buffer[2],2);
1312 if (current_reset_level != (uint16_t)reset_level) {
1358 std::ostringstream str_stream;
1366 return str_stream.str();
1377 std::ostringstream str_stream;
1385 return str_stream.str();
1396 std::ostringstream str_stream;
1404 return str_stream.str();
1502 std::stringstream str_stream;
1504 str_stream <<
"\t============= Sick LD Status =============" << std::endl;
1507 str_stream <<
"\t==========================================" << std::endl;
1509 return str_stream.str();
1519 std::ostringstream str_stream;
1521 str_stream <<
"\t============ Sick LD Identity ============" << std::endl;
1523 str_stream <<
"\tSensor Name: " <<
GetSickName() << std::endl;
1524 str_stream <<
"\tSensor Version: " <<
GetSickVersion() << std::endl;
1533 str_stream <<
"\t==========================================" << std::endl;
1535 return str_stream.str();
1545 std::stringstream str_stream;
1547 str_stream <<
"\t=========== Sick Global Config ===========" << std::endl;
1549 str_stream <<
"\tMotor Speed (5 to 20Hz): " <<
GetSickMotorSpeed() << std::endl;
1551 str_stream <<
"\t==========================================" << std::endl;
1553 return str_stream.str();
1563 std::stringstream str_stream;
1565 str_stream <<
"\t========== Sick Ethernet Config ==========" << std::endl;
1569 str_stream <<
"\t==========================================" << std::endl;
1571 return str_stream.str();
1581 std::stringstream str_stream;
1583 str_stream <<
"\t=========== Sick Sector Config ===========" << std::endl;
1587 str_stream <<
"\tSector Configs.:" << std::endl;
1589 str_stream <<
"\t\t" << i <<
" [" 1595 str_stream <<
"\t==========================================" << std::endl;
1597 return str_stream.str();
1663 throw SickIOException(
"SickLD::Uninitialize: Device NOT Initialized!!!");
1666 std::cout << std::endl <<
"\t*** Attempting to uninitialize the Sick LD..." << std::endl;
1671 std::cout <<
"\tSetting Sick LD to idle mode..." << std::endl;
1673 std::cout <<
"\t\tSick LD is now idle!" << std::endl;
1679 std::cout <<
"\tAttempting to cancel buffer monitor..." << std::endl;
1681 std::cout <<
"\t\tBuffer monitor canceled!" << std::endl;
1684 std::cout <<
"\tClosing connection to Sick LD..." << std::endl;
1690 catch (SickTimeoutException &sick_timeout_exception) {
1691 std::cerr << sick_timeout_exception.
what() << std::endl;
1696 catch (SickIOException &sick_io_exception) {
1697 std::cerr << sick_io_exception.
what() << std::endl;
1702 catch (SickErrorException &sick_error_exception) {
1703 std::cerr << sick_error_exception.
what() << std::endl;
1708 catch (SickThreadException &sick_thread_exception) {
1709 std::cerr << sick_thread_exception.
what() << std::endl;
1715 std::cerr <<
"SickLMS::_setSickSensorMode: Unknown exception!!!" << std::endl;
1719 std::cout <<
"\t\tConnection closed!" << std::endl;
1721 std::cout <<
"\t*** Uninit. complete - Sick LD is now offline!" << std::endl;
1735 if ((
_sick_fd = socket(PF_INET,SOCK_STREAM,IPPROTO_TCP)) < 0) {
1736 throw SickIOException(
"SickLD::_setupConnection: socket() failed!");
1757 if (errno != EINPROGRESS) {
1758 throw SickIOException(
"SickLD::_setupConnection: connect() failed!");
1763 int num_active_files = 0;
1764 struct timeval timeout_val;
1765 fd_set file_desc_set;
1768 FD_ZERO(&file_desc_set);
1772 memset(&timeout_val,0,
sizeof(timeout_val));
1776 num_active_files = select(getdtablesize(),0,&file_desc_set,0,&timeout_val);
1779 if (num_active_files > 0) {
1782 if (!FD_ISSET(
_sick_fd,&file_desc_set)) {
1783 throw SickIOException(
"SickLD::_setupConnection: Unexpected file descriptor!");
1787 socklen_t len =
sizeof(int);
1788 if (getsockopt(
_sick_fd,SOL_SOCKET,SO_ERROR,(
void*)(&valid_opt),&len) < 0) {
1789 throw SickIOException(
"SickLD::_setupConnection: getsockopt() failed!");
1794 throw SickIOException(
"SickLD::_setupConnection: socket error on connect()!");
1798 else if (num_active_files == 0) {
1801 throw SickTimeoutException(
"SickLD::_setupConnection: select() timeout!");
1807 throw SickIOException(
"SickLD::_setupConnection: select() failed!");
1818 catch(SickIOException &sick_io_exception) {
1819 std::cerr << sick_io_exception.
what() << std::endl;
1823 catch(SickTimeoutException &sick_timeout_exception) {
1824 std::cerr << sick_timeout_exception.
what() << std::endl;
1829 std::cerr <<
"SickLD::_setupConnection - Unknown exception occurred!" << std::endl;
1858 catch (SickTimeoutException &sick_timeout_exception) {
1859 std::cerr << sick_timeout_exception.
what() << std::endl;
1864 catch (SickIOException &sick_io_exception) {
1865 std::cerr << sick_io_exception.
what() << std::endl;
1870 catch (SickErrorException &sick_error_exception) {
1871 std::cerr << sick_error_exception.
what() << std::endl;
1877 std::cerr <<
"SickLMS::_syncDriverWithSick: Unknown exception!!!" << std::endl;
1891 const double sector_stop_angle,
const bool write_to_flash )
1904 std::cerr << sick_timeout_exception.
what() << std::endl;
1910 std::cerr << sick_io_exception.
what() << std::endl;
1916 std::cerr << sick_error_exception.
what() << std::endl;
1922 std::cerr <<
"SickLMS::_setSickSectorFunction: Unknown exception!!!" << std::endl;
1940 throw SickConfigException(
"SickLD::_setSickSectorFunction: Invalid sector function code!");
1952 uint16_t temp_buff = 0;
1959 payload_buffer[3] = sector_number;
1960 payload_buffer[5] = sector_function;
1964 memcpy(&payload_buffer[6],&temp_buff,2);
1967 payload_buffer[9] = (uint8_t)write_to_flash;
1980 std::cerr << sick_timeout_exception.
what() << std::endl;
1986 std::cerr << sick_io_exception.
what() << std::endl;
1992 std::cerr <<
"SickLMS::_setSickSectorFunction: Unknown exception!!!" << std::endl;
1997 memset(payload_buffer,0,10);
2003 if (payload_buffer[2] == 0xFF && payload_buffer[3] == 0xFF) {
2029 std::cerr << sick_timeout_exception.
what() << std::endl;
2035 std::cerr << sick_io_exception.
what() << std::endl;
2041 std::cerr << sick_error_exception.
what() << std::endl;
2047 std::cerr <<
"SickLMS::_getSickSectorFunction: Unknown exception!!!" << std::endl;
2059 payload_buffer[3] = sector_num;
2072 std::cerr << sick_timeout_exception.
what() << std::endl;
2078 std::cerr << sick_io_exception.
what() << std::endl;
2084 std::cerr <<
"SickLMS::_getSickSectorFunction: Unknown exception!!!" << std::endl;
2089 memset(payload_buffer,0,4);
2095 uint16_t temp_buffer = 0;
2096 memcpy(&temp_buffer,&payload_buffer[2],2);
2102 if (temp_buffer != sector_num) {
2103 throw SickConfigException(
"SickLD::_getSickSectorFunction: Unexpected sector number returned by Sick LD!");
2107 memcpy(&temp_buffer,&payload_buffer[4],2);
2111 memcpy(&temp_buffer,&payload_buffer[6],2);
2132 catch (SickTimeoutException &sick_timeout_exception) {
2133 std::cerr << sick_timeout_exception.
what() << std::endl;
2138 catch (SickIOException &sick_io_exception) {
2139 std::cerr << sick_io_exception.
what() << std::endl;
2144 catch (SickErrorException &sick_error_exception) {
2145 std::cerr << sick_error_exception.
what() << std::endl;
2151 std::cerr <<
"SickLMS::_setSickSensorModeToIdle: Unknown exception!!!" << std::endl;
2175 catch (SickTimeoutException &sick_timeout_exception) {
2176 std::cerr << sick_timeout_exception.
what() << std::endl;
2181 catch (SickIOException &sick_io_exception) {
2182 std::cerr << sick_io_exception.
what() << std::endl;
2187 catch (SickErrorException &sick_error_exception) {
2188 std::cerr << sick_error_exception.
what() << std::endl;
2194 std::cerr <<
"SickLMS::_setSickSensorModeToRotate: Unknown exception!!!" << std::endl;
2218 catch (SickTimeoutException &sick_timeout_exception) {
2219 std::cerr << sick_timeout_exception.
what() << std::endl;
2224 catch (SickIOException &sick_io_exception) {
2225 std::cerr << sick_io_exception.
what() << std::endl;
2230 catch (SickErrorException &sick_error_exception) {
2231 std::cerr << sick_error_exception.
what() << std::endl;
2237 std::cerr <<
"SickLMS::_setSickSensorModeToMeasure: Unknown exception!!!" << std::endl;
2282 std::cerr << sick_timeout_exception.
what() << std::endl;
2288 std::cerr << sick_io_exception.
what() << std::endl;
2294 std::cerr << sick_error_exception.
what() << std::endl;
2300 std::cerr <<
"SickLMS::_setSickSensorMode: Unknown exception!!!" << std::endl;
2308 uint32_t payload_length = 2;
2320 payload_length += 2;
2333 std::cerr << sick_timeout_exception.
what() << std::endl;
2339 std::cerr << sick_io_exception.
what() << std::endl;
2345 std::cerr <<
"SickLMS::_setSickSensorMode: Unknown exception!!!" << std::endl;
2350 memset(payload_buffer,0,payload_length);
2361 uint16_t return_code = 0;
2362 std::string errMsg =
"SickLD::_setSickSensorMode: Unexpected sensor mode returned from Sick LD!";
2363 memcpy(&return_code,&payload_buffer[6],2);
2376 throw SickErrorException(
"SickLD::_setSickSensorMode: Unexpected motor mode returned from Sick LD!");
2399 std::cerr << sick_timeout_exception.
what() << std::endl;
2405 std::cerr << sick_io_exception.
what() << std::endl;
2411 std::cerr << sick_error_exception.
what() << std::endl;
2417 std::cerr <<
"SickLMS::_setSickSensorMode: Unknown exception!!!" << std::endl;
2435 memcpy(&payload_buffer[2],&temp_buffer,2);
2438 temp_buffer = profile_format;
2440 memcpy(&payload_buffer[4],&temp_buffer,2);
2447 if (num_profiles == 0) {
2450 std::cout <<
"\tRequesting " << num_profiles <<
" " <<
_sickProfileFormatToString(profile_format) <<
" profiles from Sick LD..." << std::endl;
2460 std::cerr << sick_timeout_exception.
what() << std::endl;
2466 std::cerr << sick_io_exception.
what() << std::endl;
2472 std::cerr << sick_error_exception.
what() << std::endl;
2478 std::cerr <<
"SickLMS::_setSickSensorMode: Unknown exception!!!" << std::endl;
2483 memset(payload_buffer,0,6);
2489 memcpy(&temp_buffer,&payload_buffer[2],2);
2493 if (temp_buffer != profile_format) {
2494 throw SickErrorException(
"SickLD::_getSickScanProfiles: Incorrect profile format was returned by the Sick LD!");
2506 if (num_profiles == 0) {
2507 std::cout <<
"\t\tData stream started!" << std::endl;
2509 std::cout <<
"\t\tSick LD sending " << num_profiles <<
" scan profiles!" << std::endl;
2522 uint16_t profile_format = 0;
2523 unsigned int data_offset = 0;
2526 memcpy(&profile_format,&src_buffer[data_offset],2);
2531 profile_data.
num_sectors = src_buffer[data_offset+1];
2537 uint16_t temp_buffer;
2540 if (profile_format & 0x0001) {
2541 memcpy(&temp_buffer,&src_buffer[data_offset],2);
2547 if (profile_format & 0x0002) {
2548 memcpy(&temp_buffer,&src_buffer[data_offset],2);
2554 if (profile_format & 0x0004) {
2555 memcpy(&temp_buffer,&src_buffer[data_offset],2);
2563 for (
unsigned int i=0; i < profile_data.
num_sectors; i++) {
2566 if (profile_format & 0x0008) {
2567 memcpy(&temp_buffer,&src_buffer[data_offset],2);
2576 if (profile_format & 0x0010) {
2577 memcpy(&temp_buffer,&src_buffer[data_offset],2);
2586 if (profile_format & 0x0020) {
2587 memcpy(&temp_buffer,&src_buffer[data_offset],2);
2596 if (profile_format & 0x0040) {
2597 memcpy(&temp_buffer,&src_buffer[data_offset],2);
2606 if (profile_format & 0x0080) {
2607 memcpy(&temp_buffer,&src_buffer[data_offset],2);
2619 if (profile_format & 0x0100) {
2620 memcpy(&temp_buffer,&src_buffer[data_offset],2);
2629 if (profile_format & 0x0200) {
2630 memcpy(&temp_buffer,&src_buffer[data_offset],2);
2639 if (profile_format & 0x0400) {
2640 memcpy(&temp_buffer,&src_buffer[data_offset],2);
2651 if (profile_format & 0x0800) {
2652 memcpy(&temp_buffer,&src_buffer[data_offset],2);
2661 if (profile_format & 0x1000) {
2662 memcpy(&temp_buffer,&src_buffer[data_offset],2);
2673 if (profile_format & 0x2000) {
2674 profile_data.
sensor_status = src_buffer[data_offset+3] & 0x0F;
2675 profile_data.
motor_status = (src_buffer[data_offset+3] >> 4) & 0x0F;
2696 catch (SickTimeoutException &sick_timeout_exception) {
2697 std::cerr << sick_timeout_exception.
what() << std::endl;
2702 catch (SickIOException &sick_io_exception) {
2703 std::cerr << sick_io_exception.
what() << std::endl;
2708 catch (SickErrorException &sick_error_exception) {
2709 std::cerr << sick_error_exception.
what() << std::endl;
2715 std::cerr <<
"SickLMS::_cancelSickScanProfiles: Unknown exception!!!" << std::endl;
2730 std::cout <<
"\tStopping the data stream..." << std::endl;
2738 catch (SickTimeoutException &sick_timeout_exception) {
2739 std::cerr << sick_timeout_exception.
what() << std::endl;
2744 catch (SickIOException &sick_io_exception) {
2745 std::cerr << sick_io_exception.
what() << std::endl;
2751 std::cerr <<
"SickLMS::_getFirmwareName: Unknown exception!!!" << std::endl;
2756 memset(payload_buffer,0,2);
2767 throw SickErrorException(
"SickLD::_cancelSickScanProfiles: Sick LD returned sensor mode ERROR!");
2772 throw SickErrorException(
"SickLD::_cancelSickScanProfiles: Sick LD returned motor mode ERROR!");
2783 std::cout <<
"\t\tStream stopped!" << std::endl;
2803 std::cerr << sick_timeout_exception.
what() << std::endl;
2809 std::cerr << sick_io_exception.
what() << std::endl;
2815 std::cerr << sick_error_exception.
what() << std::endl;
2821 std::cerr <<
"SickLMS::_setSickFilter: Unknown exception!!!" << std::endl;
2834 payload_buffer[5] = suppress_code;
2847 std::cerr << sick_timeout_exception.
what() << std::endl;
2853 std::cerr << sick_io_exception.
what() << std::endl;
2859 std::cerr <<
"SickLMS::_setSickFilter: Unknown exception!!!" << std::endl;
2864 memset(payload_buffer,0,6);
2870 uint16_t filter_item;
2871 memcpy(&filter_item,&payload_buffer[2],2);
2876 throw SickErrorException(
"SickLD::_setSickFilter: Unexpected filter item returned from Sick LD!");
2904 catch (SickTimeoutException &sick_timeout_exception) {
2905 std::cerr << sick_timeout_exception.
what() << std::endl;
2910 catch (SickIOException &sick_io_exception) {
2911 std::cerr << sick_io_exception.
what() << std::endl;
2917 std::cerr <<
"SickLMS::_getSickIdentity: Unknown exception!!!" << std::endl;
2945 catch(SickTimeoutException &sick_timeout_exception) {
2946 std::cerr << sick_timeout_exception.
what() << std::endl;
2950 catch(SickIOException &sick_io_exception) {
2951 std::cerr << sick_io_exception.
what() << std::endl;
2956 std::cerr <<
"SickLD::_getSickStatus - Unknown exception!" << std::endl;
2961 memset(payload_buffer,0,2);
2998 std::cerr << sick_timeout_exception.
what() << std::endl;
3004 std::cerr << sick_io_exception.
what() << std::endl;
3010 std::cerr << sick_error_exception.
what() << std::endl;
3016 std::cerr <<
"SickLMS::_setSickGlobalConfig: Unknown exception!!!" << std::endl;
3031 payload_buffer[5] = sick_sensor_id;
3032 payload_buffer[7] = sick_motor_speed;
3037 memcpy(&payload_buffer[8],&temp_buffer,2);
3050 std::cerr << sick_timeout_exception.
what() << std::endl;
3056 std::cerr << sick_io_exception.
what() << std::endl;
3062 std::cerr <<
"SickLMS::_setSickGlobalConfig: Unknown exception!!!" << std::endl;
3067 memset(payload_buffer,0,10);
3073 if (payload_buffer[2] != 0 || payload_buffer[3] != 0) {
3074 throw SickErrorException(
"SickLD::_setSickGlobalConfig: Configuration setting was NOT sucessful!");
3096 catch (SickTimeoutException &sick_timeout_exception) {
3097 std::cerr << sick_timeout_exception.
what() << std::endl;
3102 catch (SickIOException &sick_io_exception) {
3103 std::cerr << sick_io_exception.
what() << std::endl;
3108 catch (SickErrorException &sick_error_exception) {
3109 std::cerr << sick_error_exception.
what() << std::endl;
3115 std::cerr <<
"SickLMS::_getSickGlobalConfig: Unknown exception!!!" << std::endl;
3137 catch (SickTimeoutException &sick_timeout_exception) {
3138 std::cerr << sick_timeout_exception.
what() << std::endl;
3143 catch (SickIOException &sick_io_exception) {
3144 std::cerr << sick_io_exception.
what() << std::endl;
3150 std::cerr <<
"SickLMS::_getSickGlobalConfig: Unknown exception!!!" << std::endl;
3155 memset(payload_buffer,0,4);
3161 uint16_t temp_buffer = 0;
3162 unsigned int data_offset = 2;
3163 memcpy(&temp_buffer,&payload_buffer[data_offset],2);
3169 throw SickErrorException(
"SickLD::_getSickGlobalConfig: Unexpected message contents!");
3183 memcpy(&temp_buffer,&payload_buffer[data_offset],2);
3201 catch (SickTimeoutException &sick_timeout_exception) {
3202 std::cerr << sick_timeout_exception.
what() << std::endl;
3207 catch (SickIOException &sick_io_exception) {
3208 std::cerr << sick_io_exception.
what() << std::endl;
3213 catch (SickErrorException &sick_error_exception) {
3214 std::cerr << sick_error_exception.
what() << std::endl;
3220 std::cerr <<
"SickLMS::_setSickSensorMode: Unknown exception!!!" << std::endl;
3241 catch (SickTimeoutException &sick_timeout_exception) {
3242 std::cerr << sick_timeout_exception.
what() << std::endl;
3247 catch (SickIOException &sick_io_exception) {
3248 std::cerr << sick_io_exception.
what() << std::endl;
3254 std::cerr <<
"SickLMS::_setSickSensorMode: Unknown exception!!!" << std::endl;
3259 memset(payload_buffer,0,4);
3265 uint16_t temp_buffer = 0;
3266 unsigned int data_offset = 2;
3267 memcpy(&temp_buffer,&payload_buffer[data_offset],2);
3273 throw SickErrorException(
"SickLD::_getSickEthernetConfig: Unexpected message contents!");
3277 for(
unsigned int i=0; i < 4; i++,data_offset+=2) {
3283 for(
unsigned int i=0; i < 4; i++,data_offset+=2) {
3289 for(
unsigned int i=0; i < 4; i++,data_offset+=2) {
3333 catch (SickTimeoutException &sick_timeout_exception) {
3334 std::cerr << sick_timeout_exception.
what() << std::endl;
3339 catch (SickIOException &sick_io_exception) {
3340 std::cerr << sick_io_exception.
what() << std::endl;
3345 catch (SickErrorException &sick_error_exception) {
3346 std::cerr << sick_error_exception.
what() << std::endl;
3352 std::cerr <<
"SickLMS::_getSickSectorConfig: Unknown exception!!!" << std::endl;
3404 payload_buffer[3] = id_request_code;
3417 std::cerr << sick_timeout_exception.
what() << std::endl;
3423 std::cerr << sick_io_exception.
what() << std::endl;
3429 std::cerr <<
"SickLMS::_getIdentificationString: Unknown exception!!!" << std::endl;
3434 memset(payload_buffer,0,4);
3440 id_return_string = (
char *) &payload_buffer[2];
3456 catch (SickTimeoutException &sick_timeout_exception) {
3457 std::cerr << sick_timeout_exception.
what() << std::endl;
3462 catch (SickIOException &sick_io_exception) {
3463 std::cerr << sick_io_exception.
what() << std::endl;
3469 std::cerr <<
"SickLMS::_getSensorPartNumber: Unknown exception!!!" << std::endl;
3487 catch (SickTimeoutException &sick_timeout_exception) {
3488 std::cerr << sick_timeout_exception.
what() << std::endl;
3493 catch (SickIOException &sick_io_exception) {
3494 std::cerr << sick_io_exception.
what() << std::endl;
3500 std::cerr <<
"SickLMS::_getSensorName: Unknown exception!!!" << std::endl;
3518 catch (SickTimeoutException &sick_timeout_exception) {
3519 std::cerr << sick_timeout_exception.
what() << std::endl;
3524 catch (SickIOException &sick_io_exception) {
3525 std::cerr << sick_io_exception.
what() << std::endl;
3531 std::cerr <<
"SickLMS::_getSensorVersion: Unknown exception!!!" << std::endl;
3548 catch (SickTimeoutException &sick_timeout_exception) {
3549 std::cerr << sick_timeout_exception.
what() << std::endl;
3554 catch (SickIOException &sick_io_exception) {
3555 std::cerr << sick_io_exception.
what() << std::endl;
3561 std::cerr <<
"SickLMS::_getSensorSerialNumber: Unknown exception!!!" << std::endl;
3578 catch (SickTimeoutException &sick_timeout_exception) {
3579 std::cerr << sick_timeout_exception.
what() << std::endl;
3584 catch (SickIOException &sick_io_exception) {
3585 std::cerr << sick_io_exception.
what() << std::endl;
3591 std::cerr <<
"SickLMS::_getSensorEDMSerialNumber: Unknown exception!!!" << std::endl;
3608 catch (SickTimeoutException &sick_timeout_exception) {
3609 std::cerr << sick_timeout_exception.
what() << std::endl;
3614 catch (SickIOException &sick_io_exception) {
3615 std::cerr << sick_io_exception.
what() << std::endl;
3621 std::cerr <<
"SickLMS::_getFirmwarePartNumber: Unknown exception!!!" << std::endl;
3638 catch (SickTimeoutException &sick_timeout_exception) {
3639 std::cerr << sick_timeout_exception.
what() << std::endl;
3644 catch (SickIOException &sick_io_exception) {
3645 std::cerr << sick_io_exception.
what() << std::endl;
3651 std::cerr <<
"SickLMS::_getFirmwareName: Unknown exception!!!" << std::endl;
3668 catch (SickTimeoutException &sick_timeout_exception) {
3669 std::cerr << sick_timeout_exception.
what() << std::endl;
3674 catch (SickIOException &sick_io_exception) {
3675 std::cerr << sick_io_exception.
what() << std::endl;
3681 std::cerr <<
"SickLMS::_getFirmwareVersion: Unknown exception!!!" << std::endl;
3698 catch (SickTimeoutException &sick_timeout_exception) {
3699 std::cerr << sick_timeout_exception.
what() << std::endl;
3704 catch (SickIOException &sick_io_exception) {
3705 std::cerr << sick_io_exception.
what() << std::endl;
3711 std::cerr <<
"SickLMS::_getApplicationSoftwarePartNumber: Unknown exception!!!" << std::endl;
3728 catch (SickTimeoutException &sick_timeout_exception) {
3729 std::cerr << sick_timeout_exception.
what() << std::endl;
3734 catch (SickIOException &sick_io_exception) {
3735 std::cerr << sick_io_exception.
what() << std::endl;
3741 std::cerr <<
"SickLMS::_getApplication Software Name: Unknown exception!!!" << std::endl;
3758 catch (SickTimeoutException &sick_timeout_exception) {
3759 std::cerr << sick_timeout_exception.
what() << std::endl;
3764 catch (SickIOException &sick_io_exception) {
3765 std::cerr << sick_io_exception.
what() << std::endl;
3771 std::cerr <<
"SickLMS::_getApplicationSoftwareVersion: Unknown exception!!!" << std::endl;
3787 const double *
const active_sector_start_angles,
3788 const double *
const active_sector_stop_angles,
3789 const unsigned int num_active_sectors )
3793 unsigned int num_sectors = 0;
3803 throw SickConfigException(
"SickLD::_setSickGlobalParamsAndScanAreas: Invalid number of active scan sectors!");
3808 throw SickConfigException(
"SickLD::_setSickGlobalParamsAndScanAreas: Invalid motor speed!");
3812 if (!
_validSickScanResolution(sick_angle_step,active_sector_start_angles,active_sector_stop_angles,num_active_sectors)) {
3813 throw SickConfigException(
"SickLD::_setSickGlobalParamsAndScanAreas: Invalid scan resolution!");
3817 memcpy(sorted_active_sector_start_angles,active_sector_start_angles,
sizeof(sorted_active_sector_start_angles));
3818 memcpy(sorted_active_sector_stop_angles,active_sector_stop_angles,
sizeof(sorted_active_sector_stop_angles));
3821 _sortScanAreas(sorted_active_sector_start_angles,sorted_active_sector_stop_angles,num_active_sectors);
3824 if (!
_validActiveSectors(sorted_active_sector_start_angles,sorted_active_sector_stop_angles,num_active_sectors)) {
3825 throw SickConfigException(
"SickLD::_setSickGlobalParamsAndScanAreas: Invalid sector configuration!");
3829 if (!
_validPulseFrequency(sick_motor_speed,sick_angle_step,sorted_active_sector_start_angles, sorted_active_sector_stop_angles,num_active_sectors)) {
3830 throw SickConfigException(
"SickLD::_setSickGlobalParamsAndScanAreas: Invalid pulse frequency!");
3834 _generateSickSectorConfig(sorted_active_sector_start_angles,sorted_active_sector_stop_angles,num_active_sectors,sick_angle_step,
3835 sector_functions,sector_stop_angles,num_sectors);
3854 std::cerr << sick_timeout_exception.
what() << std::endl;
3860 std::cerr << sick_io_exception.
what() << std::endl;
3866 std::cerr << sick_error_exception.
what() << std::endl;
3872 std::cerr <<
"SickLMS::_setSickGlobalParamsAndScanAreas: Unknown exception!!!" << std::endl;
3886 const double *
const active_sector_stop_angles,
3890 unsigned int num_sectors = 0;
3900 throw SickConfigException(
"_setSickTemporaryScanAreas: Invalid number of active scan sectors!");
3903 memcpy(sorted_active_sector_start_angles,active_sector_start_angles,
sizeof(sorted_active_sector_start_angles));
3904 memcpy(sorted_active_sector_stop_angles,active_sector_stop_angles,
sizeof(sorted_active_sector_stop_angles));
3907 _sortScanAreas(sorted_active_sector_start_angles,sorted_active_sector_stop_angles,num_active_sectors);
3910 if (!
_validActiveSectors(sorted_active_sector_start_angles,sorted_active_sector_stop_angles,num_active_sectors)) {
3911 throw SickConfigException(
"SickLD::_setSickGlobalParamsAndScanAreas: Invalid sector configuration!");
3916 sorted_active_sector_stop_angles,num_active_sectors)) {
3917 throw SickConfigException(
"SickLD::_setSickGlobalParamsAndScanAreas: Invalid pulse frequency!");
3922 sector_functions,sector_stop_angles,num_sectors);
3931 std::cerr << sick_timeout_exception.
what() << std::endl;
3937 std::cerr << sick_io_exception.
what() << std::endl;
3943 std::cerr << sick_error_exception.
what() << std::endl;
3949 std::cerr <<
"SickLMS::_setSickTemporaryScanAreas: Unknown exception!!!" << std::endl;
3964 const unsigned int num_sectors,
const bool write_to_flash )
3968 for (
unsigned int sector_id = 0; sector_id < num_sectors; sector_id++) {
3973 _setSickSectorFunction(sector_id,sector_functions[sector_id],sector_stop_angles[sector_id],write_to_flash);
3982 std::cerr << sick_timeout_exception.
what() << std::endl;
3988 std::cerr << sick_io_exception.
what() << std::endl;
3994 std::cerr << sick_error_exception.
what() << std::endl;
4000 std::cerr << sick_config_exception.
what() << std::endl;
4006 std::cerr <<
"SickLMS::_setSickSectorConfig: Unknown exception!!!" << std::endl;
4031 payload_buffer[3] = sick_signal_flags;
4044 std::cerr << sick_timeout_exception.
what() << std::endl;
4050 std::cerr << sick_io_exception.
what() << std::endl;
4056 std::cerr <<
"SickLMS::_setSickSensorMode: Unknown exception!!!" << std::endl;
4061 memset(payload_buffer,0,4);
4067 if (payload_buffer[2] != 0) {
4087 uint8_t byte_sequence[2] = {0};
4089 byte_sequence[0] = send_message.GetServiceCode() | 0x80;
4090 byte_sequence[1] = send_message.GetServiceSubcode();
4099 std::cerr << sick_timeout_exception.
what() << std::endl;
4105 std::cerr << sick_io_exception.
what() << std::endl;
4111 std::cerr <<
"SickLD::_sendMessageAndGetReply: Unknown exception!!!" << std::endl;
4123 int num_bytes_waiting = 0;
4131 if (ioctl(
_sick_fd,FIONREAD,&num_bytes_waiting)) {
4132 throw SickIOException(
"SickLD::_flushTCPRecvBuffer: ioctl() failed! (Couldn't get the number of bytes awaiting read!)");
4136 for (
int i = 0; i < num_bytes_waiting; i++) {
4146 catch(SickIOException &sick_io_exception) {
4147 std::cerr << sick_io_exception.
what() << std::endl;
4152 catch(SickThreadException &sick_thread_exception) {
4153 std::cerr << sick_thread_exception.
what() << std::endl;
4159 std::cerr <<
"SickLMS::_flushTerminalBuffer: Unknown exception!" << std::endl;
4172 throw SickIOException(
"SickLD::_teardownConnection: close() failed!");
4188 const double *
const active_sector_stop_angles,
4189 const unsigned int num_active_sectors,
4190 const double sick_angle_step,
4191 unsigned int *
const sector_functions,
4192 double *
const sector_stop_angles,
4193 unsigned int &num_sectors )
const {
4198 double final_diff = 0;
4199 if (num_active_sectors > 1) {
4202 for (
unsigned int i = 0; i < num_active_sectors; i++) {
4206 sector_stop_angles[num_sectors] = active_sector_stop_angles[i];
4210 if ((i < num_active_sectors - 1) && (active_sector_start_angles[i+1]-active_sector_stop_angles[i] >= 2*sick_angle_step)) {
4214 sector_stop_angles[num_sectors] = active_sector_start_angles[i+1] - sick_angle_step;
4222 if (active_sector_stop_angles[num_active_sectors-1] < active_sector_start_angles[0]) {
4223 final_diff = active_sector_start_angles[0] - active_sector_stop_angles[num_active_sectors-1];
4226 final_diff = active_sector_start_angles[0] + (360 - active_sector_stop_angles[num_active_sectors-1]);
4234 sector_stop_angles[num_sectors] = active_sector_stop_angles[0];
4238 if (active_sector_stop_angles[0] <= active_sector_start_angles[0]) {
4239 final_diff = active_sector_start_angles[0] - active_sector_stop_angles[num_active_sectors-1];
4242 final_diff = active_sector_start_angles[0] + (360 - active_sector_stop_angles[num_active_sectors-1]);
4248 if (final_diff >= 2*sick_angle_step) {
4252 sector_stop_angles[num_sectors] = active_sector_start_angles[0]-sick_angle_step +
4253 360*(sick_angle_step > active_sector_start_angles[0]);
4263 sector_stop_angles[num_sectors] = 0;
4276 return (((
double)ticks)/16);
4289 return (uint16_t)(angle*16);
4300 const double curr_angular_resolution )
const {
4313 const double curr_angular_resolution )
const {
4315 return total_scan_area*curr_motor_speed*(1/curr_angular_resolution);
4355 const double *
const sector_stop_angles,
const unsigned int num_sectors )
const {
4364 for(
unsigned int i = 0; i < num_sectors; i++) {
4367 if (fmod(sector_start_angles[i],sick_angle_step) != 0 || fmod(sector_stop_angles[i],sick_angle_step) != 0) {
4368 std::cerr <<
"Invalid scan resolution! (sector boundaries must be evenly divisible by the step angle)" << std::endl;
4404 const double *
const active_sector_start_angles,
4405 const double *
const active_sector_stop_angles,
4406 const unsigned int num_active_sectors )
const {
4409 double scan_area =
_computeScanArea(sick_angle_step,active_sector_start_angles,active_sector_stop_angles,num_active_sectors);
4413 std::cerr <<
"Max mean pulse frequency exceeded! (try a slower motor speed, a larger step angle and/or a smaller active scan area)" << std::endl;
4419 std::cerr <<
"Max pulse frequency exceeded! (try a slower motor speed, a larger step angle and/or a smaller active scan area)" << std::endl;
4445 const double *
const active_sector_stop_angles,
const unsigned int num_active_sectors )
const {
4448 double total_scan_area = 0;
4449 double curr_sector_scan_area = 0;
4452 for (
unsigned int i = 0; i < num_active_sectors; i++) {
4455 curr_sector_scan_area = fabs(active_sector_start_angles[i]-active_sector_stop_angles[i]);
4458 total_scan_area += curr_sector_scan_area + sick_angle_step;
4462 return total_scan_area;
4473 const unsigned int num_sectors )
const {
4479 for (
unsigned int i = 0; i < num_sectors; i++) {
4480 for (
unsigned int j = (num_sectors-1); j > i; j--) {
4481 if (sector_start_angles[j] < sector_start_angles[j-1]) {
4482 SWAP_VALUES(sector_start_angles[j],sector_start_angles[j-1],temp);
4483 SWAP_VALUES(sector_stop_angles[j],sector_stop_angles[j-1],temp);
4497 const unsigned int num_sectors )
const {
4500 for (
unsigned int i = 0; i < num_sectors; i++) {
4502 if (sector_start_angles[i] < 0 || sector_stop_angles[i] < 0 ||
4503 sector_start_angles[i] >= 360 || sector_stop_angles[i] >= 360) {
4505 std::cerr <<
"Invalid sector config! (all degree values must be in [0,360))" << std::endl;
4512 if (num_sectors > 1) {
4515 for (
unsigned int i = 0; i < (num_sectors - 1); i++) {
4516 if (sector_start_angles[i] > sector_stop_angles[i] || sector_stop_angles[i] >= sector_start_angles[i+1]) {
4517 std::cerr <<
"Invalid sector definitions! (check sector bounds)" << std::endl;
4523 if (sector_stop_angles[num_sectors-1] <= sector_start_angles[num_sectors-1] &&
4524 sector_stop_angles[num_sectors-1] >= sector_start_angles[0]) {
4525 std::cerr <<
"Invalid sector definitions! (check sector bounds)" << std::endl;
4543 switch(profile_format) {
4559 std::cout <<
"\t---- Sector Data " << sector_data.
sector_num <<
" ----" << std::endl;
4560 std::cout <<
"\tSector Num.: " << sector_data.
sector_num << std::endl;
4561 std::cout <<
"\tSector Angle Step (deg): " << sector_data.
angle_step<< std::endl;
4562 std::cout <<
"\tSector Num. Data Points: " << sector_data.
num_data_points << std::endl;
4563 std::cout <<
"\tSector Start Timestamp (ms): " << sector_data.
timestamp_start << std::endl;
4564 std::cout <<
"\tSector Stop Timestamp (ms): " << sector_data.
timestamp_stop << std::endl;
4565 std::cout <<
"\tSector Start Angle (deg): " << sector_data.
angle_start << std::endl;
4566 std::cout <<
"\tSector Stop Angle (deg): " << sector_data.
angle_stop << std::endl;
4567 std::cout << std::flush;
4578 std::cout <<
"\t========= Sick Scan Prof. =========" << std::endl;
4579 std::cout <<
"\tProfile Num.: " << profile_data.
profile_number << std::endl;
4580 std::cout <<
"\tProfile Counter: " << profile_data.
profile_counter << std::endl;
4581 std::cout <<
"\tLayer Num.: " << profile_data.
layer_num << std::endl;
4584 std::cout <<
"\tNum. Sectors: " << profile_data.
num_sectors << std::endl;
4587 for (
unsigned int i=0; i < profile_data.
num_sectors && print_sector_data; i++) {
4591 std::cout <<
"\t====================================" << std::endl;
4592 std::cout << std::flush;
4602 switch(sick_sensor_mode) {
4610 std::cerr <<
"SickLD::_sickSensorModeToWorkServiceSubcode: Invalid sensor mode! (Returning 0)" << std::endl;
4622 switch(sick_sensor_mode) {
4626 return "ROTATE (laser is off)";
4628 return "MEASURE (laser is on)";
4634 return "UNRECOGNIZED!!!";
4645 switch(sick_motor_mode) {
4649 return "SPIN TOO HIGH";
4651 return "SPIN TOO LOW";
4657 return "UNRECOGNIZED!!!";
4668 switch(return_value) {
4670 return "LD-OEM/LD-LRS Measures";
4672 return "Max Pulse Frequency Too High";
4674 return "Mean Pulse Frequency Too High";
4676 return "Sector Borders Not Configured Correctly";
4678 return "Sector Borders Not Multiple of Angle Step";
4680 return "UNRECOGNIZED!!!";
4692 switch(reset_level) {
4694 return "RESET (CPU Reinitialized)";
4696 return "RESET (CPU Not Reinitialized)";
4698 return "RESET (Halt App. and Enter IDLE)";
4700 return "UNRECOGNIZED!!!";
4712 switch(sick_sector_function) {
4714 return "NOT INITIALIZED";
4716 return "NOT MEASURING";
4724 return "UNRECOGNIZED!!!";
4736 switch(profile_format) {
4738 return "RANGE ONLY";
4740 return "RANGE + ECHO";
4742 return "UNRECOGNIZED!!!";
4752 std::cout <<
"\t*** Init. complete: Sick LD is online and ready!" << std::endl;
4756 std::cout << std::endl;
Contains some simple exception classes.
#define DEFAULT_SICK_CONNECT_TIMEOUT
The max time to wait before considering a connection attempt as failed (usecs)
Defines a class for monitoring the receive buffer when interfacing w/ a Sick LMS LIDAR.
Defines the SickLD class for working with the Sick LD-OEM/LD-LRS long range LIDARs.
Defines simple utility functions for working with the Sick LD.
Defines the class SickLDMessage.
#define SWAP_VALUES(x, y, t)
A simple macro for swapping two values.
#define DEFAULT_SICK_MESSAGE_TIMEOUT
The max time to wait for a message reply (usecs)