INTRODUCTION
Overview
Download and Install
Documentation
Publications

REPOSITORY
Libraries

DEVELOPER
Dev Guide
Dashboard

PEOPLE
Contributors
Users

SourceForge.net Logo
Project
Download
Mailing lists

 

         

hokuyo_aist::HokuyoLaser Class Reference

Hokuyo laser scanner class. More...

#include <hokuyo_aist.h>

List of all members.

Public Member Functions

void Open (std::string portOptions)
 Open the laser scanner and begin scanning.
void Close (void)
 Close the connection to the laser scanner.
bool IsOpen (void) const
 Checks if the connection to the laser scanner is open.
void SetPower (bool on)
 Switch the laser scanner on or off.
void SetBaud (unsigned int baud)
 Change the baud rate when using a serial connection.
void Reset (void)
 Reset the laser scanner to its default settings.
void SetMotorSpeed (unsigned int speed)
 Set the speed at which the scanner's sensor spins.
void SetHighSensitivity (bool on)
 Switch the scanner between normal and high sensitivity modes.
void GetSensorInfo (HokuyoSensorInfo *info)
 Get various information about the scanner.
unsigned int GetTime (void)
 Get the current value of the scanner's clock in milliseconds.
unsigned int GetRanges (HokuyoData *data, int startStep=-1, int endStep=-1, unsigned int clusterCount=1)
 Get the latest scan data from the scanner.
unsigned int GetRangesByAngle (HokuyoData *data, double startAngle, double endAngle, unsigned int clusterCount=1)
 Get the latest scan data from the scanner.
unsigned int GetNewRanges (HokuyoData *data, int startStep=-1, int endStep=-1, unsigned int clusterCount=1)
 Get a new scan from the scanner.
unsigned int GetNewRangesByAngle (HokuyoData *data, double startAngle, double endAngle, unsigned int clusterCount=1)
 Get a new scan from the scanner.
unsigned int GetNewRangesAndIntensities (HokuyoData *data, int startStep=-1, int endStep=-1, unsigned int clusterCount=1)
 Get a new scan from the scanner with intensity data.
unsigned int GetNewRangesAndIntensitiesByAngle (HokuyoData *data, double startAngle, double endAngle, unsigned int clusterCount=1)
 Get a new scan from the scanner with intensity data.
uint8_t SCIPVersion (void) const
 Return the major version of the SCIP protocol in use.
void SetVerbose (bool verbose)
 Turns on and off printing of verbose operating information to stderr. Default is off.
double StepToAngle (unsigned int step)
 A convenience function to convert a step index to an angle.
unsigned int AngleToStep (double angle)
 A convenience function to convert an angle to a step (rounded towards the front).


Detailed Description

Hokuyo laser scanner class.

Provides an interface for interacting with a Hokuyo laser scanner using SCIP protocol version 1 or 2. The FlexiPort library is used to implement the data communications with the scanner. See its documentation for details on controlling the connection.

To use a serial connection, ensure that you do not also have a USB cable connected, as this will force the scanner into USB mode, preventing the serial connection from functioning correctly.

All functions may throw instances of HokuyoError or its children. Exceptions from FlexiPort may also occur.


Member Function Documentation

unsigned int hokuyo_aist::HokuyoLaser::GetNewRanges ( HokuyoData data,
int  startStep = -1,
int  endStep = -1,
unsigned int  clusterCount = 1 
)

Get a new scan from the scanner.

Unlike GetRanges, which returns the most recent scan the scanner took, this function will request a new scan. This means it will wait while the scanner performs the scan, which means the rate at which scans can be retrieved using this function is less than with GetRanges. Otherwise behaves identicallty to GetRanges.

Not available with the SCIP v1 protocol.

Note:
The command used to retrieve a fresh scan is also used for the continuous scanning mode (not yet supported by this library). After completing a scan, it will turn the laser off (in anticipation of another continuous scan command being sent, which will automatically turn the laser back on again). If you want to mix GetNewRanges and GetRanges, you will need to turn the laser on after each call to GetNewRanges.
Parameters:
data Pointer to a HokuyoData object to store the range readings in.
clusterCount The number of readings to cluster together into a single reading. The minimum value from a cluster is returned as the range for that cluster.
startStep The first step to get ranges from. Set to -1 for the first scannable step.
endStep The last step to get ranges from. Set to -1 for the last scannable step.
Returns:
The number of range readings read into data.

unsigned int hokuyo_aist::HokuyoLaser::GetNewRangesAndIntensities ( HokuyoData data,
int  startStep = -1,
int  endStep = -1,
unsigned int  clusterCount = 1 
)

Get a new scan from the scanner with intensity data.

Unlike GetRanges, which returns the most recent scan the scanner took, this function will request a new scan. This means it will wait while the scanner performs the scan. Otherwise behaves identicallty to GetRanges.

Not available with the SCIP v1 protocol.

