Hello everyone,
This is the RSSC blog, a place for folks to post projects that include HOW TOs, tutorials, writeups and other information about robotics projects from different people in the club.
For instance by clicking on the Add Image button on the toolbar, I can add a picture of my semi leaf platform.
Based on Alex's demonstration of Rocky today, I realized that I have been making the RC mode FAR TO DIFFICULT! I have been loading the control board up with decoding traditional RC gear, when I could have just gone through windows using a wireless controller! DOH!!!!! Even though it isn't broke, I will still fix it. Alex talked about the
cordless logitech rumble pad as a robot controller. I can link to this item by selecting some text the link button and pasting in the link. Here is a link to microsofts instructions on reading the joystick using the
directX api.
Finally, If I were to do it the easy way, I would use the pygame library and the following code:
import pygame #from pygame import joycontroller, event
pygame.init() #Initialize the pygame callbacks and engine
controller = pygame.joystick.Joystick(0) #Attach controller to the first joycontroller in the system
controller.init() #Initialize the controller
print 'Initialized Joystick : %s' % controller.get_name()
try: #Start a loop
while True:
pygame.event.pump() #Get events from the controller
for i in range(0, controller.get_numaxes()):
if controller.get_axis(i) < -0.1 or controller.get_axis(i) > 0.1: #If the controller is not in the center print where
print 'Axis %i reads %.2f' % (i, controller.get_axis(i))
for i in range(0, controller.get_numbuttons()): #Display any buttons that are pressed
if controller.get_button(i) != 0:
print 'Button %i reads %i' % (i, controller.get_button(i))
except KeyboardInterrupt: #If the initiallization failed
controller.quit() #Disconnect the controller
Now all that remains is to tie the joystick events to the PID controller that runs the bot. I can use the same serial commands that already runs the bot!