Pepper やNaoで使用されているNaoqi OSのメモです。



NAOqi Audio - 概要 | API | Launch trigger conditions | Advanced

Goal

When Life is running on a robot, in solitary state, Activities with launch trigger conditions can be started automatically.

These conditions can be set in the manifest of the Choregrahe behavior of the activity. Refer to the Choregraphe documentation for editing manifest of behaviors. To write them, use events and an expression language. For further details, see: Launch trigger conditions and Conditions expression language.

Example of a launch trigger condition


A condition for a solitary Activity which attracts a human could look like this:
('Launchpad/NumPeopleZone2' >= 1) ~ 3
There is at least one person detected in zone 2 of ALEngagementZones for at least 3 seconds.

Launch trigger conditions

Many of these ALMemory Events are based on combining Context coming from Extractors which are managed by Autonomous Life. For more information, see Extractors management?.

About people and movements
Key NameTypeExplanation
Launchpad/NumMotionZone1()intThe number of moving objects detected in zone 1.
Only available during solitary state.
Launchpad/NumMotionZone2()intThe number of moving objects detected in zone 2.
Only available during solitary state.
Launchpad/NumMotionZone3()intThe number of moving objects detected in zone 3.
Only available during solitary state.
Launchpad/NoMotionInZones()boolTrue when no motion is detected in any zone.
Only available during solitary state.
Launchpad/WavingDetection()int0 while no waving is detected, 1 while waving is detected.
Only available during solitary state.
Launchpad/NumPeopleZone1()intThe number of people detected in zone 1.
Only available during solitary state.
Launchpad/NumPeopleZone2()intThe number of people detected in zone 2
Only available during solitary state.
Launchpad/NumPeopleZone3()intThe number of people detected in zone 3
Only available during solitary state.
Launchpad/NoPeopleInZones()boolTrue when no people are detected in any zone.
Only available during solitary state.
Launchpad/PeopleNotSeen()boolTrue when PeoplePerception/VisiblePeopleList is empty.
Only available during solitary state.
Launchpad/SameTrackedHuman()boolTrue as long as the same person is being tracked. Momentarily false when the tracked person changes.
The tracked person is determined by BasicAwareness.
Only available if BasicAwareness is started.
Launchpad/ZoneOfTrackedHuman()intThe zone that the tracked person is in: 1, 2, or 3. 0 if no one is tracked.
Only available if BasicAwareness is started.
Launchpad/DistanceOfTrackedHuman()floatThe distance in meters to the tracked human. -1.0 if no one is tracked.
Only available if BasicAwareness is started.
Launchpad/TrackedHumanIsLookingAtRobot()boolTrue when the tracked person is looking at the robot.
Only available if BasicAwareness is started.

About battery information
Key NameTypeExplanation
Launchpad/BatteryIsCharging()boolTrue if the batter is currently recharging.
Launchpad/BatteryLevel()intA number in the set: [0, 5].
Launchpad/BatteryStatus()stringCritical, Low, Half, Full.

About robot hardware information
Key NameTypeExplanation
Launchpad/RobotType()stringnao, pepper, romeo.

About the posture of the robot
Key NameTypeExplanation
Launchpad/Lifted()boolTrue if someone has lifted the robot up.
Can only be true on NAO.
Launchpad/PostureFamily()stringOne of the Posture family.
Launchpad/Posture()stringOne of the Posture.
Launchpad/RobotFellRecently()boolTrue if the robot has fallen within the last 13 seconds.
Launchpad/RobotPushedRecently()boolTrue if the robot was pushed within the last 13 seconds.
Can only be true on Pepper.

Other events

You can also use the events raised by the extractors running in solitary state:
  • ALBasicAwareness
  • ALPeoplePerception
  • ALEngagementZones
  • ALGazeAnalysis
  • ALWavingDetection
  • ALMovementDetection

