.. _alsensors-api: ALSensors API ============= :ref:`Overview ` | API .. seealso:: - :ref:`naoqi-sensors` - :ref:`Contact Sensors Hardware ` .. _alsensors-events: Method list ----------- .. cpp:class:: ALSensorsProxy * Methods: * :cpp:func:`ALSensorsProxy::getCurrentPeriod` * :cpp:func:`ALSensorsProxy::getCurrentPrecision` * :cpp:func:`ALSensorsProxy::getMyPeriod` * :cpp:func:`ALSensorsProxy::getMyPrecision` * :cpp:func:`ALSensorsProxy::getOutputNames` * :cpp:func:`ALSensorsProxy::getSubscribersInfo` * :cpp:func:`ALSensorsProxy::run` * :cpp:func:`ALSensorsProxy::subscribe` * :cpp:func:`ALSensorsProxy::unsubscribe` * :cpp:func:`ALSensorsProxy::updatePeriod` * :cpp:func:`ALSensorsProxy::updatePrecision` Event list ---------- * :naoqi:event:`RightBumperPressed` * :naoqi:event:`LeftBumperPressed` * :naoqi:event:`ChestButtonPressed` * :naoqi:event:`FrontTactilTouched` * :naoqi:event:`MiddleTactilTouched` * :naoqi:event:`RearTactilTouched` * :naoqi:event:`HotJointDetected` * :naoqi:event:`HandRightBackTouched` * :naoqi:event:`HandRightLeftTouched` * :naoqi:event:`HandRightRightTouched` * :naoqi:event:`HandLeftBackTouched` * :naoqi:event:`HandLeftLeftTouched` * :naoqi:event:`HandLeftRightTouched` * :naoqi:event:`BodyStiffnessChanged` .. seealso:: * :ref:`Methods inherited from ALModule ` Methods ------- .. cpp:function:: int ALSensorsProxy::getCurrentPeriod() Gets the current period. :return: Refresh period (in milliseconds). .. cpp:function:: float ALSensorsProxy::getCurrentPrecision() Gets the current precision. :return: Precision of the extractor. .. cpp:function:: int ALSensorsProxy::getMyPeriod(const std::string& name) Gets the period for a specific subscription. :param name: Name of the module which has subscribed. :return: Refresh period (in milliseconds). .. cpp:function:: float ALSensorsProxy::getMyPrecision(const std::string& name) Gets the precision for a specific subscription. :param name: name of the module which has subscribed :return: precision of the extractor .. cpp:function:: std::vector ALSensorsProxy::getOutputNames() Get the list of values updated in ALMemory. :return: Array of values updated by this extractor in ALMemory .. cpp:function:: AL::ALValue ALSensorsProxy::getSubscribersInfo() Gets the parameters given by the module. :return: Array of names and parameters of all subscribers. .. cpp:function:: void ALSensorsProxy::run() Monitors sensors. .. cpp:function:: 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. :param name: Name of the module which subscribes. :param period: Refresh period (in milliseconds) if relevant. :param precision: Precision of the extractor if relevant. .. cpp:function:: 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. :param name: Name of the module which subscribes. .. cpp:function:: void ALSensorsProxy::unsubscribe(const std::string& name) Unsubscribes from the extractor. :param name: Name of the module which had subscribed. .. cpp:function:: void ALSensorsProxy::updatePeriod( const std::string& name, const int& period ) Updates the period if relevant. :param name: Name of the module which has subscribed. :param period: Refresh period (in milliseconds). .. cpp:function:: void ALSensorsProxy::updatePrecision( const std::string& name, const float& precision ) Updates the precision if relevant. :param name: Name of the module which has subscribed. :param precision: Precision of the extractor. Events ------ .. naoqi:event:: RightBumperPressed(float val) Raised when the right bumper is pressed :param val: 1.0 if right bumper is pressed .. naoqi:event:: LeftBumperPressed(float val) Raised when the left bumper is pressed :param val: 1.0 if left bumper is pressed .. naoqi:event:: ChestButtonPressed(float val) Raised when the chest button is pressed :param val: 1.0 if chest button is pressed .. naoqi:event:: FrontTactilTouched(float val) Raised when the front head tactil sensor is touched (by human) :param val: 1.0 if front head tactil sensor is touched .. naoqi:event:: MiddleTactilTouched(float val) Raised when the middle head tactil sensor is touched (by human) :param val: 1.0 if middle head tactil sensor is touched .. naoqi:event:: RearTactilTouched(float val) Raised when the rear head tactil sensor is touched (by human) :param val: 1.0 if rear head tactil sensor is touched .. naoqi:event:: HotJointDetected(int motorBoardId) Raised when at least one joint have a temperature > 75deg since 200ms :param motorBoardId: the motor board Id .. naoqi:event:: HandRightBackTouched(float val) Raised when the right hand back tactil sensor is touched (by human) :param val: 1.0 if right hand back tactil sensor is touched .. naoqi:event:: HandRightLeftTouched(float val) Raised when the right hand left tactil sensor is touched (by human) :param val: 1.0 if right hand left tactil sensor is touched .. naoqi:event:: HandRightRightTouched(float val) Raised when the right hand right tactil sensor is touched (by human) :param val: 1.0 if right hand right tactil sensor is touched .. naoqi:event:: HandLeftBackTouched(float val) Raised when the left hand back tactil sensor is touched (by human) :param val: 1.0 if left hand back tactil sensor is touched .. naoqi:event:: HandLeftLeftTouched(float val) Raised when the left hand left tactil sensor is touched (by human) :param val: 1.0 if left hand left tactil sensor is touched .. naoqi:event:: HandLeftRightTouched(float val) Raised when the left hand right tactil sensor is touched (by human) :param val: 1.0 if left hand right tactil sensor is touched .. naoqi:event:: BodyStiffnessChanged(int val) Raised when the body stiffness (average of all joints) have significantly changed. :param 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