Sign in to our website and become an InMoov member. It will allow you to post message, pictures, and share with others InMoov builders. It's just one click away!
Username or Email Address
Password
Remember Me
Jan posted an update 9 years, 1 month ago
Hi,
Again a few weeks ago my son Wouter and I demonstrated our first attempt to drive out robot around on an OxBoard. In the mean time we’ve optimised some parts and changed the script so both servo’s are now controlled with one joystick (the left one). Script: import time
############################ # declare variables ############################ rightPort = “COM3” joystickId = 8
# declare array with values for Left servo arrayL = [[0 for x in range(10)] for x in range(10)] arrayL[0]=[ 0, 0, 77, 77, 77, 77, 81, 85, 0, 0] arrayL[1]=[ 0, 87, 85, 83, 81, 81, 81, 81, 81, 0] arrayL[2]=[ 97, 93, 90, 87, 85, 85, 83, 81, 79, 77] arrayL[3]=[101, 97, 93, 90, 88, 88, 86, 83, 80, 77] arrayL[4]=[105,101, 97, 94, 91, 91, 88, 85, 81, 77] arrayL[5]=[105,101, 97, 94, 91, 91, 88, 85, 81, 77] arrayL[6]=[105,102, 99, 96, 94, 94, 91, 89, 85, 81] arrayL[7]=[105,103,101, 99, 97, 97, 94, 91, 88, 85] arrayL[8]=[ 0,103,102,101,101,101, 98, 95, 91, 0] arrayL[9]=[ 0, 0,105,105,105,105,101, 97, 0, 0]
# declare array with values for Right servo arrayR = [[0 for x in range(10)] for x in range(10)] arrayR[0]=[ 0, 0, 80, 78, 75, 75, 75, 75, 0, 0] arrayR[1]=[ 0, 77, 77, 78, 78, 78, 81, 84, 88, 0] arrayR[2]=[ 75, 77, 78, 79, 80, 80, 83, 85, 87, 90] arrayR[3]=[ 75, 77, 79, 81, 82, 82, 84, 87, 90, 93] arrayR[4]=[ 75, 78, 80, 82, 84, 84, 87, 90, 93, 97] arrayR[5]=[ 75, 78, 80, 82, 84, 84, 87, 90, 93, 97] arrayR[6]=[ 78, 81, 83, 85, 87, 87, 89, 91, 94, 97] arrayR[7]=[ 80, 83, 86, 88, 90, 90, 91, 93, 95, 97] arrayR[8]=[ 0, 85, 87, 90, 93, 93, 94, 95, 96, 0] arrayR[9]=[ 0, 0, 90, 93, 97, 97, 97, 97, 0, 0]
# declare global variables oldX = 0 oldY = 0
############################ # Start the InMoov Service ############################ i01 = Runtime.createAndStart(“i01”, “InMoov”)
############################ # Start and initialize Torso ############################ torso = i01.startTorso(rightPort)
# tweaking the torso settings torso.midStom.setMinMax(77,105) torso.lowStom.setMinMax(75,97) torso.midStom.setRest(91) torso.lowStom.setRest(84) i01.moveTorso(90,torso.midStom.min,torso.lowStom.max) sleep(1) i01.moveTorso(90,torso.midStom.max,torso.lowStom.min) sleep(1) i01.moveTorso(90,93,86)
############################ # Start the Joystick service ############################ uberjoy = Runtime.createAndStart(“uberjoy”, “Joystick”) uberjoy.setController(joystickId) uberjoy.startPolling()
############################ # control functions ############################ def StickXListener(value): intValue = int(value) positonChanged(intValue, oldY)
def StickYListener(value): intValue = int(value) positonChanged(oldX, intValue)
def positonChanged(Xvalue, Yvalue): global oldX global oldY if ((Xvalue oldX) or (Yvalue oldY)) and (arrayL[Yvalue][Xvalue] > 0) and (arrayR[Yvalue][Xvalue] > 0): print “Xvalue:” + str(Xvalue) + ” Yvalue: ” + str(Yvalue) print “Move servo left to:” + str(arrayL[Yvalue][Xvalue]) + ” and servo right to:” + str(arrayR[Yvalue][Xvalue]) i01.moveTorso(90,arrayL[Yvalue][Xvalue],arrayR[Yvalue][Xvalue]) oldX = Xvalue oldY = Yvalue
######################################################## # Left Arm Control (left joystick for lowStom and midStom) ######################################################## uberjoy.map(“x”, -1, 1, 0, 9) uberjoy.map(“y”, -1, 1, 0, 9)
uberjoy.addListener(“publishX”, “python”, “StickXListener”) uberjoy.addListener(“publishY”, “python”, “StickYListener”)
See the result in the short video below. Driving around is still limited because of the usb-cable to the computer. So our next goal is to attach a dedicated PC or tablet to make it “stand-alone”. We also want to experiment with a gyroscope and perhaps some distance sensors connected to the feet-servo’s.
Best Regards, Wouter and Jan Janson
Awesome!!! This is getting serious! I have sent you an email with the part you need for the hips! I think it’s great to see how the feet are moving up and down using the same servo system than form the arm pistons. I think you will need more than one accelerometer to counter act as body equilibrium. Awesome video!