*Conditions expression language
* Expression grammar:
* -------------------------------------------------------------------------------------------
*   - Parenthesis ()
*
*   - Constant int: 1
*
*   - Constant floats: 1.5, 1e4
*
*   - Constant strings: double-quoted: "foo", "bar"
*
*   - Lists: [1, 2, foo]
*
*   - ALMemory keys: single-quoted: 'key12', 'motion/foo'
*       A key can be used anywhere a constant or list can be used.
*       Be careful about the data types of your keys.
*       If you refer to a memory key that does not exist, it will be an "Invalid" type
*         which effectively evaluates to 0 (false).
*       If you use a memory that has been declared, but not initialized with a value,
*         it is also an "Invalid" type, and evaluates to 0 (false).
*
*   - Qi Signals and Properties: ServiceName.SignalName, ServiceName.SignalName.MemberName
*       Can be used anywhere an ALMemory key can be used.
*       Until a Signal is raised, it will be "Invalid" and evaluate to 0 (false).
*       A Property has a value by default and will always return a value if the Property exists.
*       If a Signal/Property does not exist, it will be "Invalid" and evaluate to 0 (false).
*       "MemberName" is the case where a Signal/Property returns a struct.
*
*   - Index a list key: 'motion/foo'[2], ALMotion.FooProperty[2]
*
*   - Index a map key: ALMotion.FooSignal["bar"]
*       Only supported on Signals/Properties, not supported for ALMemory keys.
*
*   - Logical, Mathematical, bitwise operators:
*       && || ! != == <= < >= > + - / * % | & ^
*
*   - String operation functions:
*       substr("canard", 1, 3) returns "ana"
*       strlen("coin") returns 4
*       concat("a", "b") returns "ab"
*
*   - Type operation functions:
*       size([1,2,3]) returns 3.
*       type("foo") returns "String".  Other types: Invalid, Array, Bool, Int, Float, String
*       Type casting: int() float() string() bool()
*                     The parameters passed to these can be any expression.
*
*   - subsets operator:
*       True example: [1, 2] subsets [1, 2, 3, 4]
*       True example: 1 subsets [1, 2, 3, 4]
*
*   - intersects operator:
*       True example: [4, 5, 6] intersects [1, 2, 3, 4]
*       True example: [4, 5, 6] intersects 5
*
*   - random operator:
*       rand(0, 10, 1) return a random int between 0 and 10 included, the random number will be regenerated every second
*       rand(5.0, 7.0, 5) return a random float between 5.0 and 7.0 included, the random number will be regenerated every 5 seconds
*       rand(60, 80, 0) return a random int between 60 and 80 included, the random number will be generated only once per naoqi startup
*
*   - Preference key fetching function: pref("com.mydomain", "myKey")
*       Only constant strings can be passed as parameters, not ALMemory keys or expressions.
*       If the preference does not exist, an "Invalid" will be returned.
*       Otherwise all preferences are returned as "String".  It may be necessary to use
*         type casting functions around the pref() call.
*
*   - ALMemory key utility functions:
*       bang('myKey'):      True for the moment that the associated key's event is raised
*                           and false at all other times.  This only works with event based keys.
*
*       stable(expression): expression can be any expression possible with this grammar.
*                           stable() will evaluate to True as long as the returned value
*                           of it's expression are not changing.
*                           It will evaluate to false only at the moment that the expression
*                           has a change in value.
*                           This us useful when combined with time based operators.
*
*   - Time based operators:
*       ~ operator: Requires an expression to be true for given duration in seconds
*                   Example: ('myKey' < 1) ~ 1.5
*                   Meaning: myKey has been less than 1 for at least 1.5 seconds.
*
*       @ operator: Requires an expression to be true at a specific point in time in the past
*                   Example: ('myKey' == 1) @ 10.0
*                   Meaning: Exactly 10 seconds ago, myKey was equal to 1
*
*       # operator: Requires an expression to be true at any moment in time
*                     within the specified window toward the past
*                   Example: ('myKey' > 1) # 60.0
*                   Meaning: myKey was greater than 1 at some point in the last 60 seconds.
*                            It may also have had many other values during that period.
*
*       Note that time operators can be combined to describe a context.
*                   Example: 'myKey' ~ 1.5 @ 10.0 && !'myKey'
*                   Meaning: 10 seconds ago, myKey had been true for at least 1.5 seconds,
*                              and now it is false.
*
*                   Example: ('Launchpad/FocusedActivity' == "myPkg/myActivity") # 2160
*                              && ('Launchpad/FocusedActivity' != "myPkg/myActivity") ~ 3600
*                   Meaning: "myPkg/myActivity" was focused at least once in the last 6 hours,
*                              but not in the last 1 hour.
*
* Order of Operations:
* (highest precedence operation listed first, items on same line have equal precedence)
* -------------------------------------------------------------------------------------------
*   ()
*   Evaluate memory keys into constants
*   []
*   pref(), int(), float(), string(), bool(), type(), size()
*   !
*   ~, @, #
*   subsets, intersects
*   bang(), stable(), rand()
*   *, /, %
*   +, -
*   |, &, ^
*   <, <=, >, >=
*   ==, !=
*   &&
*   ||

