javaandroidkotlinnao-robotpepper

Are the ALEngagementZones API still usable in QiSDK (Pepper with NAOqi 2.9.5)?


Is it possible to somehow use the Engagement Zones of NAOqi 2.5 or anything similar in the newer NAOqi 2.9.5 in Android? Or is there any way to still continuously detect people in front of Pepper or close to it? Currently, I am trying to use human awareness for that purpose, but there are no preset zones, and most of the time, Pepper does not recognize anyone.


Solution

  • The API about engagement zones has not been ported to the Qi SDK. However it is not so hard to re-implement it. The documentation describes them as follows:

    enter image description here

    I found this function isInArc that you can use with the position of the human's head relative to the robot:

    fun zoneOfHuman(human: Human, robotFrame: Frame): Int {
      val headFrame = human.headFrame
      val timedTransform = headFrame.computeTransform(robotFrame)
      val transform = timedTransform.transform
      return if (isInArc(transform, 1.5, PI / 2)) 1
        else if (isInArc(transform, 2.5, PI / 2)) 2
        else 3
    }
    

    Now you can call that regularly using a Kotlin timer on the human you are interested in, typically the one that Pepper already engages autonomously. Actually you can start an interaction quite reliably without caring about the zones that much.