diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000000000000000000000000000000000000..94a25f7f4cb416c083d265558da75d457237d671 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="VcsDirectoryMappings"> + <mapping directory="$PROJECT_DIR$" vcs="Git" /> + </component> +</project> \ No newline at end of file diff --git a/NB/NB_Dialog.py b/NB/NB_Dialog.py new file mode 100644 index 0000000000000000000000000000000000000000..8893b551893d773c6b417fa00c726d97f2eaae1c --- /dev/null +++ b/NB/NB_Dialog.py @@ -0,0 +1,387 @@ +#! /usr/bin/env python +# -*- encoding: UTF-8 -*- + +"""Example: Using ALDialog Methods""" + +import qi +import argparse +import sys + + +def main(session): + """ + This example uses ALDialog methods. + It's a short dialog session with two topics. + """ + # Getting the service ALDialog + ALDialog = session.service("ALDialog") + ALDialog.setLanguage("English") + motion_service = session.service("ALMotion") + + # writing topics' qichat code as text strings (end-of-line characters are important!) + topic_content_1 = ('topic: ~example_topic_content()\n' + 'language: enu\n' + 'include: lexicon_enu.top\n' + 'concept:(greetings) ^rand[hi hello "hey there"]\n' + 'concept:(wine) [red white] wine\n' + 'concept:(alcohol) [beer ~wine]\n' + 'concept:(food) [fruits chicken beef eggs tacos anything chocolate mofin]\n' + 'u:(~greetings) [~greetings]\n' + 'u: (how are you) Hello human, I am fine thank you and you?\n' + 'u1: (how are you) Why are you asking again?\n' + 'u1:(~im_good) I’m glad to hear that! would you like to know my age?\n' + 'u2:(~yes) I am seven years old bitch, and you?\n' + 'u3:(~i_am {20} years old) You are too old, Touch my head or hands if you want to play more\n' + 'u2:(~no) Thats fine, lets move on, Touch my head or hands if you want to play more\n' + 'u1:(~im_ok) I’m glad to hear that you are ok, would you like to know my age?\n' + 'u2:(~yes) I am seven years old bitch, and you?\n' + 'u3:(~i_am {20} years old) You are too old, Touch my head or hands if you want to play more\n' + 'u2:(~no) Thats fine, lets move on, Touch my head or hands if you want to play more\n' + 'u1:(~i_dont_feel_good) sorry to hear that, would you like to know my age?\n' + 'u2:(~yes) I am seven years old bitch, and you?\n' + 'u3:(~i_am {20} years old) You are too old, Touch my head or hands if you want to play more\n' + 'u2:(~no) Thats fine, lets move on, Touch or hands my head if you want to play more\n' + 'u1:(~im_sick) I hope you can recover soon, would you like to know my age?\n' + 'u2:(~yes) I am seven years old bitch, and you?\n' + 'u3:(~i_am {20} years old) You are too old, Touch my head or hands if you want to play more\n' + 'u2:(~no) Thats fine, lets move on, Touch my head or hands if you want to play more\n' + 'u1:(~im_tired) you should rest and then you will feel better, would you like to know my age?\n' + 'u1:(~im_angry) Why are you angry?\n' + 'u:(~i_am hungry) I can bring food, What kind of food do you want?\n' + 'u1: (I [want "would like"] {some} _~food) Sure! You must really like $1 .\n' + 'u:(I want to drink something) do you want ~alcohol ?\n' + 'u: (Good morning Pepper) good morning!\n' + 'u:(~i_am happy) I’m glad to hear that!\n' + 'u:(I love Pepper) I love you too!\n' + 'u:(I hate you) I hate you too!\n' + 'u:(I love you) I love you too!\n') + + topic_content_2 = ('topic: ~dummy_topic()\n' + 'language: enu\n' + 'u:(Where are you from) I was designed in Softbank robotics headquarters in Paris\n' + 'u:(can_you walk) Do you want me to walk?\n' + 'u1:(~yes) Too bad, I can not walk for the moment\n' + 'u1:(~no) Let’s do something else then!\n' + 'u:(Who am I) You are a student\n' + 'u:(Which class is this) Applied computer science project\n' + 'u:(What can I ask) ask something interesting\n' + 'u:(How old are you) I am seven years old bitch\n' + 'u:(tell me your position) Sure. ^call(ALRobotPosture.getPosture())\n' + 'c1:(_*) $1\n' + 'c1:(crouch) My position is crouch.\n' + 'u2:(ok) What about you ?\n' + 'u:(Are you a robot) Im not a robot, im Pepper\n') + + topic_content_4 = ('topic: ~cats()\n' + 'language: enu\n' + 'u:(What are you) I am free today!\n' + 'u:(Good morning) good morning!\n') + + topic_content_3 = ('topic: ~touching()\n' + 'language: enu\n' + # 'u: ([e:FaceDetected]) $FaceDetected[1][1][1]\n' + 'u: ([e:FrontTactilTouched e:MiddleTactilTouched e:RearTactilTouched]) You touched my head!\n' + '%script\n' + 'names = list()\n' + 'times = list()\n' + 'keys = list()\n' + + 'names.append("HeadPitch")\n' + 'times.append([1.52, 2.36, 3.32, 4.16, 5.08, 5.92, 6.88, 7.72, 8.16, 8.84, 9.68, 10.64, 11.48, 12.4, 13.24, 14.2, 15.04, 16.24])\n' + 'keys.append([-0.476475, 0.338594, -0.476475, 0.338594, -0.476475, 0.338594, -0.476475, 0.338594, 0.0680678, -0.476475, 0.338594, -0.476475, 0.338594, -0.476475, 0.338594, -0.476475, 0.338594, -0.17185])\n' + + 'names.append("HeadYaw")\n' + 'times.append([1.52, 2.36, 3.32, 4.16, 5.08, 5.92, 6.88, 7.72, 8.16, 8.84, 9.68, 10.64, 11.48, 12.4, 13.24, 14.2, 15.04, 16.24])\n' + 'keys.append([-0.745256, 0.0411095, -0.745256, 0.0411095, -0.745256, 0.018508, -0.745256, 0.289725, 0.425684, 0.745256, -0.0411095, 0.745256, -0.0411095, 0.745256, -0.018508, 0.745256, -0.289725, 0.00916195])\n' + + 'names.append("HipPitch")\n' + 'times.append([0.68, 1.52, 2.36, 3.32, 4.16, 5.08, 5.92, 6.88, 7.72, 8.84, 9.68, 10.64, 11.48, 12.4, 13.24, 14.2, 15.04, 16.24])\n' + 'keys.append([-0.376033, -0.036954, -0.344024, -0.0404086, -0.339835, -0.038321, -0.341769, -0.0367355, -0.34817, -0.035085, -0.341769, -0.0382761, -0.339629, -0.0396041, -0.341605, -0.0362713, -0.343065, -0.0495279])\n' + + 'names.append("HipRoll")\n' + 'times.append([1.52, 2.36, 3.32, 4.16, 5.08, 5.92, 6.88, 7.72, 8.84, 9.68, 10.64, 11.48, 12.4, 13.24, 14.2, 15.04, 16.24])\n' + 'keys.append([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])\n' + + 'names.append("KneePitch")\n' + 'times.append([0.68, 1.52, 2.36, 3.32, 4.16, 5.08, 5.92, 6.88, 7.72, 8.84, 9.68, 10.64, 11.48, 12.4, 13.24, 14.2, 15.04, 16.24])\n' + 'keys.append([0.166965, -0.00379234, 0.185949, -0.0129339, 0.180821, -0.00320919, 0.187035, -0.00931236, 0.182162, -0.0111253, 0.187035, -0.00683206, 0.184441, -0.0119436, 0.179202, -0.0114876, 0.187691, -0.013167])\n' + + 'names.append("LElbowRoll")\n' + 'times.append([0.68, 1.04, 1.48, 2.32, 3.28, 4.12, 5.04, 5.88, 6.84, 7.68, 8.12, 8.48, 8.8, 9.2, 9.64, 10.12, 10.6, 11, 11.44, 11.92, 12.36, 12.76, 13.2, 13.68, 14.16, 14.56, 15, 15.6, 16.2, 16.4])\n' + 'keys.append([-1.37289, -1.12923, -0.369652, -0.202446, -0.369652, -0.202446, -0.369652, -0.202446, -0.369652, -0.202446, -0.820305, -0.23305, -0.138102, -1.309, -0.257754, -1.4591, -0.138102, -1.309, -0.257754, -1.4591, -0.138102, -1.309, -0.257754, -1.4591, -0.138102, -1.309, -0.257754, -0.984366, -0.513992, -0.424876])\n' + + 'names.append("LElbowYaw")\n' + 'times.append([0.68, 1.48, 2.32, 3.28, 4.12, 5.04, 5.88, 6.84, 7.68, 8.12, 8.48, 8.8, 9.2, 9.64, 10.12, 10.6, 11, 11.44, 11.92, 12.36, 12.76, 13.2, 13.68, 14.16, 14.56, 15, 15.6, 16.2, 16.4])\n' + 'keys.append([-0.65506, -0.380475, -0.618244, -0.380475, -0.618244, -0.380475, -0.618244, -0.380475, -0.618244, 0.410152, 0.818273, 0.851412, 0.0750492, 0.00157596, 0.460767, 0.851412, 0.0750492, 0.00157596, 0.460767, 0.851412, 0.0750492, 0.00157596, 0.460767, 0.851412, 0.0750492, 0.00157596, -1.34565, -1.22484, -1.21037])\n' + + 'names.append("LHand")\n' + 'times.append([0.68, 1.04, 1.48, 2.32, 3.28, 4.12, 5.04, 5.88, 6.84, 7.68, 8.48, 8.8, 9.2, 9.64, 10.12, 10.6, 11, 11.44, 11.92, 12.36, 12.76, 13.2, 13.68, 14.16, 14.56, 15, 15.6, 16.2, 16.4])\n' + 'keys.append([0.2, 0.6, 0.2648, 0.264, 0.2648, 0.264, 0.2648, 0.264, 0.2648, 0.264, 0.663802, 0.928, 0.3, 0.0283999, 0.75, 0.928, 0.3, 0.0283999, 0.75, 0.928, 0.3, 0.0283999, 0.75, 0.928, 0.3, 0.5284, 0.936396, 0.950347, 0.2968])\n' + + 'names.append("LShoulderPitch")\n' + 'times.append([0.68, 1.48, 2.32, 3.28, 4.12, 5.04, 5.88, 6.84, 7.68, 8.12, 8.48, 8.8, 9.64, 10.6, 11.44, 12.36, 13.2, 14.16, 15, 16.4])\n' + 'keys.append([0.97784, 1.29573, 1.40466, 1.29573, 1.40466, 1.29573, 1.40466, 1.29573, 1.40466, 0.172788, -1.04904, -1.19188, 0.995607, -1.19188, 0.995607, -1.19188, 0.995607, -1.19188, 0.995607, 1.47106])\n' + + 'names.append("LShoulderRoll")\n' + 'times.append([0.68, 1.48, 2.32, 3.28, 4.12, 5.04, 5.88, 6.84, 7.68, 8.48, 8.8, 9.2, 9.64, 10.12, 10.6, 11, 11.44, 11.92, 12.36, 12.76, 13.2, 13.68, 14.16, 14.56, 15, 15.6, 16.2])\n' + 'keys.append([0.500047, 0.401871, 0.35585, 0.401871, 0.35585, 0.401871, 0.35585, 0.401871, 0.35585, 0.886453, 0.966481, 1.23332, 0.324005, 1.23332, 0.966481, 1.23332, 0.324005, 1.23332, 0.966481, 1.23332, 0.324005, 1.23332, 0.966481, 1.23332, 0.324005, 0.407503, 0.146991])\n' + + 'names.append("LWristYaw")\n' + 'times.append([0.68, 1.04, 1.48, 2.32, 3.28, 4.12, 5.04, 5.88, 6.84, 7.68, 8.48, 8.8, 9.64, 10.6, 11.44, 12.36, 13.2, 14.16, 15, 16.2, 16.4])\n' + 'keys.append([0.11961, -0.289725, -0.395814, -0.420357, -0.395814, -0.420357, -0.395814, -0.420357, -0.395814, -0.420357, -0.122946, -0.107338, -0.400331, -0.107338, -0.400331, -0.107338, -0.400331, -0.107338, -0.400331, 0.000370312, 0.0827939])\n' + + 'names.append("RElbowRoll")\n' + 'times.append([0.68, 1.08, 1.52, 1.92, 2.36, 2.84, 3.32, 3.72, 4.16, 4.64, 5.08, 5.48, 5.92, 6.4, 6.88, 7.28, 7.72, 8.52, 8.84, 9.68, 10.64, 11.48, 12.4, 13.24, 14.2, 15.04, 15.64, 16.24, 16.44])\n' + 'keys.append([1.34689, 1.1205, 0.138102, 1.309, 0.257754, 1.4591, 0.138102, 1.309, 0.257754, 1.4591, 0.138102, 1.309, 0.257754, 1.4591, 0.138102, 1.309, 0.257754, 0.372085, 0.369652, 0.202446, 0.369652, 0.202446, 0.369652, 0.202446, 0.369652, 0.202446, 0.82205, 0.519567, 0.429562])\n' + + 'names.append("RElbowYaw")\n' + 'times.append([0.68, 1.08, 1.52, 1.92, 2.36, 2.84, 3.32, 3.72, 4.16, 4.64, 5.08, 5.48, 5.92, 6.4, 6.88, 7.28, 7.72, 8.52, 8.84, 9.68, 10.64, 11.48, 12.4, 13.24, 14.2, 15.04, 15.64, 16.24, 16.44])\n' + 'keys.append([0.59515, 0.567232, -0.851412, -0.0750492, -0.00157596, -0.460767, -0.851412, -0.0750492, -0.00157596, -0.460767, -0.851412, -0.0750492, -0.00157596, -0.460767, -0.851412, -0.0750492, -0.00157596, 0.352279, 0.380475, 0.618244, 0.380475, 0.618244, 0.380475, 0.618244, 0.380475, 0.618244, 1.26711, 1.23132, 1.21028])\n' + + 'names.append("RHand")\n' + 'times.append([0.68, 1.08, 1.52, 1.92, 2.36, 2.84, 3.32, 3.72, 4.16, 4.64, 5.08, 5.48, 5.92, 6.4, 6.88, 7.28, 7.72, 8.52, 8.84, 9.68, 10.64, 11.48, 12.4, 13.24, 14.2, 15.04, 16.24, 16.44])\n' + 'keys.append([0.2, 0.95, 0.928, 0.3, 0.0283999, 0.75, 0.928, 0.3, 0.0283999, 0.75, 0.928, 0.3, 0.0283999, 0.75, 0.928, 0.3, 0.5284, 0.271478, 0.2648, 0.264, 0.2648, 0.264, 0.2648, 0.264, 0.2648, 0.264, 0.596785, 0.2976])\n' + + 'names.append("RShoulderPitch")\n' + 'times.append([0.68, 1.52, 2.36, 3.32, 4.16, 5.08, 5.92, 6.88, 7.72, 8.52, 8.84, 9.68, 10.64, 11.48, 12.4, 13.24, 14.2, 15.04, 16.24])\n' + 'keys.append([0.915841, -1.19188, 0.995607, -1.19188, 0.995607, -1.19188, 0.995607, -1.19188, 0.995607, 1.281, 1.29573, 1.40466, 1.29573, 1.40466, 1.29573, 1.40466, 1.29573, 1.40466, 1.47268])\n' + + 'names.append("RShoulderRoll")\n' + 'times.append([0.68, 1.08, 1.52, 1.92, 2.36, 2.84, 3.32, 3.72, 4.16, 4.64, 5.08, 5.48, 5.92, 6.4, 6.88, 7.28, 7.72, 8.52, 8.84, 9.68, 10.64, 11.48, 12.4, 13.24, 14.2, 15.04, 15.64, 16.44])\n' + 'keys.append([-0.905123, -1.30837, -0.966481, -1.23332, -0.324005, -1.23332, -0.966481, -1.23332, -0.324005, -1.23332, -0.966481, -1.23332, -0.324005, -1.23332, -0.966481, -1.23332, -0.324005, -0.397371, -0.401871, -0.35585, -0.401871, -0.35585, -0.401871, -0.35585, -0.401871, -0.35585, -0.310669, -0.174533])\n' + + 'names.append("RWristYaw")\n' + 'times.append([0.68, 1.52, 2.36, 3.32, 4.16, 5.08, 5.92, 6.88, 7.72, 8.52, 8.84, 9.68, 10.64, 11.48, 12.4, 13.24, 14.2, 15.04, 16.24, 16.44])\n' + 'keys.append([-0.401949, 0.107338, 0.400331, 0.107338, 0.400331, 0.107338, 0.400331, 0.107338, 0.400331, 0.391888, 0.395814, 0.420357, 0.395814, 0.420357, 0.395814, 0.420357, 0.395814, 0.420357, 0.00501826, 0.108872])\n' + 'ALMotion.angleInterpolation(names, keys, times, True)\n' + '%script\n' + 'u1:(~yes) Nice! Do you want me to dance?\n' + 'u2:(~yes) Sure! ^call(dance())\n' + 'u2:(~no) ok, lets move on\n' + 'u1:(~no) Its fine, Do you want me to dance?\n' + 'u2:(~yes) Sure! ^call(dance())\n' + # 'u2:(~yes) Sure! ^call(ALMotion.setAngles(["HeadYaw"],[1.52, 2.36, 3.32, 4.16, 5.08],[-0.476475,0.338594,-0.476475,0.338594,-0.476475],True))\n' + 'u2:(~no) ok, lets move on\n' + 'u: ([e:HandRightBackTouched e:HandLeftBackTouched]) You touched my hands Are you hungry?\n' + 'u1:(~i_am hungry) I can bring food, What kind of food do you want?\n' + 'u2: (I [want "would like"] {some} _~food) Sure! You must really like $1 .\n' + 'u2: (~food) Sure! You must really like $1\n' + 'u1:(~yes) I can bring food, What kind of food do you want?\n' + 'u2: (I [want "would like"] {some} _~food) Sure! You must really like $1. where are you from?\n' + 'u3:(~i_am from {Norway}) Im so sorry for you\n' + 'u1:(~no) ok, where are you from?\n' + 'u2:(~i_am from {Norway}) Im so sorry for you\n' + 'u: (Nice dance) Thank you\n') + + #ALDialog.unloadTopic("cats") + #ALDialog.unloadTopic("cats2") + #ALDialog.unloadTopic("cats3") + #ALDialog.unloadTopic("cats4") + #ALDialog.unloadTopic("cats5") + + # Loading the topics directly as text strings + #topic_name_1 = ALDialog.loadTopicContent(topic_content_1) + #topic_name_2 = ALDialog.loadTopicContent(topic_content_2) + #topic_name_3 = ALDialog.loadTopicContent(topic_content_3) + topic_name_4 = ALDialog.loadTopicContent(topic_content_4) + + + # Activating the loaded topics + #ALDialog.activateTopic(topic_name_1) + #ALDialog.activateTopic(topic_name_2) + #ALDialog.activateTopic(topic_name_3) + ALDialog.activateTopic(topic_name_4) + + print(ALDialog.getAllLoadedTopics()) + + + # Starting the dialog engine - we need to type an arbitrary string as the identifier + # We subscribe only ONCE, regardless of the number of topics we have activated + ALDialog.subscribe('my_dialog_example') + + try: + raw_input("\nSpeak to the robot using rules from both the activated topics. Press Enter when finished:") + finally: + # stopping the dialog engine + ALDialog.unsubscribe('my_dialog_example') + + # Deactivating all topics + #ALDialog.deactivateTopic(topic_name_1) + #ALDialog.deactivateTopic(topic_name_2) + #ALDialog.deactivateTopic(topic_name_3) + ALDialog.deactivateTopic(topic_name_4) + + # now that the dialog engine is stopped and there are no more activated topics, + # we can unload all topics and free the associated memory + #ALDialog.unloadTopic(topic_name_1) + #ALDialog.unloadTopic(topic_name_2) + #ALDialog.unloadTopic(topic_name_3) + ALDialog.unloadTopic(topic_name_4) + print(ALDialog.getAllLoadedTopics()) + + + +def dance(): + names = list() + times = list() + keys = list() + + motion_service = session.service("ALMotion") + + names.append("HeadPitch") + times.append( + [1.52, 2.36, 3.32, 4.16, 5.08, 5.92, 6.88, 7.72, 8.16, 8.84, 9.68, 10.64, 11.48, 12.4, 13.24, 14.2, 15.04, + 16.24]) + keys.append( + [-0.476475, 0.338594, -0.476475, 0.338594, -0.476475, 0.338594, -0.476475, 0.338594, 0.0680678, -0.476475, + 0.338594, -0.476475, 0.338594, -0.476475, 0.338594, -0.476475, 0.338594, -0.17185]) + + names.append("HeadYaw") + times.append( + [1.52, 2.36, 3.32, 4.16, 5.08, 5.92, 6.88, 7.72, 8.16, 8.84, 9.68, 10.64, 11.48, 12.4, 13.24, 14.2, 15.04, + 16.24]) + keys.append( + [-0.745256, 0.0411095, -0.745256, 0.0411095, -0.745256, 0.018508, -0.745256, 0.289725, 0.425684, 0.745256, + -0.0411095, 0.745256, -0.0411095, 0.745256, -0.018508, 0.745256, -0.289725, 0.00916195]) + + names.append("HipPitch") + times.append( + [0.68, 1.52, 2.36, 3.32, 4.16, 5.08, 5.92, 6.88, 7.72, 8.84, 9.68, 10.64, 11.48, 12.4, 13.24, 14.2, 15.04, + 16.24]) + keys.append( + [-0.376033, -0.036954, -0.344024, -0.0404086, -0.339835, -0.038321, -0.341769, -0.0367355, -0.34817, -0.035085, + -0.341769, -0.0382761, -0.339629, -0.0396041, -0.341605, -0.0362713, -0.343065, -0.0495279]) + + names.append("HipRoll") + times.append( + [1.52, 2.36, 3.32, 4.16, 5.08, 5.92, 6.88, 7.72, 8.84, 9.68, 10.64, 11.48, 12.4, 13.24, 14.2, 15.04, 16.24]) + keys.append([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) + + names.append("KneePitch") + times.append( + [0.68, 1.52, 2.36, 3.32, 4.16, 5.08, 5.92, 6.88, 7.72, 8.84, 9.68, 10.64, 11.48, 12.4, 13.24, 14.2, 15.04, + 16.24]) + keys.append([0.166965, -0.00379234, 0.185949, -0.0129339, 0.180821, -0.00320919, 0.187035, -0.00931236, 0.182162, + -0.0111253, 0.187035, -0.00683206, 0.184441, -0.0119436, 0.179202, -0.0114876, 0.187691, -0.013167]) + + names.append("LElbowRoll") + times.append( + [0.68, 1.04, 1.48, 2.32, 3.28, 4.12, 5.04, 5.88, 6.84, 7.68, 8.12, 8.48, 8.8, 9.2, 9.64, 10.12, 10.6, 11, 11.44, + 11.92, 12.36, 12.76, 13.2, 13.68, 14.16, 14.56, 15, 15.6, 16.2, 16.4]) + keys.append( + [-1.37289, -1.12923, -0.369652, -0.202446, -0.369652, -0.202446, -0.369652, -0.202446, -0.369652, -0.202446, + -0.820305, -0.23305, -0.138102, -1.309, -0.257754, -1.4591, -0.138102, -1.309, -0.257754, -1.4591, -0.138102, + -1.309, -0.257754, -1.4591, -0.138102, -1.309, -0.257754, -0.984366, -0.513992, -0.424876]) + + names.append("LElbowYaw") + times.append( + [0.68, 1.48, 2.32, 3.28, 4.12, 5.04, 5.88, 6.84, 7.68, 8.12, 8.48, 8.8, 9.2, 9.64, 10.12, 10.6, 11, 11.44, + 11.92, 12.36, 12.76, 13.2, 13.68, 14.16, 14.56, 15, 15.6, 16.2, 16.4]) + keys.append( + [-0.65506, -0.380475, -0.618244, -0.380475, -0.618244, -0.380475, -0.618244, -0.380475, -0.618244, 0.410152, + 0.818273, 0.851412, 0.0750492, 0.00157596, 0.460767, 0.851412, 0.0750492, 0.00157596, 0.460767, 0.851412, + 0.0750492, 0.00157596, 0.460767, 0.851412, 0.0750492, 0.00157596, -1.34565, -1.22484, -1.21037]) + + names.append("LHand") + times.append( + [0.68, 1.04, 1.48, 2.32, 3.28, 4.12, 5.04, 5.88, 6.84, 7.68, 8.48, 8.8, 9.2, 9.64, 10.12, 10.6, 11, 11.44, + 11.92, 12.36, 12.76, 13.2, 13.68, 14.16, 14.56, 15, 15.6, 16.2, 16.4]) + keys.append( + [0.2, 0.6, 0.2648, 0.264, 0.2648, 0.264, 0.2648, 0.264, 0.2648, 0.264, 0.663802, 0.928, 0.3, 0.0283999, 0.75, + 0.928, 0.3, 0.0283999, 0.75, 0.928, 0.3, 0.0283999, 0.75, 0.928, 0.3, 0.5284, 0.936396, 0.950347, 0.2968]) + + names.append("LShoulderPitch") + times.append( + [0.68, 1.48, 2.32, 3.28, 4.12, 5.04, 5.88, 6.84, 7.68, 8.12, 8.48, 8.8, 9.64, 10.6, 11.44, 12.36, 13.2, 14.16, + 15, 16.4]) + keys.append( + [0.97784, 1.29573, 1.40466, 1.29573, 1.40466, 1.29573, 1.40466, 1.29573, 1.40466, 0.172788, -1.04904, -1.19188, + 0.995607, -1.19188, 0.995607, -1.19188, 0.995607, -1.19188, 0.995607, 1.47106]) + + names.append("LShoulderRoll") + times.append( + [0.68, 1.48, 2.32, 3.28, 4.12, 5.04, 5.88, 6.84, 7.68, 8.48, 8.8, 9.2, 9.64, 10.12, 10.6, 11, 11.44, 11.92, + 12.36, 12.76, 13.2, 13.68, 14.16, 14.56, 15, 15.6, 16.2]) + keys.append( + [0.500047, 0.401871, 0.35585, 0.401871, 0.35585, 0.401871, 0.35585, 0.401871, 0.35585, 0.886453, 0.966481, + 1.23332, 0.324005, 1.23332, 0.966481, 1.23332, 0.324005, 1.23332, 0.966481, 1.23332, 0.324005, 1.23332, + 0.966481, 1.23332, 0.324005, 0.407503, 0.146991]) + + names.append("LWristYaw") + times.append( + [0.68, 1.04, 1.48, 2.32, 3.28, 4.12, 5.04, 5.88, 6.84, 7.68, 8.48, 8.8, 9.64, 10.6, 11.44, 12.36, 13.2, 14.16, + 15, 16.2, 16.4]) + keys.append( + [0.11961, -0.289725, -0.395814, -0.420357, -0.395814, -0.420357, -0.395814, -0.420357, -0.395814, -0.420357, + -0.122946, -0.107338, -0.400331, -0.107338, -0.400331, -0.107338, -0.400331, -0.107338, -0.400331, 0.000370312, + 0.0827939]) + + names.append("RElbowRoll") + times.append( + [0.68, 1.08, 1.52, 1.92, 2.36, 2.84, 3.32, 3.72, 4.16, 4.64, 5.08, 5.48, 5.92, 6.4, 6.88, 7.28, 7.72, 8.52, + 8.84, 9.68, 10.64, 11.48, 12.4, 13.24, 14.2, 15.04, 15.64, 16.24, 16.44]) + keys.append([1.34689, 1.1205, 0.138102, 1.309, 0.257754, 1.4591, 0.138102, 1.309, 0.257754, 1.4591, 0.138102, 1.309, + 0.257754, 1.4591, 0.138102, 1.309, 0.257754, 0.372085, 0.369652, 0.202446, 0.369652, 0.202446, + 0.369652, 0.202446, 0.369652, 0.202446, 0.82205, 0.519567, 0.429562]) + + names.append("RElbowYaw") + times.append( + [0.68, 1.08, 1.52, 1.92, 2.36, 2.84, 3.32, 3.72, 4.16, 4.64, 5.08, 5.48, 5.92, 6.4, 6.88, 7.28, 7.72, 8.52, + 8.84, 9.68, 10.64, 11.48, 12.4, 13.24, 14.2, 15.04, 15.64, 16.24, 16.44]) + keys.append([0.59515, 0.567232, -0.851412, -0.0750492, -0.00157596, -0.460767, -0.851412, -0.0750492, -0.00157596, + -0.460767, -0.851412, -0.0750492, -0.00157596, -0.460767, -0.851412, -0.0750492, -0.00157596, 0.352279, + 0.380475, 0.618244, 0.380475, 0.618244, 0.380475, 0.618244, 0.380475, 0.618244, 1.26711, 1.23132, + 1.21028]) + + names.append("RHand") + times.append( + [0.68, 1.08, 1.52, 1.92, 2.36, 2.84, 3.32, 3.72, 4.16, 4.64, 5.08, 5.48, 5.92, 6.4, 6.88, 7.28, 7.72, 8.52, + 8.84, 9.68, 10.64, 11.48, 12.4, 13.24, 14.2, 15.04, 16.24, 16.44]) + keys.append( + [0.2, 0.95, 0.928, 0.3, 0.0283999, 0.75, 0.928, 0.3, 0.0283999, 0.75, 0.928, 0.3, 0.0283999, 0.75, 0.928, 0.3, + 0.5284, 0.271478, 0.2648, 0.264, 0.2648, 0.264, 0.2648, 0.264, 0.2648, 0.264, 0.596785, 0.2976]) + + names.append("RShoulderPitch") + times.append( + [0.68, 1.52, 2.36, 3.32, 4.16, 5.08, 5.92, 6.88, 7.72, 8.52, 8.84, 9.68, 10.64, 11.48, 12.4, 13.24, 14.2, 15.04, + 16.24]) + keys.append( + [0.915841, -1.19188, 0.995607, -1.19188, 0.995607, -1.19188, 0.995607, -1.19188, 0.995607, 1.281, 1.29573, + 1.40466, 1.29573, 1.40466, 1.29573, 1.40466, 1.29573, 1.40466, 1.47268]) + + names.append("RShoulderRoll") + times.append( + [0.68, 1.08, 1.52, 1.92, 2.36, 2.84, 3.32, 3.72, 4.16, 4.64, 5.08, 5.48, 5.92, 6.4, 6.88, 7.28, 7.72, 8.52, + 8.84, 9.68, 10.64, 11.48, 12.4, 13.24, 14.2, 15.04, 15.64, 16.44]) + keys.append( + [-0.905123, -1.30837, -0.966481, -1.23332, -0.324005, -1.23332, -0.966481, -1.23332, -0.324005, -1.23332, + -0.966481, -1.23332, -0.324005, -1.23332, -0.966481, -1.23332, -0.324005, -0.397371, -0.401871, -0.35585, + -0.401871, -0.35585, -0.401871, -0.35585, -0.401871, -0.35585, -0.310669, -0.174533]) + + names.append("RWristYaw") + times.append( + [0.68, 1.52, 2.36, 3.32, 4.16, 5.08, 5.92, 6.88, 7.72, 8.52, 8.84, 9.68, 10.64, 11.48, 12.4, 13.24, 14.2, 15.04, + 16.24, 16.44]) + keys.append( + [-0.401949, 0.107338, 0.400331, 0.107338, 0.400331, 0.107338, 0.400331, 0.107338, 0.400331, 0.391888, 0.395814, + 0.420357, 0.395814, 0.420357, 0.395814, 0.420357, 0.395814, 0.420357, 0.00501826, 0.108872]) + + motion_service.angleInterpolation(names, keys, times, True) + + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument("--ip", type=str, default="192.168.137.88", + help="Robot's IP address. If on a robot or a local Naoqi - use '127.0.0.1' (this is the default value).") + parser.add_argument("--port", type=int, default=9559, + help="port number, the default value is OK in most cases") + + args = parser.parse_args() + session = qi.Session() + try: + session.connect("tcp://{}:{}".format(args.ip, args.port)) + except RuntimeError: + print("\nCan't connect to Naoqi at IP {} (port {}).\nPlease check your script's arguments." + " Run with -h option for help.\n".format(args.ip, args.port)) + sys.exit(1) + main(session) \ No newline at end of file