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

This class handles all the low level laser stuff for the old laser scanners. More...

#include <laser.h>

Collaboration diagram for Laser:

List of all members.

Classes

struct  direcs_laser_laser_config_t
struct  direcs_param_t
struct  laser_device_t
struct  laser_settings_t
struct  sick_laser_t

Public Types

enum  direcs_laser_laser_type_t {
  SICK_LMS = 0, SICK_PLS = 1, HOKUYO_URG = 2, SIMULATED_LASER = 3,
  UMKNOWN_PROXIMITY_SENSOR = 99
}
enum  direcs_laser_remission_type_t { REMISSION_NONE = 0, REMISSION_DIRECT = 1, REMISSION_NORMALIZED = 2 }
typedef void(* direcs_param_change_handler_t )(char *module, char *variable, char *value)
typedef struct
Laser::direcs_param_t
direcs_param_p
typedef char direcs_param_type_t
 For the direcs laserThread.
typedef struct
Laser::laser_device_t
laser_device_p
enum  laser_model_t { PLS, LMS }
enum  parity_t { N, E, O }
enum  range_dist_t {
  SICK_RANGE80M, SICK_RANGE160M, SICK_RANGE320M, SICK_REMISSION_NORM,
  SICK_REMISSION_DIRECT
}
enum  range_res_t { CM, MM, DM }
typedef struct
Laser::sick_laser_t
sick_laser_p

Signals

void message (QString text)

Public Member Functions

void check_parameter_settings (sick_laser_p laser)
double direcs_degrees_to_radians (double theta)
double direcs_get_time (void)
int direcs_laser_run (void)
void direcs_laser_shutdown (int x)
int direcs_laser_start (short int laserScanner)
double direcs_radians_to_degrees (double theta)
float getLaserDistance (int laser, int angle)
int getLaserNumReadings (int laser)
void interpret_params (sick_laser_p laser, QString dev, QString type, double res, QString rem, double fov)
 Laser ()
void read_parameters (short int laserScanner)
void set_default_parameters (sick_laser_p laser, int laser_num)
void set_laser_config_structure (sick_laser_p laser, direcs_laser_laser_config_t *config)
void setDevicePort (short int laser, QString serialPort)
void shutdown_laser (int x)
int sick_connect_device (sick_laser_p laser)
void sick_handle_laser (sick_laser_p laser)
int sick_start_laser (sick_laser_p laser)
void sick_stop_laser (sick_laser_p laser)
 ~Laser ()

Public Attributes

sick_laser_tlaser1
direcs_laser_laser_config_tlaser1_config
sick_laser_tlaser2
direcs_laser_laser_config_tlaser2_config
sick_laser_tlaser3
direcs_laser_laser_config_tlaser3_config
sick_laser_tlaser4
direcs_laser_laser_config_tlaser4_config
sick_laser_tlaser5
direcs_laser_laser_config_tlaser5_config
QString laserSerialPort1
QString laserSerialPort2
QString laserSerialPort3
QString laserSerialPort4
QString laserSerialPort5
int quit_signal
int use_laser1
int use_laser2
int use_laser3
int use_laser4
int use_laser5

Static Public Attributes

static const short int LASER1 = 1
static const short int LASER2 = 2
 For the direcs laserThread.
static const short int LASER3 = 4
 For the direcs laserThread.
static const short int LASER4 = 8
 For the direcs laserThread.
static const short int LASER5 = 16
 For the direcs laserThread.

Private Member Functions