Note:
The command used to retrieve a fresh scan is also used for the continuous scanning mode (not yet supported by this library). After completing a scan, it will turn the laser off (in anticipation of another continuous scan command being sent, which will automatically turn the laser back on again). If you want to mix GetNewRanges and GetRanges, you will need to turn the laser on after each call to GetNewRanges.
Parameters:
data Pointer to a HokuyoData object to store the range readings in.
clusterCount The number of readings to cluster together into a single reading. The minimum value from a cluster is returned as the range for that cluster.
startStep The first step to get ranges from. Set to -1 for the first scannable step.
endStep The last step to get ranges from. Set to -1 for the last scannable step.
Returns:
The number of range readings read into data.

unsigned int hokuyo_aist::HokuyoLaser::GetNewRangesAndIntensitiesByAngle ( HokuyoData data,
double  startAngle,
double  endAngle,
unsigned int  clusterCount = 1 
)

Get a new scan from the scanner with intensity data.

Not available with the SCIP v1 protocol.

Parameters:
data Pointer to a HokuyoData object to store the range readings in.
startAngle The angle to get range readings from. Exclusive; if this falls between two steps the step inside the angle will be returned, but the step outside won't.
endAngle The angle to get range readings to. Exclusive; if this falls between two steps the step inside the angle will be returned, but the step outside won't.
clusterCount The number of readings to cluster together into a single reading. The minimum value from a cluster is returned as the range for that cluster.
Returns:
The number of range readings read into data.

unsigned int hokuyo_aist::HokuyoLaser::GetNewRangesByAngle ( HokuyoData data,
double  startAngle,
double  endAngle,
unsigned int  clusterCount = 1 
)

Get a new scan from the scanner.

Not available with the SCIP v1 protocol.

Parameters:
data Pointer to a HokuyoData object to store the range readings in.
startAngle The angle to get range readings from. Exclusive; if this falls between two steps the step inside the angle will be returned, but the step outside won't.
endAngle The angle to get range readings to. Exclusive; if this falls between two steps the step inside the angle will be returned, but the step outside won't.
clusterCount The number of readings to cluster together into a single reading. The minimum value from a cluster is returned as the range for that cluster.
Returns:
The number of range readings read into data.

unsigned int hokuyo_aist::HokuyoLaser::GetRanges ( HokuyoData data,
int  startStep = -1,
int  endStep = -1,
unsigned int  clusterCount = 1 
)

Get the latest scan data from the scanner.

This function requires a pointer to a HokuyoData object. It will allocate space in this object as necessary for storing range data. If the passed-in HokuyoData object already has the correct quantity of space to store the range data, it will not be re-allocated. If it does not have any space, it will be allocated. If it has space, but it is the wrong size, it will be re-allocated. This means you can repeatedly send the same HokuyoData object without having to worry about allocating its data, whether it will change or not, while also avoiding excessive allocations.

Not available with the SCIP v1 protocol.

Parameters:
data Pointer to a HokuyoData object to store the range readings in.
clusterCount The number of readings to cluster together into a single reading. The minimum value from a cluster is returned as the range for that cluster.
startStep The first step to get ranges from. Set to -1 for the first scannable step.
endStep The last step to get ranges from. Set to -1 for the last scannable step.
Returns:
The number of range readings read into data.

unsigned int hokuyo_aist::HokuyoLaser::GetRangesByAngle ( HokuyoData data,
double  startAngle,
double  endAngle,
unsigned int  clusterCount = 1 
)

Get the latest scan data from the scanner.

Not available with the SCIP v1 protocol.

Parameters:
data Pointer to a HokuyoData object to store the range readings in.
startAngle The angle to get range readings from. Exclusive; if this falls between two steps the step inside the angle will be returned, but the step outside won't.
endAngle The angle to get range readings to. Exclusive; if this falls between two steps the step inside the angle will be returned, but the step outside won't.
clusterCount The number of readings to cluster together into a single reading. The minimum value from a cluster is returned as the range for that cluster.
Returns:
The number of range readings read into data.

void hokuyo_aist::HokuyoLaser::GetSensorInfo ( HokuyoSensorInfo info  ) 

Get various information about the scanner.

Much of the information is not available with the SCIP v1 protocol.

unsigned int hokuyo_aist::HokuyoLaser::GetTime ( void   ) 

Get the current value of the scanner's clock in milliseconds.

Not available with the SCIP v1 protocol.

void hokuyo_aist::HokuyoLaser::Reset ( void   ) 

Reset the laser scanner to its default settings.

Not available with the SCIP v1 protocol.

void hokuyo_aist::HokuyoLaser::SetBaud ( unsigned int  baud  ) 

Change the baud rate when using a serial connection.

Valid baud rates are: 19.2Kbps, 57.6Kbps, 115.2Kbps, 250.0Kbps, 500.0Kbps, 750.0Kbps (dependent on those available in FlexiPort).

void hokuyo_aist::HokuyoLaser::SetMotorSpeed ( unsigned int  speed  ) 

Set the speed at which the scanner's sensor spins.

Set the speed to 0 to have it reset to the default value, and 99 to reset it to the initial (startup) value. Values between 1 and 10 specify a ratio of the default speed. The speeds in revolutions per minute that these correspond to will depend on the scanner model. For example, for a URG-04LX, they are (from 1 to 10) 594, 588, 576, 570, 564, 558, 552, 546, and 540 rpm.

Not available with the SCIP v1 protocol.


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

Generated for GearBox by  doxygen 1.4.5