direcs  2012-09-30
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
SickS300 Class Reference

Gives access to a SICK laser scanner S300 Standard (not Professional!). More...

#include <laserSickS300.h>

Collaboration diagram for SickS300:

List of all members.

Signals

void message (QString text)

Public Member Functions

int closeComPort ()
float getDistance (int angleIndex)
bool openComPort ()
int readRequestTelegram ()
int readUnknownTelegram ()
bool receiveChar (unsigned char *character)
bool sendChar (unsigned char character)
void setDevicePort (QString serialPort)
int setup ()
 SickS300 ()
 ~SickS300 ()

Private Attributes

int baudRate
float distances [540]
 if a measured laser distance is greater than this value in cm, it will be set to 0 cm! (This is due to a bug when reading angle 0)
QString laserSerialPort
unsigned char scanData [LASERSAMPLES]
DirecsSerialserialPort

Static Private Attributes

static const float LASERMAXLENGTH = 2000
static const unsigned int LASERSAMPLES = 1082
 the path to the serial device. e.g. /dev/ttyUSB0
static const bool OFF = false
 For laser is "ON".
static const bool ON = true

Detailed Description

Gives access to a SICK laser scanner S300 Standard (not Professional!).

Author:
Markus Knapp

Definition at line 38 of file laserSickS300.h.


Constructor & Destructor Documentation

SickS300::SickS300 ( )

Constructor

Definition at line 24 of file laserSickS300.cpp.

Here is the call graph for this function:

SickS300::~SickS300 ( )

Destructor

Definition at line 62 of file laserSickS300.cpp.

Here is the call graph for this function:


Member Function Documentation

int SickS300::closeComPort ( )

Closes the serial port

Returns:
0 if things go well, and -1 otherwise.

Definition at line 111 of file laserSickS300.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

float SickS300::getDistance ( int  angleIndex)

Returns the measured distance of a specific laser angle index.

Parameters:
angleIndexis the number of the angle. Since we have a half degree resolution, an angeleIndex of 0 means 0.0 deg, 1 means 0.5, 2 means 1.0 degrees, and so on.
Returns:
the distance

Definition at line 673 of file laserSickS300.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void SickS300::message ( QString  text)
signal

Emits a info or error message to a slot. This slot can be used to display a text on a splash screen, log file, to print it to a console...

Parameters:
textis the message to be emitted

Here is the caller graph for this function:

bool SickS300::openComPort ( )

Opens a serial port/device. On POSIX systems this looks like "/dev/tty4" or "/dev/ttyUSB0".

Returns:
true on access or false if an error occured.

Definition at line 80 of file laserSickS300.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int SickS300::readRequestTelegram ( )

Reads a telegram from the laser scanner in the request mode.

Returns:
0 if things go well, and -1 otherwise.
Todo:
check laser S300 CRC !!

Definition at line 238 of file laserSickS300.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int SickS300::readUnknownTelegram ( )

Reads a special unknown telegram from the laser scanner in the request mode. It reads block 0B, but I don't know whats stored there...

Returns:
0 if things go well, and -1 otherwise.
Todo:
check laser S300 CRC !!

Definition at line 518 of file laserSickS300.cpp.

Here is the call graph for this function:

bool SickS300::receiveChar ( unsigned char *  character)

Receives a character from the serial port/device.

Parameters:
character
Returns:
true on access or false if an error occured.

Definition at line 174 of file laserSickS300.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool SickS300::sendChar ( unsigned char  character)

Sends a character to the serial port/device.

Parameters:
character
Returns:
true on access or false if an error occured.

Definition at line 158 of file laserSickS300.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void SickS300::setDevicePort ( QString  serialPort)

Sets the serial port. Has to be set before using

See also:
openComPort. On POSIX systems this looks like "/dev/tty4" or "/dev/ttyUSB0".

Definition at line 74 of file laserSickS300.cpp.

Here is the caller graph for this function:

int SickS300::setup ( )

Set up the device.

Returns:
0 if things go well, and -1 otherwise.

Definition at line 189 of file laserSickS300.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

int SickS300::baudRate
private

Definition at line 121 of file laserSickS300.h.

float SickS300::distances[540]
private

if a measured laser distance is greater than this value in cm, it will be set to 0 cm! (This is due to a bug when reading angle 0)

Definition at line 129 of file laserSickS300.h.

const float SickS300::LASERMAXLENGTH = 2000
staticprivate

Definition at line 127 of file laserSickS300.h.

const unsigned int SickS300::LASERSAMPLES = 1082
staticprivate

the path to the serial device. e.g. /dev/ttyUSB0

Definition at line 124 of file laserSickS300.h.

QString SickS300::laserSerialPort
private

Definition at line 122 of file laserSickS300.h.

const bool SickS300::OFF = false
staticprivate

For laser is "ON".

Definition at line 132 of file laserSickS300.h.

const bool SickS300::ON = true
staticprivate

Definition at line 131 of file laserSickS300.h.

unsigned char SickS300::scanData[LASERSAMPLES]
private

Definition at line 125 of file laserSickS300.h.

DirecsSerial* SickS300::serialPort
private

Definition at line 120 of file laserSickS300.h.


The documentation for this class was generated from the following files: