ALSensors API

NAOqi Sensors - Overview | API


Methods

int ALSensorsProxy::getCurrentPeriod()

Gets the current period.

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

Gets the current precision.

Returns:Precision of the extractor.
int ALSensorsProxy::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 ALSensorsProxy::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> ALSensorsProxy::getOutputNames()

Get the list of values updated in ALMemory.

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

Gets the parameters given by the module.

Returns:Array of names and parameters of all subscribers.
void ALSensorsProxy::run()

Monitors sensors.

void ALSensorsProxy::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 ALSensorsProxy::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 ALSensorsProxy::unsubscribe(const std::string& name)

Unsubscribes from the extractor.

Parameters:
  • name – Name of the module which had subscribed.
void ALSensorsProxy::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 ALSensorsProxy::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: "RightBumperPressed"
callback(std::string eventName, float val, std::string subscriberIdentifier)

Raised when the right bumper is pressed.

Parameters:
  • eventName (std::string) – “RightBumperPressed”
  • val – 1.0 if right bumper is pressed.
  • subscriberIdentifier (std::string) –
Event: "LeftBumperPressed"
callback(std::string eventName, float val, std::string subscriberIdentifier)

Raised when the left bumper is pressed.

Parameters:
  • eventName (std::string) – “LeftBumperPressed”
  • val – 1.0 if left bumper is pressed.
  • subscriberIdentifier (std::string) –
Event: "ChestButtonPressed"
callback(std::string eventName, float val, std::string subscriberIdentifier)

Raised when the chest button is pressed.

Parameters:
  • eventName (std::string) – “ChestButtonPressed”
  • val – 1.0 if chest button is pressed.
  • subscriberIdentifier (std::string) –
Event: "FrontTactilTouched"
callback(std::string eventName, float val, std::string subscriberIdentifier)

Raised when the front head tactil sensor is touched (by human).

Parameters:
  • eventName (std::string) – “FrontTactilTouched”
  • val – 1.0 if front head tactil sensor is touched.
  • subscriberIdentifier (std::string) –
Event: "MiddleTactilTouched"
callback(std::string eventName, float val, std::string subscriberIdentifier)

Raised when the middle head tactil sensor is touched (by human).

Parameters:
  • eventName (std::string) – “MiddleTactilTouched”
  • val – 1.0 if middle head tactil sensor is touched.
  • subscriberIdentifier (std::string) –
Event: "RearTactilTouched"
callback(std::string eventName, float val, std::string subscriberIdentifier)

Raised when the rear head tactil sensor is touched (by human).

Parameters:
  • eventName (std::string) – “RearTactilTouched”
  • val – 1.0 if rear head tactil sensor is touched.
  • subscriberIdentifier (std::string) –
Event: "HotJointDetected"
callback(std::string eventName, int motorBoardId, std::string subscriberIdentifier)

Raised when at least one joint have a temperature > 75deg since 200ms.

Parameters:
  • eventName (std::string) – “HotJointDetected”
  • motorBoardId – the motor board Id.
  • subscriberIdentifier (std::string) –
Event: "HandRightBackTouched"
callback(std::string eventName, float val, std::string subscriberIdentifier)

Raised when the right hand back tactil sensor is touched (by human).

Parameters:
  • eventName (std::string) – “HandRightBackTouched”
  • val – 1.0 if right hand back tactil sensor is touched.
  • subscriberIdentifier (std::string) –
Event: "HandRightLeftTouched"
callback(std::string eventName, float val, std::string subscriberIdentifier)

Raised when the right hand left tactil sensor is touched (by human).

Parameters:
  • eventName (std::string) – “HandRightLeftTouched”
  • val – 1.0 if right hand left tactil sensor is touched.
  • subscriberIdentifier (std::string) –
Event: "HandRightRightTouched"
callback(std::string eventName, float val, std::string subscriberIdentifier)

Raised when the right hand right tactil sensor is touched (by human).

Parameters:
  • eventName (std::string) – “HandRightRightTouched”
  • val – 1.0 if right hand right tactil sensor is touched.
  • subscriberIdentifier (std::string) –
Event: "HandLeftBackTouched"
callback(std::string eventName, float val, std::string subscriberIdentifier)

Raised when the left hand back tactil sensor is touched (by human).

Parameters:
  • eventName (std::string) – “HandLeftBackTouched”
  • val – 1.0 if left hand back tactil sensor is touched.
  • subscriberIdentifier (std::string) –
Event: "HandLeftLeftTouched"
callback(std::string eventName, float val, std::string subscriberIdentifier)

Raised when the left hand left tactil sensor is touched (by human).

Parameters:
  • eventName (std::string) – “HandLeftLeftTouched”
  • val – 1.0 if left hand left tactil sensor is touched.
  • subscriberIdentifier (std::string) –
Event: "HandLeftRightTouched"
callback(std::string eventName, float val, std::string subscriberIdentifier)

Raised when the left hand right tactil sensor is touched (by human).

Parameters:
  • eventName (std::string) – “HandLeftRightTouched”
  • val – 1.0 if left hand right tactil sensor is touched.
  • subscriberIdentifier (std::string) –
Event: "BodyStiffnessChanged"
callback(std::string eventName, int val, std::string subscriberIdentifier)

Raised when the body stiffness (average of all joints) have significantly changed.

Parameters:
  • eventName (std::string) – “BodyStiffnessChanged”
  • val
    0 means that average of stiffness is less than 0.05
    1 means that average of stiffness is betwwen 0.05 and 0.95
    2 means that average of stiffness is greater 0.95
  • subscriberIdentifier (std::string) –