Created
February 5, 2016 06:34
-
-
Save mechamogera/00ab3c7cfd6bdd915b87 to your computer and use it in GitHub Desktop.
PepperのBasicAwarenessをオン、オフするスクリプトサンプル
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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