Does anyone have an idea on how to make a joystick program for an operating board?

I’m trying to come up with a program for an operating board that uses one joystick instead of two to maneuver the robot forwards, backwards, and turning as well. However, I’m fairly new at this (I just started AP programming C++ a couple months ago)… any and all help would be greatly appreciated.

InnovationFIRST has a whitepaper on this.

Avalailable at:

http://www.innovationfirst.com/FIRSTRobotics/pdfs/OneJoystickControl.pdf

necroprime:

FYI: Your sig is a bit odd. The code tags don’t actually make the code work…it does the exact opposite, in fact. It just prints out the code in a fixed font. Sorry if you wanted it that way :slight_smile:

unfortunately for our bot, equal spike input does not make equal output at the wheels. We put the 1 joystick drive on, and the bot was uncontrollable. Keep in mind this is our test bot, which is nothing but a piece of plywood with 2 pnuematic off-road scooter tires run by 2 drill motors. It goes maybe 30-40 mph. It was funny when we put the drills in 2nd and took off, only for it to abruptly do a 360, which flung the battery off and about 30 feet away

*Originally posted by f22flyboy *
**unfortunately for our bot, equal spike input does not make equal output at the wheels. We put the 1 joystick drive on, and the bot was uncontrollable. Keep in mind this is our test bot, which is nothing but a piece of plywood with 2 pnuematic off-road scooter tires run by 2 drill motors. It goes maybe 30-40 mph. It was funny when we put the drills in 2nd and took off, only for it to abruptly do a 360, which flung the battery off and about 30 feet away **

If I recall correctly, the drill motors don’t run at the same speeds, forwards and backwards. There were three in the kit, last year, two that were regular, spinning a little faster going forward, and one that was either modified or manufactured differently, which spun at the same speed as the other two did forward, in reverse. I’m not sure if this really applies to your situation (I guess I just thought it did), but I thought I’d mention it.

Again, if I recall correctly, speed controllers are called “victors”, and relays are called “spikes”.

Again, if I recall correctly, speed controllers are called “victors”, and relays are called “spikes”.

Thats correct.

One thing for you to try after u get everything figured out is to have it so your robot can drive with 1 stick or 2. I know we had this last year, and to switch it to one stick all we did was move a switch on the operators panel. Not sure how we did it, but i thought it was pretty cool.

*Originally posted by Clark Gilbert *
**One thing for you to try after u get everything figured out is to have it so your robot can drive with 1 stick or 2. I know we had this last year, and to switch it to one stick all we did was move a switch on the operators panel. Not sure how we did it, but i thought it was pretty cool. **

Some code for your viewing pleasure:

if (p3_sw_aux1=1) then twoJoystick
oneJoystick:
PWM1 = (((2000 + p1_y - p1_x + 127) Min 2000 Max 2254) - 2000)
PWM2 = (((2000 + p1_y + p1_x - 127) Min 2000 Max 2254) - 2000)
goto endDrive
twoJoysticks:
PWM1=p1_y
PWM2=p2_y
endDrive:

With this code, whenever port 3 aux1 is pressed, you will drive with two joysticks, but when it isn’t pressed, you only need one. Port 3 aux1 could be anything you want it to be, but most often it would be a switch of some sort on your “button box.”

Thanks, this really helps out… appreciate it!