HokuyoAIST  3.0.2
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
hokuyoaist::ScanData Class Reference

Structure to store data returned from the laser scanner. More...

#include <hokuyoaist/scan_data.h>

Public Member Functions

 ScanData ()
 This constructor creates an empty ScanData with no data currently allocated. More...
 
 ScanData (uint32_t *const ranges_buffer, unsigned int ranges_length, uint32_t *const intensities_buffer=0, unsigned int intensities_length=0)
 This constructor uses a provided data buffer rather than allocating automatically. More...
 
 ScanData (ScanData const &rhs)
 This copy constructor performs a deep copy of present data. More...
 
 ~ScanData ()
 
const uint32_t * ranges () const
 Return a pointer to array of range readings in millimetres. More...
 
const uint32_t * intensities () const
 Return a pointer to an array of intensity readings. More...
 
unsigned int ranges_length () const
 Get the number of range samples in the data. More...
 
unsigned int intensities_length () const
 Get the number of intensity samples in the data. More...
 
bool get_error_status () const
 Indicates if one or more steps had an error. More...
 
std::string error_code_to_string (uint32_t error_code)
 Return a string representing the error for the given error code. More...
 
unsigned int laser_time_stamp () const
 Get the raw time stamp of the data in milliseconds. More...
 
unsigned long long system_time_stamp () const
 Get the system time stamp of the data in milliseconds. More...
 
LaserModel model () const
 Get the model of the laser that produced this scan. More...
 
bool buffers_provided () const
 Check if the buffers are being provided instead of automatic. More...
 
ScanDataoperator= (ScanData const &rhs)
 Assignment operator. More...
 
uint32_t operator[] (unsigned int index)
 Subscript operator. More...
 
std::string as_string ()
 Format the entire object into a string. More...
 
void clean_up ()
 Force the data to clean up. More...
 

Protected Member Functions

void allocate_data (unsigned int length, bool include_intensities=false)
 
void write_range (unsigned int index, uint32_t value)
 
void write_intensity (unsigned int index, uint32_t value)
 

Protected Attributes

uint32_t * ranges_
 
uint32_t * intensities_
 
unsigned int ranges_length_
 
unsigned int intensities_length_
 
bool error_
 
unsigned int laser_time_
 
unsigned long long system_time_
 
LaserModel model_
 
bool buffers_provided_
 

Friends

class Sensor
 

Detailed Description

Structure to store data returned from the laser scanner.

Definition at line 60 of file scan_data.h.

Constructor & Destructor Documentation

hokuyoaist::ScanData::ScanData ( )

This constructor creates an empty ScanData with no data currently allocated.

hokuyoaist::ScanData::ScanData ( uint32_t *const  ranges_buffer,
unsigned int  ranges_length,
uint32_t *const  intensities_buffer = 0,
unsigned int  intensities_length = 0 
)

This constructor uses a provided data buffer rather than allocating automatically.

If the intensity pointer is 0, no data will be provided of that type.

Parameters
ranges_bufferA pointer to a data area to store range data in. It is the caller's responsibility to ensure that it is big enough.
ranges_lengthThe size of the ranges buffer. Used only for copy constructor and similar.
intensities_bufferA pointer to a data area to store intensity data in. It is the caller's responsibility to ensure that it is big enough.
intensities_lengthThe size of the intensities buffer. Used only for copy constructor and similar.
hokuyoaist::ScanData::ScanData ( ScanData const &  rhs)

This copy constructor performs a deep copy of present data.

hokuyoaist::ScanData::~ScanData ( )

Member Function Documentation

void hokuyoaist::ScanData::allocate_data ( unsigned int  length,
bool  include_intensities = false 
)
protected
std::string hokuyoaist::ScanData::as_string ( )

Format the entire object into a string.

bool hokuyoaist::ScanData::buffers_provided ( ) const
inline

Check if the buffers are being provided instead of automatic.

Definition at line 126 of file scan_data.h.

void hokuyoaist::ScanData::clean_up ( )

Force the data to clean up.

std::string hokuyoaist::ScanData::error_code_to_string ( uint32_t  error_code)

Return a string representing the error for the given error code.

bool hokuyoaist::ScanData::get_error_status ( ) const
inline

Indicates if one or more steps had an error.

A step's value will be less than 20 if it had an error. Use error_code_to_string to get a textual representation of the error.

Definition at line 111 of file scan_data.h.

const uint32_t* hokuyoaist::ScanData::intensities ( ) const
inline

Return a pointer to an array of intensity readings.

Definition at line 101 of file scan_data.h.

unsigned int hokuyoaist::ScanData::intensities_length ( ) const
inline

Get the number of intensity samples in the data.

Definition at line 106 of file scan_data.h.

unsigned int hokuyoaist::ScanData::laser_time_stamp ( ) const
inline

Get the raw time stamp of the data in milliseconds.

This value is only available using SCIP version 2).

Definition at line 118 of file scan_data.h.

LaserModel hokuyoaist::ScanData::model ( ) const
inline

Get the model of the laser that produced this scan.

Definition at line 124 of file scan_data.h.

ScanData& hokuyoaist::ScanData::operator= ( ScanData const &  rhs)

Assignment operator.

If the rhs has provided buffers, the lhs will not receive the same buffers. Instead, it will copy the data into its own buffers. If the lhs has provided buffers, it is the caller's responsibility to ensure they will be big enough to receive the data from the rhs, except in the case of 0 buffers (no data will be copied for 0 buffers).

uint32_t hokuyoaist::ScanData::operator[] ( unsigned int  index)

Subscript operator.

Provides direct access to an element of the range data.

const uint32_t* hokuyoaist::ScanData::ranges ( ) const
inline

Return a pointer to array of range readings in millimetres.

Values less than 20mm indicate an error. Check the error value for the data to see a probable cause for the error. Most of the time, it will just be an out-of-range reading.

Definition at line 98 of file scan_data.h.

unsigned int hokuyoaist::ScanData::ranges_length ( ) const
inline

Get the number of range samples in the data.

Definition at line 104 of file scan_data.h.

unsigned long long hokuyoaist::ScanData::system_time_stamp ( ) const
inline

Get the system time stamp of the data in milliseconds.

This value is only available using SCIP version 2).

Definition at line 122 of file scan_data.h.

void hokuyoaist::ScanData::write_intensity ( unsigned int  index,
uint32_t  value 
)
protected
void hokuyoaist::ScanData::write_range ( unsigned int  index,
uint32_t  value 
)
protected

Friends And Related Function Documentation

friend class Sensor
friend

Definition at line 63 of file scan_data.h.

Member Data Documentation

bool hokuyoaist::ScanData::buffers_provided_
protected

Definition at line 157 of file scan_data.h.

bool hokuyoaist::ScanData::error_
protected

Definition at line 153 of file scan_data.h.

uint32_t* hokuyoaist::ScanData::intensities_
protected

Definition at line 150 of file scan_data.h.

unsigned int hokuyoaist::ScanData::intensities_length_
protected

Definition at line 152 of file scan_data.h.

unsigned int hokuyoaist::ScanData::laser_time_
protected

Definition at line 154 of file scan_data.h.

LaserModel hokuyoaist::ScanData::model_
protected

Definition at line 156 of file scan_data.h.

uint32_t* hokuyoaist::ScanData::ranges_
protected

Definition at line 149 of file scan_data.h.

unsigned int hokuyoaist::ScanData::ranges_length_
protected

Definition at line 151 of file scan_data.h.

unsigned long long hokuyoaist::ScanData::system_time_
protected

Definition at line 155 of file scan_data.h.


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