Event list

About people and movements

Event: "Launchpad/NumMotionZone1"
callback(std::string eventName, int nbMovingObject, std::string subscriberIdentifier)
The number of moving objects detected in zone 1.

Only available during solitary state.

Event: "Launchpad/NumMotionZone2"
callback(std::string eventName, int nbMovingObject, std::string subscriberIdentifier)
The number of moving objects detected in zone 2.

Only available during solitary state.

Event: "Launchpad/NumMotionZone3"
callback(std::string eventName, int nbMovingObject, std::string subscriberIdentifier)
The number of moving objects detected in zone 3.

Only available during solitary state.

Event: "Launchpad/NoMotionInZones"
callback(std::string eventName, bool noMotionInZones, std::string subscriberIdentifier)
True when no motion is detected in any zone.

Only available during solitary state.


Event: "Launchpad/WavingDetection"
callback(std::string eventName, int wavingDetected, std::string subscriberIdentifier)
0 while no waving is detected, 1 while waving is detected.

Only available during solitary state.


Event: "Launchpad/NumPeopleZone1"
callback(std::string eventName, int nbDetectedPeople, std::string subscriberIdentifier)
The number of people detected in zone 1.

Only available during solitary state.


Event: "Launchpad/NumPeopleZone2"
callback(std::string eventName, int nbDetectedPeople, std::string subscriberIdentifier)
The number of people detected in zone 2.

Only available during solitary state.


Event: "Launchpad/NumPeopleZone3"
callback(std::string eventName, int nbDetectedPeople, std::string subscriberIdentifier)
The number of people detected in zone 3.

Only available during solitary state.


Event: "Launchpad/NoPeopleInZones"
callback(std::string eventName, bool noPeopleInZones, std::string subscriberIdentifier)
True when no people are detected in any zone.

Only available during solitary state.


Event: "Launchpad/PeopleNotSeen"
callback(std::string eventName, bool nobody, std::string subscriberIdentifier)
True when PeoplePerception/VisiblePeopleList is empty.

Only available during solitary state.


Event: "Launchpad/SameTrackedHuman"
callback(std::string eventName, bool sameHuman, std::string subscriberIdentifier)
True as long as the same person is being tracked. Momentarily false when the tracked person changes. The tracked person is determined by BasicAwareness.

Only available if BasicAwareness is started.


Event: "Launchpad/ZoneOfTrackedHuman"
callback(std::string eventName, int zoneNum, std::string subscriberIdentifier)
The zone that the tracked person is in: 1, 2, or 3. 0 if no one is tracked.

Only available if BasicAwareness is started.


Event: "Launchpad/DistanceOfTrackedHuman"
callback(std::string eventName, float distance, std::string subscriberIdentifier)
The distance in meters to the tracked human. -1.0 if no one is tracked.

Only available if BasicAwareness is started.


Event: "Launchpad/TrackedHumanIsLookingAtRobot"
callback(std::string eventName, bool looking, std::string subscriberIdentifier)
True when the tracked person is looking at the robot.

Only available if BasicAwareness is started.

About battery information


Event: "Launchpad/BatteryIsCharging"
callback(std::string eventName, bool charging, std::string subscriberIdentifier)
True if the battery is charging.


Event: "Launchpad/BatteryLevel"
callback(std::string eventName, int level, std::string subscriberIdentifier)
A number in the set [0, 5].


Event: "Launchpad/BatteryStatus"
callback(std::string eventName, std::string level, std::string subscriberIdentifier)
Critical, Low, Half, Full.

About robot hardware information


Event: "Launchpad/RobotType"
callback(std::string eventName, std::string type, std::string subscriberIdentifier)
nao, pepper, romeo.

About the posture of the robot


Event: "Launchpad/Lifted"
callback(std::string eventName, bool lifted, std::string subscriberIdentifier)
True if someone has lifted the robot up.

Can only be true on NAO.


Event: "Launchpad/PostureFamily"
callback(std::string eventName, std::string family, std::string subscriberIdentifier)
One of the Posture family.


Event: "Launchpad/Posture"
callback(std::string eventName, std::string posture, std::string subscriberIdentifier)
One of the Posture.


Event: "Launchpad/RobotFellRecently"
callback(std::string eventName, bool hasFallen, std::string subscriberIdentifier)
True if the robot has fallen within the last 13 seconds.


