Close

Arms - the easiest is the best

A project log for Balambér

a robotic handpuppet

borazsloborazslo 10/12/2016 at 20:420 Comments

Next step to make Balambér's arms to move. First I planned an arm with moving shoulder and elbow. I was thinking about a parallel (but crossed) mechanism. (Thank you @Radomir Dopieralski.) Finally I made a design with two axis but one servo only.

Then I realized that the more simple is the better. So I designed the arms:

So Balambér has two arms now, even though he has a chest missing:

Because of the four servos the new code a little bit more complex. Only a little bit:

import time
import pigpio
import sys
pi = pigpio.pi() 

GPIONeckHor= 24
NeckHorMin = 1100
NeckHorMid = 1500
NeckHorMax = 2100
GPIONeckVer = 27
NeckVerMin= 1900
NeckVerMid = 2200
NeckVerMax = 2300

GPIORightHand = 22
RightHandMin = 1000
RightHandMid = 1050
RightHandMax = 2000
GPIOLeftHand = 23
LeftHandMin = 1000
LeftHandMid = 2000
LeftHandMax = 2100


speed = 0.005

def shake(gpio,min,mid,max):
	for x in xrange(mid, min, -10):
		pi.set_servo_pulsewidth(gpio,x)	
	  	time.sleep(speed)
		pass
	for x in xrange(min,max,10):
		pi.set_servo_pulsewidth(gpio, x)	
	  	time.sleep(speed)
		pass
	for x in xrange(max,mid,-10):
		pi.set_servo_pulsewidth(gpio, x)	
	  	time.sleep(speed)
		pass
	pass

if len(sys.argv) > 1:
    command = sys.argv[1]
    if command == "-h" or command == "--help":
        print "Example: no, yes, right, left"
        sys.exit()
    #SET command
    elif command == "no":
        shake(GPIONeckHor,NeckHorMin,NeckHorMid,NeckHorMax)
    elif command == "yes":
        shake(GPIONeckVer,NeckVerMin,NeckVerMid,NeckVerMax)
    elif command == "right":
        shake(GPIORightHand,RightHandMin,RightHandMid,RightHandMax)
    elif command == "left":
    	pi.set_servo_pulsewidth(GPIONeckVer, NeckVerMid)	
        shake(GPIOLeftHand,LeftHandMin,LeftHandMid,LeftHandMax)
    else:
        error("Invalid command")
else:
    print "Arguments needed"

pi.set_servo_pulsewidth(GPIONeckVer, 0)
pi.set_servo_pulsewidth(GPIONeckHor, 0)
pi.set_servo_pulsewidth(GPIOLeftHand, 0)
pi.set_servo_pulsewidth(GPIORightHand, 0)

And a short video about the movement of Balambér:


Discussions