int cBaudrate (int baudrate)
int cDataSize (int numbits)
int cFlowControl (int flowcontrol)
int cParity (parity_t par)
int cStopSize (int numbits)
int iParity (parity_t par)
int iSoftControl (int flowcontrol)
int kernel_minimum_version (int a, int b, int c)
void sick_allocate_laser (sick_laser_p laser)
int sick_check_baudrate (sick_laser_p laser, int brate)
int sick_compute_checksum (unsigned char *CommData, int uLen)
int sick_detect_baudrate (sick_laser_p laser)
void sick_install_settings (sick_laser_p laser)
int sick_parse_conf_data (sick_laser_p laser, unsigned char *buf, int length)
void sick_process_packet (sick_laser_p laser, unsigned char *packet)
void sick_process_packet_distance (sick_laser_p laser, unsigned char *packet)
void sick_process_packet_remission (sick_laser_p laser, unsigned char *packet)
int sick_read_data (sick_laser_p laser, unsigned char *data, double timeout)
int sick_request_lms_config (sick_laser_p laser)
void sick_request_sensor (sick_laser_p laser)
void sick_request_status (sick_laser_p laser)
int sick_serial_connect (sick_laser_p laser)
void sick_set_baudrate (sick_laser_p laser, int brate)
int sick_set_config_mode (sick_laser_p laser)
int sick_set_laser_baudrate (sick_laser_p laser, int brate)
int sick_set_lms_config (sick_laser_p laser, unsigned char *data, int len)
int sick_set_lms_range (sick_laser_p laser)
int sick_set_lms_resolution (sick_laser_p laser)
int sick_set_serial_params (sick_laser_p laser)
void sick_start_continuous_mode (sick_laser_p laser)
void sick_start_continuous_remission_part_mode (sick_laser_p laser)
void sick_stop_continuous_mode (sick_laser_p laser)
int sick_testBaudrate (sick_laser_p laser, int brate)
int sick_valid_packet (unsigned char *data, long size, long *offset, long *len)
int sick_write_command (sick_laser_p laser, unsigned char command, unsigned char *argument, int arg_length)

Private Attributes

DirecsSerialserialPort

Detailed Description

This class handles all the low level laser stuff for the old laser scanners.

Currently supported are SICK LMS, PLS or HOKUYO_URG.

Definition at line 187 of file laser.h.


Member Typedef Documentation

typedef void(* Laser::direcs_param_change_handler_t)(char *module, char *variable, char *value)

Definition at line 208 of file laser.h.

For the direcs laserThread.

This data structure is used by direcs_param_install_params and direcs_param_usage to load and report the usage of a large number of parameters.

Definition at line 206 of file laser.h.


Member Enumeration Documentation

defines the type of laser that is used

Enumerator:
SICK_LMS 
SICK_PLS 
HOKUYO_URG 
SIMULATED_LASER 
UMKNOWN_PROXIMITY_SENSOR 

Definition at line 288 of file laser.h.

Possible remission values

Enumerator:
REMISSION_NONE 
REMISSION_DIRECT 
REMISSION_NORMALIZED 

Definition at line 300 of file laser.h.

Enumerator:
PLS 
LMS 

Definition at line 228 of file laser.h.

Enumerator:
N 
E 
O 

Definition at line 231 of file laser.h.

Enumerator:
SICK_RANGE80M 
SICK_RANGE160M 
SICK_RANGE320M 
SICK_REMISSION_NORM 
SICK_REMISSION_DIRECT 

Definition at line 230 of file laser.h.

Enumerator:
CM 
MM 
DM 

Definition at line 229 of file laser.h.


Constructor & Destructor Documentation

Laser::Laser ( )

Definition at line 23 of file laser.cpp.

Laser::~Laser ( )

Definition at line 54 of file laser.cpp.


Member Function Documentation

int Laser::cBaudrate ( int  baudrate)
private

Definition at line 864 of file laser.cpp.

Here is the caller graph for this function:

int Laser::cDataSize ( int  numbits)
private

Definition at line 811 of file laser.cpp.

Here is the caller graph for this function:

int Laser::cFlowControl ( int  flowcontrol)
private

Definition at line 842 of file laser.cpp.

void Laser::check_parameter_settings ( sick_laser_p  laser)

Definition at line 95 of file laser.cpp.

Here is the caller graph for this function:

int Laser::cParity ( parity_t  par)
private

Definition at line 851 of file laser.cpp.

Here is the caller graph for this function:

int Laser::cStopSize ( int  numbits)
private

Definition at line 833 of file laser.cpp.

Here is the caller graph for this function:

double Laser::direcs_degrees_to_radians ( double  theta)

Definition at line 785 of file laser.cpp.

Here is the caller graph for this function:

double Laser::direcs_get_time ( void  )

Definition at line 1998 of file laser.cpp.

Here is the caller graph for this function:

int Laser::direcs_laser_run ( void  )

Definition at line 557 of file laser.cpp.

Here is the call graph for this function:

void Laser::direcs_laser_shutdown ( int  x)

Definition at line 538 of file laser.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int Laser::direcs_laser_start ( short int  laserScanner)

Definition at line 408 of file laser.cpp.

Here is the call graph for this function:

double Laser::direcs_radians_to_degrees ( double  theta)

Definition at line 780 of file laser.cpp.

float Laser::getLaserDistance ( int  laser,
int  angle 
)
Returns:
a measured distance in meter (m). The measured value is converted from cm to m here.

