next up previous contents
Next: 2.18 SoundProxy Up: 2. Class Reference Previous: 2.16 PtzProxy   Contents

Subsections

2.17 SonarProxy

The SonarProxy class is used to control a sonar device. The most recent sonar range measuremts can be read from the range attribute, or using the the [] operator.

Attributes

unsigned short range_count;

The number of sonar readings received.

double ranges[PLAYER_SONAR_MAX_SAMPLES];

The latest sonar scan data. Range is measured in m.

int pose_count;

Number of valid sonar poses

double poses[PLAYER_SONAR_MAX_SAMPLES][3];

Sonar poses (m,m,radians)

Methods

SonarProxy(PlayerClient* pc, unsigned short index,
unsigned char access = 'c')

Constructor. Leave the access field empty to start unconnected.

int SetSonarState(unsigned char state)

Enable/disable the sonars. Set state to 1 to enable, 0 to disable. Note that when sonars are disabled the client will still receive sonar data, but the ranges will always be the last value read from the sonars before they were disabled.
Returns 0 on success, -1 if there is a problem.

int GetSonarGeom()

Request the sonar geometry.

double operator [](unsigned int index)

Range access operator. This operator provides an alternate way of access the range data. For example, given a SonarProxy named sp, the following expressions are equivalent: sp.ranges[0] and sp[0].

void Print()

Print out current sonar range data.


next up previous contents
Next: 2.18 SoundProxy Up: 2. Class Reference Previous: 2.16 PtzProxy   Contents
2004-05-31