我如何持续检测是否有人在 Pepper 前面?

How can I continuously detect if someone is in front of Pepper?

我一直在玩:

PeoplePerception/PeopleDetected()

PeoplePerception/PopulationUpdated()

PeoplePerception/PeopleList()

PeoplePerception/NonVisiblePeopleList()

PeoplePerception/VisiblePeopleList()

但我似乎无法弄清楚如何检测 Pepper 前面是否有人。这些事件在人口更新时触发,但我无法理解返回值。

我想要完成的是只要有人在检测区域 2 内,就让 Pepper 保持某种状态,并在 1 检测不到有人时让它进入 "screensaver"分钟。

我在 Pepper 开发方面还很陌生,所以非常感谢您的帮助,谢谢!

听起来你想合并 ALPeoplePerception API with the ALEngagmentZones API. This is described in some detail here. There's a key in ALMemory (Pepper's memory) that does what you want - stores a list of all people in engagement zone 2 (EngagementZones/PeopleInZone2).

您已将问题标记为 javascript,所以我将举一个简短的示例来说明如何访问它。

QiSession(function (session){
    session.service("ALMemory").then(function(mem) {
        mem.getData("EngagementZones/PeopleInZone2").then(function(data) {
            // now you can access data and do something with it...
            // it should be a list of IDs of the people in the engagement zone
            // so you could check data.length > 0 to see if there's any people
        }, console.log);
    }, console.log);
}, console.log);

还有其他可能有用的事件,例如 EngagementZones/PersonEnteredZone2. If you haven't found it yet, there's more details about the javascript API here