Robot Simulator of the Robotics Group for Self-Organization of Control: SoundSensor Class Reference

# SoundSensor Class Reference

Sound sensor with possible direction and frequency detection and also distance dependence (Not implemented yet) This works, but is not very well tested and documented. More...

`#include <soundsensor.h>`

Inherits lpzrobots::Sensor.

Collaboration diagram for SoundSensor:
[legend]

List of all members.

## Public Types
enum | Measure { Segments, Angle, AngleVel }
## Public Member Functions
| SoundSensor (Dimensions dim=Z, Measure measure=Angle, int segments=1, int levels=1, float maxDistance=1000)
virtual | ~SoundSensor ()
virtual void | init (Primitive *own)
| initialises sensor with body of robot.
virtual bool | sense (const GlobalData &globaldata)
| performs sense action
virtual int | getSensorNumber () const
| returns the number of sensors values produced by this sensor
virtual std::list< sensor > | get () const
| returns a list of sensor values (usually in the range [0,1] ) This function should be overloaded.
virtual int | get (sensor *sensors, int length) const
| writes the sensor values (usually in the range [0,1] ) into the given sensor array and returns the number of sensors written.

## Detailed Description

Sound sensor with possible direction and frequency detection and also distance dependence (Not implemented yet) This works, but is not very well tested and documented.

The angle detection also works without sound and so on. Take a look at the code before using it.

## Member Enumeration Documentation

enum Measure

Enumerator:

  Segments |
  Angle |
  AngleVel |

## Constructor & Destructor Documentation

SoundSensor | ( | Dimensions | dim = `Z`,
|  | Measure | measure = `Angle`,
|  | int | segments = `1`,
|  | int | levels = `1`,
|  | float | maxDistance = `1000` |
| ) |  |  |

Parameters:

  | dim | Up-axis of the robot (sometimes it is not Z)

~SoundSensor | ( |  | ) | `[virtual]`

## Member Function Documentation

int get | ( | sensor * | sensors,
|  | int | length |
| ) |  |  | const`[virtual]`

writes the sensor values (usually in the range [0,1] ) into the given sensor array and returns the number of sensors written.

A default implementation based on get() is provided. Only of performance matters overwrite this function.

Parameters:

  | sensors | call by refernce array which received the values
  | length | capacity of sensors array

Returns:
  number of sensor values written

Reimplemented from Sensor.

std::list< sensor > get | ( |  | ) | const`[virtual]`

returns a list of sensor values (usually in the range [0,1] ) This function should be overloaded.

Implements Sensor.

int getSensorNumber | ( |  | ) | const`[virtual]`

returns the number of sensors values produced by this sensor

Implements Sensor.

virtual void init | ( | Primitive * | own | ) | `[inline, virtual]`

initialises sensor with body of robot.

This is usually done by the robot itself.

Implements Sensor.

bool sense | ( | const GlobalData & | globaldata | ) | `[virtual]`

performs sense action

Implements Sensor.

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

- soundsensor.h
- soundsensor.cpp