Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a gesture interface #54

Merged
merged 15 commits into from
Oct 28, 2015
10 changes: 10 additions & 0 deletions config/waveTrajs/wave0.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<trajectory>
<configuration>
<group name="deltatime" offset="14" dof="1" interpolation=""/>
<group name="joint_velocities herb 15 17 19 20 21 22 23" offset="7" dof="7" interpolation="linear"/>
<group name="joint_values herb 15 17 19 20 21 22 23" offset="0" dof="7" interpolation="quadratic"/>
</configuration>
<data count="4">
5.03348748 -1.57569674 1.68788069 2.06769058 -1.66834313 1.536798209999999 0.2117534199999996 0 0 0 0 0 0 0 0 5.03348748 -1.57569674 1.68788069 2.06769058 -1.66834313 1.536798209999999 0.2117534199999996 0 0 0 0 0 0 0 0 5.03348748 -1.57569674 1.68788069 2.32312231 -1.66834313 1.53679821 0.2117534199999998 0 0 0 1.010805085068333 -8.786841625753019e-16 8.786841625753019e-16 8.786841625753019e-16 0.5054025425341667 5.03348748 -1.57569674 1.68788069 2.57855404 -1.66834313 1.53679821 0.21175342 0 0 0 0 0 0 0 0.5054025425341667 </data>
<description><![CDATA[{"planning_method": "RetimeTrajectory", "planner": "HauserParabolicSmoother"}]]></description>
</trajectory>
10 changes: 10 additions & 0 deletions config/waveTrajs/wave1.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<trajectory>
<configuration>
<group name="deltatime" offset="14" dof="1" interpolation=""/>
<group name="joint_velocities herb 15 17 19 20 21 22 23" offset="7" dof="7" interpolation="linear"/>
<group name="joint_values herb 15 17 19 20 21 22 23" offset="0" dof="7" interpolation="quadratic"/>
</configuration>
<data count="4">
5.03348748 -1.57569674 1.68788069 2.57855404 -1.66834313 1.53679821 0.2117534199999996 0 0 0 0 0 0 0 0 5.03348748 -1.57569674 1.68788069 2.57855404 -1.66834313 1.53679821 0.2117534199999996 0 0 0 0 0 0 0 0 5.03348748 -1.57569674 1.68788069 2.101471485 -1.66834313 1.53679821 0.2117534199999998 0 0 0 -1.38142325881679 -3.214722258480227e-16 3.214722258480227e-16 5.223923670030369e-16 0.6907116294083951 5.03348748 -1.57569674 1.68788069 1.62438893 -1.66834313 1.53679821 0.21175342 0 0 0 0 0 0 0 0.6907116294083951 </data>
<description><![CDATA[{"planning_method": "RetimeTrajectory", "planner": "HauserParabolicSmoother"}]]></description>
</trajectory>
10 changes: 10 additions & 0 deletions config/waveTrajs/wave2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<trajectory>
<configuration>
<group name="deltatime" offset="14" dof="1" interpolation=""/>
<group name="joint_velocities herb 15 17 19 20 21 22 23" offset="7" dof="7" interpolation="linear"/>
<group name="joint_values herb 15 17 19 20 21 22 23" offset="0" dof="7" interpolation="quadratic"/>
</configuration>
<data count="4">
5.03348748 -1.57569674 1.68788069 1.62438893 -1.66834313 1.536798209999999 0.21175342 0 0 0 0 0 0 0 0 5.03348748 -1.57569674 1.68788069 1.62438893 -1.66834313 1.536798209999999 0.21175342 0 0 0 0 0 0 0 0 5.03348748 -1.57569674 1.68788069 2.101471485 -1.66834313 1.536798209999999 0.21175342 0 0 0 1.38142325881679 0 9.644166775440681e-16 -4.018402823100284e-17 0.6907116294083951 5.03348748 -1.57569674 1.68788069 2.57855404 -1.66834313 1.53679821 0.21175342 0 0 0 0 0 0 0 0.6907116294083951 </data>
<description><![CDATA[{"planning_method": "RetimeTrajectory", "planner": "HauserParabolicSmoother"}]]></description>
</trajectory>
10 changes: 10 additions & 0 deletions config/waveTrajs/wave3.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<trajectory>
<configuration>
<group name="deltatime" offset="14" dof="1" interpolation=""/>
<group name="joint_velocities herb 15 17 19 20 21 22 23" offset="7" dof="7" interpolation="linear"/>
<group name="joint_values herb 15 17 19 20 21 22 23" offset="0" dof="7" interpolation="quadratic"/>
</configuration>
<data count="4">
5.03348748 -1.57569674 1.68788069 2.57855404 -1.66834313 1.53679821 0.2117534199999996 0 0 0 0 0 0 0 0 5.03348748 -1.57569674 1.68788069 2.57855404 -1.66834313 1.53679821 0.2117534199999996 0 0 0 0 0 0 0 0 5.03348748 -1.57569674 1.68788069 2.32312231 -1.66834313 1.53679821 0.2117534199999998 0 0 0 -1.010805085068333 -4.393420812876509e-16 4.393420812876509e-16 7.139308820924327e-16 0.5054025425341667 5.03348748 -1.57569674 1.68788069 2.06769058 -1.66834313 1.53679821 0.21175342 0 0 0 0 0 0 0 0.5054025425341667 </data>
<description><![CDATA[{"planning_method": "RetimeTrajectory", "planner": "HauserParabolicSmoother"}]]></description>
</trajectory>
59 changes: 59 additions & 0 deletions scripts/gesture_control.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/usr/bin/env python
import herbpy
import numpy

if __name__ == '__main__':

env, robot = herbpy.initialize()
keep_going = True

while keep_going:
print "\n\nWelcome to the gesture control:\n \
Press W to wave.\n \
Press S to say something.\n \
Press Y to nod 'yes'.\n \
Press N to nod 'no'.\n \
Press H to high five.\n \
Press P to point at an object.\n \
Press S to present an object.\n \
Press R to reset the robot.\n \
Press Q to quit.\n"
user_input = raw_input("Gesture? ")

if user_input == 'Q':
print 'Goodbye!\n'
keep_going = False
elif user_input == 'W':
print 'Waving!\n'
robot.Wave()
elif user_input == 'Y':
print 'Nodding yes!\n'
robot.Nod(word='yes')
elif user_input == 'N':
print 'Nodding no\n!'
robot.Nod(word='no')
elif user_input == 'H':
print 'High Fiving!\n'
robot.HighFive()
elif user_input == 'R':
robot.right_arm.PlanToNamedConfiguration('relaxed_home', execute=True)
robot.left_arm.PlanToNamedConfiguration('relaxed_home', execute=True)
robot.right_hand.OpenHand()
robot.left_hand.OpenHand()
elif user_input == 'S':
say_this = raw_input('What do you want HERB to say? ')
robot.Say(str(say_this))
elif user_input == 'P':
items = [x.GetName() for x in env.GetBodies()]
print "HERB can see these things:"
print items[1:] #Don't show the robot as an option
point_at = raw_input('I want to point at item number: ')
robot.Point(env.GetBodies()[int(point_at)])
elif user_input == 'S':
items = [x.GetName() for x in env.GetBodies()]
print "HERB can see these things:"
print items[1:]
point_at = raw_input('I want to point at item number: ')
robot.Point(env.GetBodies()[int(point_at)])
else:
print 'Input Not Recognized\n'
1 change: 1 addition & 0 deletions src/herbpy/action/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
from grasping import PushGrasp, Grasp
from rogue import *
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import * is evil. Could you explicitly list the functions you wish to import here?

from blocks import GrabBlock
Loading