pygamesteering.py_.txt (4265Bytes)
For quick demonstrations/easy testing of hardware, i am trying to write a pygame interface to a skid steering robot.
I am at the point where i have a control screen with a center, and the x,y position of the cursor relative to that. I can determine whether overall it should be going straight, left, or right, forwards or backwards depending on the mouse position with the vertical axis being "overall forward motion" but i want to use the horizontal axis to determine the left/right split, with the total "forwards motion" available from the verticle axis being split left/right by how far the values of the horizontal axis are from center
I am sure this sort of thing has been done before - does anybody have some pointers?
UPDATE:
Thanks for the help everybody - i seem to have gotten it sorted - i am sure it could be prettier though.The code should be pretty obvious - i made some changes to make it easier to drive the TReX - it now checks for negative values, and sets a flag for that motor to reverse, and then flips the value to positive. this is the sort of data the trex is expecting.
It is hard to do a complete test currently due to the speed of the robot and the length of my USB cable. Next up will be IP connectivity between a pygame/wxwidgets client running on a netbook, connecting to a python server running on the robot's netbook, interfacing with the TReX motor controller and a Polou servo controller. Also, i found a simple bit of c code to allow easy reading of linux's mouse device inputs for X,Y positioning
http://jwr.d2p.com.au/robobot/