Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
PepperのBasicAwarenessをオン、オフするスクリプトサンプル
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import sys
from naoqi import ALProxy
def on(args, bap):
bap.startAwareness()
bap.setEngagementMode("Unengaged")
bap.setStimulusDetectionEnabled("Sound", True)
bap.setStimulusDetectionEnabled("Movement", True)
bap.setStimulusDetectionEnabled("People", True)
bap.setStimulusDetectionEnabled("Touch", True)
bap.setTrackingMode("Head")
show(args, bap)
def off(args, bap):
bap.stopAwareness()
show(args, bap)
def show(args, bap):
print("Running:" + str(bap.isAwarenessRunning()))
print("Engagement Mode:" + str(bap.getEngagementMode()))
print("Sound Stimulus:" + str(bap.isStimulusDetectionEnabled("Sound")))
print("Movement Stimulus:" + str(bap.isStimulusDetectionEnabled("Movement")))
print("People Stimulus:" + str(bap.isStimulusDetectionEnabled("People")))
print("Touch Stimulus:" + str(bap.isStimulusDetectionEnabled("Touch")))
print("TrackingMode:" + str(bap.getTrackingMode()))
parser = argparse.ArgumentParser()
subparsers = parser.add_subparsers(help='sub-command help')
parser_on = subparsers.add_parser('on')
parser_on.set_defaults(func=on)
parser_off = subparsers.add_parser('off')
parser_off.set_defaults(func=off)
parser_off = subparsers.add_parser('show')
parser_off.set_defaults(func=show)
args = parser.parse_args()
bap = ALProxy('ALBasicAwareness', 'XXX.XXX.XXX.XXX', 9559)
args.func(args, bap)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment