robot goes haywire with the one joystick default code

Greetings,
downloaded the single joystick control program from
first robotics site. Was able to download it to the robotic
without any problem. Now the question:

When we turn on the robot, it goes a bit crazy. It will
respond to the single joystick control movemets, but
once you release the joystick and it centers, the robot still
spins around. Have tried adjusting the wheels on the
joystick, but still doesn’t behave properly. Is this a known
problem ? Ideas on how to have no movement when the
joystick is in the center position? Also ideas on tuning down
the sensitivity to joystick inputs.

thanks in advance.

Hmmm … what I would do is keep the robot tethered up, and debug some values. Assuming you call your motor outputs driveL and driveR, put something like this in the bottom of your code:


debug ? p1_x
debug ? p1_y
debug ? driveR
debug ? driveL
debug "Filler Text"
debug cls

Then, run the robot and don’t touch the joystick (keep it centered). Adjust the trim (the right and bottom wheels) until you see p1_x and p1_y are close to 127. Then Tape the trim down, so it doesn’t move. If you move the joystick, then it goes to center, and the p1_x/p1_y don’t say 127, then you’ve got a problem with your joystick. If p1_x/p1_y do say 127, but driveR/driveL don’t, then there is a problem with your code (unlikely since it is the default code). If they all say 127 but the wheels are still moving, then you’ve got a real problem! :slight_smile: (in that case, check the wiring to make sure it’s all correct, and the pwm cables go to the right number that the serout command expects).

Sorry I can’t be of more help, but I haven’t had this problem before, so I don’t know what to say.

Stephen

PS. Kind of obvious, but just in case: when you do this testing, make sure you set your robot up on some blocks so the wheels can move freely without contacting the ground.

That sounds like either the centre points are messed up in the program itself, or your joystick is not centred physically.

If neither of those are true, maybe there is something actually wrong with the joystick? Try swapping it with the other one maybe?

Also, are you sure you have all the motors/victors wierd properly to the robot controller?

I had this exact prob on the Edu-Robot. I have yet to test out the Full size sys.

make sure the PWM outputs are correct. i did this, and well, when the robot flipped out and almost broke a few legs, i went through and realized all the stuff i forgot to change :).

Use the dial on the joysticks to adjust the calibration. Make sure your PWM’s are correct. You might want to put the robot up on blocks before you do this.

Maybe this is not a programming issue at all and you just have a low battery. When the battery is low, the controller doesn’t get enough energy and weird things start happening.

To help with the joystick sensitivity, you could add some code to create a “dead-zone”.
Essentially, the robot would think the joystick is in the neutral position unless it is moved in a direction a certain amount.


'---------- Joystick Dead Zone -------------------------------------------------------------------------------
'-------------------------------------------------------------------------------------------------------------

if ((p1_y > 137) OR (p1_y < 117)) then end_p1_y_dead_zone_adj
p1_y = 127
end_p1_y_dead_zone_adj:

if ((p1_x > 137) OR (p1_x < 117)) then end_p1_x_dead_zone_adj
p1_x = 127
end_p1_x_dead_zone_adj:

Try adding that before the part that says 1 Joystick Drive. It may help a bit.