# SoftBank Robotics documentation What's new in NAOqi 2.8?

# ALSonar API

NAOqi Sensors & LEDs - Overview | API

See also

- Sonars Hardware

Namespace : AL

    #include <alproxies/alsonarproxy.h>

## Method list

As any module, this module inherits methods from ALModule API.

It also inherits methods from ALExtractor API.

Note that only the `ALExtractor::subscribe` and `ALExtractor::unsubscribe` methods are useful for ALSonar.

## Event list

- `SonarLeftDetected()`
- `SonarRightDetected()`
- `SonarLeftNothingDetected()`
- `SonarRightNothingDetected()`

## Events

Event: `"SonarLeftDetected"`
callback(std::string eventName, float distance, std::string subscriberIdentifier)

  Raised when there is something in front of the robot (left side) at less the detection threshold.

  Parameters: | eventName (std::string) – “SonarLeftDetected” dist – the obstacle distance in meters subscriberIdentifier (std::string) –

Event: `"SonarRightDetected"`
callback(std::string eventName, float distance, std::string subscriberIdentifier)

  Raised when there is something in front of the robot (right side) at less the detection threshold.

  Parameters: | eventName (std::string) – “SonarRightDetected” dist – the obstacle distance in meters subscriberIdentifier (std::string) –

Event: `"SonarLeftNothingDetected"`
callback(std::string eventName, float distance, std::string subscriberIdentifier)

  Parameters: | eventName (std::string) – “SonarLeftNothingDetected” distance – the distance in meter, of the first obstacle out of the detection threshold. subscriberIdentifier (std::string) –

Event: `"SonarRightNothingDetected"`
callback(std::string eventName, float distance, std::string subscriberIdentifier)

  Raised when there is nothing, within the detection threshold, in front nor on the right side of the robot.

  Parameters: | eventName (std::string) – “SonarRightNothingDetected” distance – the distance in meter, of the first obstacle out of the detection threshold. subscriberIdentifier (std::string) –

Glossary Site map Index Support Contact Legal Notices