Definition at line 720 of file laser.cpp.

int Laser::getLaserNumReadings ( int  laser)

Definition at line 696 of file laser.cpp.

void Laser::interpret_params ( sick_laser_p  laser,
QString  dev,
QString  type,
double  res,
QString  rem,
double  fov 
)

Definition at line 189 of file laser.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int Laser::iParity ( parity_t  par)
private

Definition at line 793 of file laser.cpp.

Here is the caller graph for this function:

int Laser::iSoftControl ( int  flowcontrol)
private

Definition at line 802 of file laser.cpp.

Here is the caller graph for this function:

int Laser::kernel_minimum_version ( int  a,
int  b,
int  c 
)
private

Definition at line 947 of file laser.cpp.

Here is the caller graph for this function:

void Laser::message ( QString  text)
signal

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

Here is the caller graph for this function:

void Laser::read_parameters ( short int  laserScanner)

Definition at line 239 of file laser.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void Laser::set_default_parameters ( sick_laser_p  laser,
int  laser_num 
)

Definition at line 72 of file laser.cpp.

Here is the caller graph for this function:

void Laser::set_laser_config_structure ( sick_laser_p  laser,
direcs_laser_laser_config_t config 
)

Definition at line 309 of file laser.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void Laser::setDevicePort ( short int  laser,
QString  serialPort 
)
Todo:
add support for laser 3 to 5

Definition at line 765 of file laser.cpp.

void Laser::shutdown_laser ( int  x)

Definition at line 689 of file laser.cpp.

Here is the call graph for this function:

void Laser::sick_allocate_laser ( sick_laser_p  laser)
private

Definition at line 1615 of file laser.cpp.

Here is the caller graph for this function:

int Laser::sick_check_baudrate ( sick_laser_p  laser,
int  brate 
)
private

Definition at line 1585 of file laser.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int Laser::sick_compute_checksum ( unsigned char *  CommData,
int  uLen 
)
private

Compute the CRC checksum of a segment of data.

Definition at line 1065 of file laser.cpp.

Here is the caller graph for this function:

int Laser::sick_connect_device ( sick_laser_p  laser)

Definition at line 1666 of file laser.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int Laser::sick_detect_baudrate ( sick_laser_p  laser)
private

Definition at line 1538 of file laser.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void Laser::sick_handle_laser ( sick_laser_p  laser)

Process any data that is available from the laser. Attempt to detect valid packets in the data.

Todo:
change std output

Definition at line 1916 of file laser.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void Laser::sick_install_settings ( sick_laser_p  laser)
private

Definition at line 1600 of file laser.cpp.

Here is the caller graph for this function:

int Laser::sick_parse_conf_data ( sick_laser_p  laser,
unsigned char *  buf,
int  length 
)
private

Definition at line 1357 of file laser.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void Laser::sick_process_packet ( sick_laser_p  laser,
unsigned char *  packet 
)
private

Definition at line 1908 of file laser.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void Laser::sick_process_packet_distance ( sick_laser_p  laser,
unsigned char *  packet 
)
private

Interpret packets received from the laser. If the packets contain laser data, expand the data into a useful form.

Definition at line 1820 of file laser.cpp.

Here is the caller graph for this function:

void Laser::sick_process_packet_remission ( sick_laser_p  laser,
unsigned char *  packet 
)
private

Definition at line 1859 of file laser.cpp.

Here is the caller graph for this function:

int Laser::sick_read_data ( sick_laser_p  laser,
unsigned char *  data,
double  timeout 
)
private

Definition at line 1093 of file laser.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int Laser::sick_request_lms_config ( sick_laser_p  laser)
private

Definition at line 1335 of file laser.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void Laser::sick_request_sensor ( sick_laser_p  laser)
private

Definition at line 1262 of file laser.cpp.

Here is the call graph for this function:

void Laser::sick_request_status ( sick_laser_p  laser)
private

Definition at line 1257 of file laser.cpp.

Here is the call graph for this function:

int Laser::sick_serial_connect ( sick_laser_p  laser)
private

This method opens the serial port of the laser scanner, sets the serial port parameters and tries to set the latency mode, if defined

Returns:
the file descriptor of the opend serial port
Todo:
check if this still works with Linux!

Definition at line 1018 of file laser.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void Laser::sick_set_baudrate ( sick_laser_p  laser,
int  brate 
)
private