Event: "Launchpad/RobotPushedRecently"
callback(std::string eventName, bool wasPushed, std::string subscriberIdentifier)
True if the robot has was pushed within the last 13 seconds.

Can only be true on Pepper.

About the temperature of the joints of the robot


Event: "Launchpad/TemperatureStatus"
callback(std::string eventName, std::string family, std::string subscriberIdentifier)
Overall temperature health of the robot: Cold, Warm, Hot, Critical


Event: "Launchpad/HighestTemperature"
callback(std::string eventName, float posture, std::string subscriberIdentifier)
The highest temperature found on the robot, in Celsius.


Event: "Launchpad/HighestJoint"
callback(std::string eventName, bool hasFallen, std::string subscriberIdentifier)
The name of the hottest joint.

HeadYaw, HeadPitch, LShoulderPitch, LShoulderRoll, LElbowYaw, LElbowRoll, LWristYaw, LHand, RShoulderPitch, RShoulderRoll, RElbowYaw, RElbowRoll, RWristYaw, RHand, LHipRoll, LHipYawPitch, LHipPitch, LKneePitch, LAnkleRoll, LAnklePitch, RHipRoll, RHipYawPitch, RHipPitch, RKneePitch, RAnkleRoll, RAnklePitch

Additional information about NAO’s Joints.

About time

Event: "Launchpad/Year"
callback(std::string eventName, int year, std::string subscriberIdentifier)
Example Value: 2013


Event: "Launchpad/Month"
callback(std::string eventName, int month, std::string subscriberIdentifier)
Example Value: 1

Can be 1~12.



Event: "Launchpad/MonthName"
callback(std::string eventName, int month, std::string subscriberIdentifier)
Example Value: January


Event: "Launchpad/Day"
callback(std::string eventName, int day, std::string subscriberIdentifier)
Example Value: 1

Day of the year, 1~366.


Event: "Launchpad/DayName"
callback(std::string eventName, int day, std::string subscriberIdentifier)
Example Value: Sunday


Event: "Launchpad/Date"
callback(std::string eventName, int date, std::string subscriberIdentifier)
Example Value: 12

Day of the month, starting from 1.


Event: "Launchpad/Hour"
callback(std::string eventName, int hour, std::string subscriberIdentifier)
Example Value: 14 (2:00pm)

24-hour time.


Event: "Launchpad/Minute"
callback(std::string eventName, int minute, std::string subscriberIdentifier)
Example Value: 42


Event: "Launchpad/MinuteOfDay"
callback(std::string eventName, int minuteOfDay, std::string subscriberIdentifier)
Example Value: 120

120 would correspond to 2:00am.


Event: "Launchpad/Week"
callback(std::string eventName, int week, std::string subscriberIdentifier)
Example Value: 2

Zero-based week of the year, 0~53.S

About activity history


Event: "Launchpad/LifeTime"
callback(std::string eventName, int time, std::string subscriberIdentifier)
The current value of ALAutonomousLifeProxy::getLifeTime.


Event: "Launchpad/State"
callback(std::string eventName, std::string state, std::string subscriberIdentifier)
The current state of Autonomous Life.

Can be one of the States.


Event: "Launchpad/PreviousState"
callback(std::string eventName, std::string previousState, std::string subscriberIdentifier)
The previous state of Autonomous Life.

Can be one of the States.

Note, it is possible for the previous state to equal the current state if the current state was re-entered.



Event: "Launchpad/FocusedActivity"
callback(std::string eventName, std::string activity, std::string subscriberIdentifier)
The currently focused activity.

Note, if no activity is running, this will be an empty string (“”)

To have condition on the time since your application was last focused, follow this pattern: (('Launchpad/FocusedActivity' != "my_attractions/child_attraction1") ~ 60)


Event: "Launchpad/PreviousActivity"
callback(std::string eventName, std::string activity, std::string subscriberIdentifier)
The previously focused activity.

Note: “” (no activity running) is not considered for PreviousActivity


Event: "Launchpad/FocusCount/myPackageUUID/myActivityPath"
callback(std::string eventName, int countFocused, std::string subscriberIdentifier)
The count of how many occasions this activity has been focused.

Note: replace myPackageUUID and myActivityPath with the corresponding values from your Activity’s manifest data.

コメントをかく


「http://」を含む投稿は禁止されています。

利用規約をご確認のうえご記入下さい

Menu

NAOqi - Developer guide

Creating an application?

Programming for a living robot?

Other tutorials?

Choregraphe Suite?

どなたでも編集できます