Pepper 1 BOX Box SensingVisionSurroundingsBasic Awareness SensingHuman UnderstandingEmotionGet
Pepper
人臉情緒偵測 1. 請依下圖將BOX 拉出到畫面上並連線, Box 路徑如下: [Sensing][Vision][Surroundings]Basic Awareness [Sensing][Human Understanding][Emotion]Get Expression [Speech][Creation]Animated Say Text 2. 設定[Basic Awareness] Box 的參數,如下圖所示。
人臉情緒偵測 1. 程式觀察: 從ALMemory 取得People. Perception/Person/<ID>/Expression. Properties 資訊,取得 [neutral, happy, surprised, angry , sad] 等資訊。
拍張照吧 請依下圖將BOX 拉出到畫面上並連線, Box 路徑如下: �� [Sensing][Vision]Take Picture �� [Multimedia][Tablet]Show Image
QR CODE 本範例用以說明使用Pepper 的鏡頭掃描QR CODE。 使用ALBarcode. Reader API。
QR CODE 1. 請依下圖將BOX 拉出到畫面上並連線, Box 路徑如下 [Programming][Tools]Log
QR CODE 1. Click [Upload to Robot and Play] 執行測試。 2. 將QR Code 圖片放置在Pepper 的額頭的Camera 前方, 即會看到Log 訊息顯示在 Choregraphe 下方的Log Viewer 中。
QR CODE 補充說明: Camera Auto. Focus 自動對焦功能啟動 1. 請依下圖將BOX 拉出到畫面上並連線, Box 路徑如下 [Programming][Templates]Python Script
Hello World Tablet ! 本範例用以說明如何開發Pepper Html網頁,並且透過網頁的 Java. Script SDK 讓Pepper 說話。
Hello World Tablet ! 1. 請依下圖將BOX 拉出到畫面上並連線, Box 路徑如下: [Multimedia][Tablet]Show App 2. 儲存專案。
Hello World Tablet ! 1. Click [Upload to Robot and Play] 執行測試。 2. Pepper 平板會顯示[說話] 按鈕。 3. 按下[說話] 按鈕,Pepper 會說“你好” 。
Python 安裝 下載位置 https: //www. python. org/downloads/
Python 字串 # encoding: utf-8 mystring= "香蕉" print (len(mystring)) for word in mystring: print (word) • 字串可以進行組合、分割、搜尋、切割及長度計算等功能。 • Choregraphe 中, 中文已使用Unicode規則。
Python 基本說明 # encoding: utf-8 • list 內容可以同時包含數字及字串。 my_list = [1, 2, 3, 4, 5, "aa", "bb"] print (my_list[0]) • list 內容可以搜尋。 print (my_list[1: 3]) • list 內容可以新增刪除。 print (my_list. index("aa")) • list 內容可以排序。 my_list. append(123) my_list. remove("aa") my_list = [1, 2, 5, 8, 3, 0] my_list. sort()
Python 字串 greeting = "hello, stan" • 字串可以進行組合、分割、搜尋、切割及長度計算等功能。 print (len(greeting)) print ("Stan" + "Cheng") print ("a" in "abcdefg") my_str = "xxx yyy zzz" print (my_str. split()) #['xxx', 'yyy', 'zzz’] my_str_ = "abcdefg" print (my_str_[0]) print (my_str_[-1]) print (my_str_[1: 4]) • Choregraphe 中, 中文已使用Unicode規則。
Python 邏輯判斷及廻圈 # encoding: utf-8 import sys Import • 匯入套件 x=int(sys. argv[1]) • Python 可以使用if 進行邏輯判斷。 if x < 0: print ('x < 0') If: elif: else: elif x == 0: print ('x = 0') else: print ('x > 0') ------- # encoding: utf-8 for x in range(2): for y in range(2): print(x * y, end=" ") print() • 左下側的範例列印出 9*9 乘法表。
Python 自定函式及類別 # encoding: utf-8 def my_function(x, y): return x-10, y+10 x, y = my_function(10, 20) print (x, y) • Python 自定Function 函數呼叫
Python 自定函式及類別 class Student: def __init__(self, name, grade, age): self. name = name self. grade = grade self. age = age def set_name(self, name): self. name = name student_objects=[] student_objects. append( Student('Tom', 'B', 15) ) student_objects. append( Student('david', 'A', 12) ) student_objects. append( Student('Jane', 'A', 10) ) student_objects[0]. set_name('John') for i in student_objects: print (i. name, i. grade, i. age) • Python 自定Class 類別物件
常用涵式-替換文字 str. replace(old, new[, max]) old – 想要換掉的文字。 new – 取代的文字。 max – 最多替換次數 str = "this is string example. . wow!!! this is really string"; print (str. replace("is", "was")) print (str. replace("is", "was", 2))
常用涵式-字串切割 Split str. split(str="", num=string. count(str)) 參數 str – 要用什麼字來切割字串 num – 切割次數, 預設全切 str = "Line 1 -abcdef|n. Line 2 -abc|n. Line 4 -abcd"; print (str. split("|")) #以|為切割字 print (str. split("|", 1 )) #以|為切割字,只切一次
- Slides: 35