Skip to content

Commit

Permalink
Theater play "synced"
Browse files Browse the repository at this point in the history
It uses brute force timing, not actual syncing
  • Loading branch information
philiparola committed Dec 9, 2018
1 parent b35e229 commit 47c291d
Showing 1 changed file with 9 additions and 16 deletions.
25 changes: 9 additions & 16 deletions catkin_ws/src/robot_theater/src/robot_theater.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from std_msgs.msg import Float64
import time
import os
import sys
from multiprocessing import Process

def ourDelay(time_sleep):
Expand All @@ -13,7 +14,7 @@ def ourDelay(time_sleep):
def waitForCat(time_sleep):
if time_sleep is 0:
time_sleep = 5
time.sleep(time_sleep)
time.sleep(time_sleep)

def shakeHead():
print("Shake head")
Expand Down Expand Up @@ -173,16 +174,18 @@ def lowerArms():
LArmShoulderHori.publish(1.89)
LArmElbowVert.publish(1.05)
LArmElbowHori.publish(0)
NeckVert.publish(0.95)
NeckHori.publish(0)
pass

def faceAudience():
print("Face audience")
os.system("rostopic pub -1 /mobile_base/commands/velocity geometry_msgs/Twist '[0.0,0.0,0.0]' '[5.0, 5.0, 5.0]'")
os.system("rostopic pub -1 /mobile_base/commands/velocity geometry_msgs/Twist '[0.0,0.0,0.0]' '[5.0, 5.0, 5.0]' > /dev/null")
pass

def faceCat():
print("Face cat")
os.system("rostopic pub -1 /mobile_base/commands/velocity geometry_msgs/Twist '[0.0,0.0,0.0]' '[-5.0, -5.0, -5.0]'")
os.system("rostopic pub -1 /mobile_base/commands/velocity geometry_msgs/Twist '[0.0,0.0,0.0]' '[-5.0, -5.0, -5.0]' > /dev/null")
pass

def testAllGestures():
Expand All @@ -207,22 +210,12 @@ def testAllGestures():
rospy.init_node('robot_theater_einstein', anonymous=True)
rate = rospy.Rate(10) # 10hz

#testAllGestures()
'''
lowerArms()
waitForCat(13)
waitForCat(10)
waitForCat(3)
waitForCat(9)
waitForCat(8)
'''

faceAudience()
time.sleep(1)
faceCat()

'''
raiseArms() # For that initial kick; needs to be published to once before it does anything
print("were in")
faceAudience()
bothWave()
lowerArms()
Expand Down Expand Up @@ -251,7 +244,7 @@ def testAllGestures():
waitForCat(2)
raiseArms()
lowerArms()
faceAudience()
#faceAudience() Haven't faced cat yet?
ourDelay(1)
ourDelay(14)
waitForCat(5)
Expand All @@ -264,10 +257,10 @@ def testAllGestures():
ourDelay(2)
waitForCat(7)
nodHead()
sys.exit()
ourDelay(4)
waitForCat(6)
leftWave()
ourDelay(2)
waitForCat(0)
lowerArms()
'''

0 comments on commit 47c291d

Please sign in to comment.