Definition at line 961 of file laser.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int Laser::sick_set_config_mode ( sick_laser_p  laser)
private

Definition at line 1288 of file laser.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int Laser::sick_set_laser_baudrate ( sick_laser_p  laser,
int  brate 
)
private

Definition at line 1270 of file laser.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int Laser::sick_set_lms_config ( sick_laser_p  laser,
unsigned char *  data,
int  len 
)
private

Definition at line 1344 of file laser.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int Laser::sick_set_lms_range ( sick_laser_p  laser)
private

Definition at line 1430 of file laser.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int Laser::sick_set_lms_resolution ( sick_laser_p  laser)
private

Definition at line 1305 of file laser.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int Laser::sick_set_serial_params ( sick_laser_p  laser)
private
Returns:
-1 in case of error

Definition at line 915 of file laser.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void Laser::sick_start_continuous_mode ( sick_laser_p  laser)
private

Definition at line 1445 of file laser.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void Laser::sick_start_continuous_remission_part_mode ( sick_laser_p  laser)
private

Definition at line 1475 of file laser.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int Laser::sick_start_laser ( sick_laser_p  laser)

Establish the serial connection to the laser and set the laser in the wanted mode(s).

Todo:
MK which value is a good one here?

Definition at line 1687 of file laser.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void Laser::sick_stop_continuous_mode ( sick_laser_p  laser)
private

Definition at line 1464 of file laser.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void Laser::sick_stop_laser ( sick_laser_p  laser)

Definition at line 1989 of file laser.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int Laser::sick_testBaudrate ( sick_laser_p  laser,
int  brate 
)
private

Test a combination of baudrate and parity of the laser.

Definition at line 1503 of file laser.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int Laser::sick_valid_packet ( unsigned char *  data,
long  size,
long *  offset,
long *  len 
)
private

This function returns 1 if a valid packet is detected in a chunk of data.

Returns:
An offset and packet length

Definition at line 1780 of file laser.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int Laser::sick_write_command ( sick_laser_p  laser,
unsigned char  command,
unsigned char *  argument,
int  arg_length 
)
private

Definition at line 1180 of file laser.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

const short int Laser::LASER1 = 1
static

Definition at line 195 of file laser.h.

sick_laser_t* Laser::laser1

Definition at line 322 of file laser.h.

direcs_laser_laser_config_t* Laser::laser1_config

Definition at line 327 of file laser.h.

const short int Laser::LASER2 = 2
static

For the direcs laserThread.

Definition at line 196 of file laser.h.

sick_laser_t* Laser::laser2

Definition at line 323 of file laser.h.

direcs_laser_laser_config_t* Laser::laser2_config

Definition at line 328 of file laser.h.

const short int Laser::LASER3 = 4
static

For the direcs laserThread.

Definition at line 197 of file laser.h.

sick_laser_t* Laser::laser3

Definition at line 324 of file laser.h.

direcs_laser_laser_config_t* Laser::laser3_config

Definition at line 329 of file laser.h.

const short int Laser::LASER4 = 8
static

For the direcs laserThread.

Definition at line 198 of file laser.h.

sick_laser_t* Laser::laser4

Definition at line 325 of file laser.h.

direcs_laser_laser_config_t* Laser::laser4_config

Definition at line 330 of file laser.h.

const short int Laser::LASER5 = 16
static

For the direcs laserThread.

Definition at line 199 of file laser.h.

sick_laser_t* Laser::laser5

Definition at line 326 of file laser.h.

direcs_laser_laser_config_t* Laser::laser5_config

Definition at line 331 of file laser.h.

QString Laser::laserSerialPort1

Definition at line 340 of file laser.h.

QString Laser::laserSerialPort2

Definition at line 341 of file laser.h.

QString Laser::laserSerialPort3

Definition at line 342 of file laser.h.

QString Laser::laserSerialPort4

Definition at line 343 of file laser.h.

QString Laser::laserSerialPort5

Definition at line 344 of file laser.h.

int Laser::quit_signal

Definition at line 338 of file laser.h.

DirecsSerial* Laser::serialPort
private

Definition at line 460 of file laser.h.

int Laser::use_laser1

Definition at line 333 of file laser.h.

int Laser::use_laser2

Definition at line 334 of file laser.h.

int Laser::use_laser3

Definition at line 335 of file laser.h.

int Laser::use_laser4

Definition at line 336 of file laser.h.

int Laser::use_laser5

Definition at line 337 of file laser.h.


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