Namespaces | Macros | Functions | Variables
sick_scan_common.cpp File Reference

Laser Scanner communication main routine. More...

#include <sick_scan/sick_scan_common_nw.h>
#include <sick_scan/sick_scan_common.h>
#include <sick_scan/sick_scan_messages.h>
#include <sick_scan/sick_generic_radar.h>
#include <sick_scan/sick_generic_field_mon.h>
#include <sick_scan/helper/angle_compensator.h>
#include <sick_scan/sick_scan_config_internal.h>
#include <sick_scan/sick_scan_parse_util.h>
#include <sick_scan/sick_lmd_scandata_parser.h>
#include <sick_scan/sick_nav_scandata_parser.h>
#include "sick_scan/binScanf.hpp"
#include "sick_scan/dataDumper.h"
#include <cstdio>
#include <cstring>
#include <math.h>
#include <float.h>
#include "sick_scan/tcp/colaa.hpp"
#include "sick_scan/tcp/colab.hpp"
#include <map>
#include <climits>
#include <sick_scan/sick_generic_imu.h>
#include <sick_scan/sick_scan_services.h>
Include dependency graph for sick_scan_common.cpp:

Go to the source code of this file.

Namespaces

 sick_scan_xd
 

Macros

#define _USE_MATH_DEFINES
 
#define deg2rad_const   (0.017453292519943295769236907684886f)
 
#define rad2deg(x)   ((x) / M_PI * 180.0)
 
#define RETURN_ERROR_ON_RESPONSE_TIMEOUT(result, reply)   if(((result)!=ExitSuccess)&&((reply).empty()))return(ExitError)
 

Functions

const std::string binScanfGetStringFromVec (std::vector< unsigned char > *replyDummy, int off, long len)
 return diagnostic error code (small helper function) This small helper function was introduced to allow the compiling under Visual c++. More...
 
static bool & isFieldEvaluationActive ()
 
static std::vector< int > parseFirmwareVersion (const std::string &scannertype, const std::string &deviceIdentStr)
 
unsigned char sick_scan_xd::sick_crc8 (unsigned char *msgBlock, int len)
 calculate crc-code for last byte of binary message XOR-calucation is done ONLY over message content (i.e. skipping the first 8 Bytes holding 0x02020202 <Length Information as 4-byte long>) More...
 
std::vector< unsigned char > stringToVector (std::string s)
 Universal swapping function. More...
 
std::string sick_scan_xd::stripControl (std::vector< unsigned char > s, int max_strlen=-1)
 Converts a SOPAS command to a human readable string. More...
 
void swap_endian (unsigned char *ptr, int numBytes)
 Universal swapping function. More...
 

Variables

static const int MAX_STR_LEN = 1024
 

Detailed Description

Laser Scanner communication main routine.

Copyright (C) 2013, Osnabrueck University Copyright (C) 2017-2022, Ing.-Buero Dr. Michael Lehning, Hildesheim Copyright (C) 2017-2022, SICK AG, Waldkirch

All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright
  notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
  notice, this list of conditions and the following disclaimer in the
  documentation and/or other materials provided with the distribution.
* Neither the name of Osnabrueck University nor the names of its
  contributors may be used to endorse or promote products derived from
  this software without specific prior written permission.
* Neither the name of SICK AG nor the names of its
  contributors may be used to endorse or promote products derived from
  this software without specific prior written permission
* Neither the name of Ing.-Buero Dr. Michael Lehning nor the names of its
  contributors may be used to endorse or promote products derived from
  this software without specific prior written permission

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Last modified: 28th May 2018

Authors:
   Michael Lehning <michael.lehning@lehning.de>
   Jochen Sprickerhof <jochen@sprickerhof.de>
   Martin Günther <mguenthe@uos.de>

Based on the TiM communication example by SICK AG.

Definition in file sick_scan_common.cpp.

Macro Definition Documentation

◆ _USE_MATH_DEFINES

#define _USE_MATH_DEFINES

Definition at line 92 of file sick_scan_common.cpp.

◆ deg2rad_const

#define deg2rad_const   (0.017453292519943295769236907684886f)

Definition at line 101 of file sick_scan_common.cpp.

◆ rad2deg

#define rad2deg (   x)    ((x) / M_PI * 180.0)

Definition at line 98 of file sick_scan_common.cpp.

◆ RETURN_ERROR_ON_RESPONSE_TIMEOUT

#define RETURN_ERROR_ON_RESPONSE_TIMEOUT (   result,
  reply 
)    if(((result)!=ExitSuccess)&&((reply).empty()))return(ExitError)

Definition at line 116 of file sick_scan_common.cpp.

Function Documentation

◆ binScanfGetStringFromVec()

const std::string binScanfGetStringFromVec ( std::vector< unsigned char > *  replyDummy,
int  off,
long  len 
)

return diagnostic error code (small helper function) This small helper function was introduced to allow the compiling under Visual c++.

Returns
Diagnostic error code (value 2)

Convert part of unsigned char vector into a std::string

Parameters
replyDummyPointer to byte block hold in vector
offStarting Position for copy command
lenNumber of bytes which should be copied
Returns
result of copy action as std::string

Definition at line 176 of file sick_scan_common.cpp.

◆ isFieldEvaluationActive()

static bool& isFieldEvaluationActive ( )
static

Definition at line 206 of file sick_scan_common.cpp.

◆ parseFirmwareVersion()

static std::vector<int> parseFirmwareVersion ( const std::string &  scannertype,
const std::string &  deviceIdentStr 
)
static

Definition at line 188 of file sick_scan_common.cpp.

◆ stringToVector()

std::vector<unsigned char> stringToVector ( std::string  s)

Universal swapping function.

<todo> doku.

Parameters
ptrPointer to datablock
numBytes: size of variable in bytes

Definition at line 145 of file sick_scan_common.cpp.

◆ swap_endian()

void swap_endian ( unsigned char *  ptr,
int  numBytes 
)

Universal swapping function.

Parameters
ptrPointer to datablock
numBytes: size of variable in bytes

Definition at line 125 of file sick_scan_common.cpp.

Variable Documentation

◆ MAX_STR_LEN

const int MAX_STR_LEN = 1024
static

Definition at line 118 of file sick_scan_common.cpp.



sick_scan_xd
Author(s): Michael Lehning , Jochen Sprickerhof , Martin Günther
autogenerated on Fri Oct 25 2024 02:47:14