ALSonar API

NAOqi Sensors - Overview | API


See also

Namespace : AL

#include <alproxies/alsonarproxy.h>

Methods

int ALSonarProxy::getCurrentPeriod()

Gets the current period.

Returns:Refresh period (in milliseconds).
float ALSonarProxy::getCurrentPrecision()

Gets the current precision.

Returns:Precision of the extractor.
int ALSonarProxy::getMyPeriod(const std::string& name)

Gets the period for a specific subscription.

Parameters:
  • name – Name of the module which has subscribed.
Returns:

Refresh period (in milliseconds).

float ALSonarProxy::getMyPrecision(const std::string& name)

Gets the precision for a specific subscription.

Parameters:
  • name – name of the module which has subscribed
Returns:

precision of the extractor

std::vector<std::string> ALSonarProxy::getOutputNames()

Get the list of values updated in ALMemory.

Returns:Array of values updated by this extractor in ALMemory
AL::ALValue ALSonarProxy::getSubscribersInfo()

Gets the parameters given by the module.

Returns:Array of names and parameters of all subscribers.
void ALSonarProxy::subscribe(const std::string& name, const int& period, const float& precision)

Subscribes to the extractor. This causes the extractor to start writing information to memory using the keys described by getOutputNames(). These can be accessed in memory using ALMemory.getData(“keyName”). In many cases you can avoid calling subscribe on the extractor by just calling ALMemory.subscribeToEvent() supplying a callback method. This will automatically subscribe to the extractor for you.

Parameters:
  • name – Name of the module which subscribes.
  • period – Refresh period (in milliseconds) if relevant.
  • precision – Precision of the extractor if relevant.
void ALSonarProxy::subscribe(const std::string& name)

Subscribes to the extractor. This causes the extractor to start writing information to memory using the keys described by getOutputNames(). These can be accessed in memory using ALMemory.getData(“keyName”). In many cases you can avoid calling subscribe on the extractor by just calling ALMemory.subscribeToEvent() supplying a callback method. This will automatically subscribe to the extractor for you.

Parameters:
  • name – Name of the module which subscribes.
void ALSonarProxy::unsubscribe(const std::string& name)

Unsubscribes from the extractor.

Parameters:
  • name – Name of the module which had subscribed.
void ALSonarProxy::updatePeriod(const std::string& name, const int& period)

Updates the period if relevant.

Parameters:
  • name – Name of the module which has subscribed.
  • period – Refresh period (in milliseconds).
void ALSonarProxy::updatePrecision(const std::string& name, const float& precision)

Updates the precision if relevant.

Parameters:
  • name – Name of the module which has subscribed.
  • precision – Precision of the extractor.

Events

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

raised when there is someting in front of NAO (left side) at less than 0.5m.

Parameters:
  • eventName (std::string) – “SonarLeftDetected”
  • dist – the obstacle distance in meter
  • subscriberIdentifier (std::string) –
Event: "SonarRightDetected"
callback(std::string eventName, float dist, std::string subscriberIdentifier)

raised when there is someting in front of NAO (right side) at less than 0.5m.

Parameters:
  • eventName (std::string) – “SonarRightDetected”
  • dist – the obstacle distance in meter
  • subscriberIdentifier (std::string) –
Event: "SonarLeftNothingDetected"
callback(std::string eventName, float val, std::string subscriberIdentifier)

raised when there is nothing in front of NAO nor on his left side.

Parameters:
  • eventName (std::string) – “SonarLeftNothingDetected”
  • val – always 0.0
  • subscriberIdentifier (std::string) –
Event: "SonarRightNothingDetected"
callback(std::string eventName, float val, std::string subscriberIdentifier)

raised when there is nothing in front of NAO nor on his right side.

Parameters:
  • eventName (std::string) – “SonarRightNothingDetected”
  • val – always 0.0
  • subscriberIdentifier (std::string) –