UPDATE - September 23, 2013
Well... now we have a video!
Thanks specially to GroG (Java-Fu Master) and Alessandruino (Script-Fu Master) now this crazy little thing is running over my kitchen table! More to come!
Well guys, I'm a bit clumsy with MRL, so I'll need some help to make the things go on. I'm working on a multi task robot for about two months. As I want it to be remote controlled and autonomously, recently I felt that it would be somewhat limited using only an Arduino board, so I decided to retry the use of MRL, but as I don't have experience with python, I'll need your patience and help.
On the beginning of this project I was using only an Arduino board with a PS2 controller attached to it. Now I'm using a XBOX 360 controller attached to a PC with MRL, and I want to make the same control method that you can see on the video.
And now on python I'm trying to make the same thing: press one button plus sticks high value and it increment the position of the servo in one degree, repeat it and increment one more degree on the current position. Press one button plus sitcks low value and decrement servo position in one degree and etc...
Link to original post on LMR http://letsmakerobots.com/node/37634 .
Evolving script
[[Joystick.Servo.Mech-Dickel.py]]
Hi Mech-Drickel,Nice to see
Hi Mech-Drickel,
Nice to see you back ! :D
(CRAZY COOL AWESOME ROBOT - REALLY NICE !!!)
Now, I got to ask the obvious .. cuz I can't resist !
Did you load the latest MRLComm.ino into your Arduino ?
(Just making sure is all :)
Hi Grog
Hi GroG. I've loaded the MRLComm.ino into my Arduino. I've used the code of the Alessandruino's "Little Printed Dumb Robot" to control the hand of my robot, but only with pre-defined positions: hand open(100), wide open(150) and close(40). But what I want is the following: the program starts with a hand in rest position (100), when I press one button it increments the position in one degree (goes to 101), press again and increments one more degree (goes to 102), press other button and decrements it one degree (goes to 101) and etc....
Awsome project :D I guess the
Awsome project :D I guess the problem is hand.moveTo(b) because in your script b is a float,but the method moveTo() needs an integer : moveTo(integer).
So you can replace 2.0 with 2, and 1.0 with 1 ,or you can force b into an integer ..
Let us know...
Alessandro
Thanks Alessandruino
I still trying some things but no success. I'm very newbie with this.. Just the second day with Python/Jython... But I'll keep ahead!!!
[[Joystick.robotHand.py]]
Check your post...i edited it... now your script should be worky !!! it's in the repository now...
You are a Python Master!
This is great man, and as I said before: You are a Python Master!! :) Well below is the code with some adapt to close and open the hand. What I want now is to make some combos for, for example, when I press the RB + A buttons close the right hand. When press R B + X open right hand. When press LB + A close left hand, when press LB + X open left hand... and etc... Other thing I want is to when press the button (or buttons, depending on the case) the servo keeps increasing the steps till I release the button. The code for now:
arduino = Runtime.createAndStart("arduino","Arduino")
joystick = Runtime.createAndStart("joystick","Joystick")
handR = Runtime.createAndStart("handR","Servo")
arduino.setSerialDevice("COM3", 57600, 8, 1, 0)
sleep(4)
arduino.attach(handR.getName() , 2)
a = 90
print a
handR.moveTo(a)
handRMaxPos = 130
handRMinPos = 40
def handRopen():
global a
buttonA = msg_joystick_button0.data[0]
print buttonA
if (buttonA == 1) and (a >=handRMinPos):
a -= 2
print a
handR.moveTo(a)
elif (buttonA == 0):
print 'button not pressed'
return
def handRclose():
global a
buttonX = msg_joystick_button2.data[0]
print buttonX
if (buttonX == 1) and (a <=handRMaxPos):
a += 2
print a
handR.moveTo(a)
elif (buttonX == 0):
print 'button not pressed'
return
joystick.addListener("button0", python.name, "handRopen")
joystick.addListener("button2", python.name, "handRclose")
Oh I forgot - if stuff does
Oh I forgot - if stuff does not work - always send a NoWorky - it helps alot !
http://myrobotlab.org/content/helpful-myrobotlab-tips-and-tricks-0#noWorky
Looks like were going to BORG in a MAX chip :D
LED display YOU WILL BE ASSIMILATED !!!
http://playground.arduino.cc/Main/LedControl
http://datasheets.maximintegrated.com/en/ds/MAX7219-MAX7221.pdf
Led matrix + MAX7219: Support info
Arduino library: http://playground.arduino.cc/uploads/Main/LedControl.zip , good support info: http://tronixstuff.com/2010/07/09/review-maxim-max7219-led-display-driver-ic/ , my post of facial expressions with led matrix and MAX7219 on LMR: http://letsmakerobots.com/node/37367
NO worky combo!
joystick = runtime.createAndStart("joystick","Joystick")
sleep(4)
def a():
a = msg_joystick_button0.data[0]
print a
rb = msg_joystick_button5.data[0]
print rb
if (( a == 1) and (rb == 1)):
print 'Combo!'
elif ( a == 1):
print 'A pressed'
elif ( rb == 1):
print 'RB pressed'
else:
print 'Nothing pressed'
#create a message route from joy to python so we can listen for button
joystick.addListener("button0", python.name, "a")
joystick.addListener("button5", python.name, "a")
NO worky combo!
def combo():
if (( buttonApressed) and (buttonRBpressed)):
print 'Combo!'
else:
print 'Nothing pressed'
One more of my "dumb" codes, but I think it can help someway...
joystick = runtime.createAndStart("joystick","Joystick")
sleep(4)
a = 1
rb = 1
buttonApressed = 1
buttonRBpressed = 1
def buttonA():
global a
buttonA = msg_joystick_button0.data[0]
print buttonA
if (buttonA == 1):
a == buttonApressed
print a
elif (buttonA == 0):
a == buttonAnotpressed
print a
def buttonRB():
global rb
buttonRB = msg_joystick_button5.data[0]
print buttonRB
if (buttonRB == 1):
rb == buttonRBpressed
print rb
elif (buttonRB == 0):
rb == buttonRBnotpressed
print rb
def combo():
global buttonApressed
global buttonRBpressed
if ((buttonApressed) and (buttonRBpressed)):
print "Combo!"
elif (buttonApressed):
print "Button A pressed"
elif (buttonRBpressed):
print "Button RB pressed"
else:
print "Nothing pressed"
joystick.addListener("button0", python.name, "buttonA")
joystick.addListener("button5", python.name, "buttonRB")
edited your post...now there
edited your post...now there is a Joystick.comboButton.py script
Sphinx Issues
In the past I have seen Sphinx not work because lack of memory so I supplied a alternate myrobotlab.bat (it was renamed myrobotlab.txt and attached to the post)
I've downloaded and replaced my local myrobotlab.bat with this files and I can get the JVM to change the amount of memory it allocates.
Here is the contents of the file - and the change I put in -Xmx128m for allocating max size of 128 megs
Starting myrobotlab.bat then looking at the myrobotlab.log I can see the changes which have occured. Its not a full 128 megs because Xmx - is specifying the "maximum" size not the "initial" size, to change the initial size you could add -Xms128m