View Single Post
  #4   Spotlight this post!  
Unread 08-02-2005, 14:20
Workaphobia Workaphobia is offline
Registered User
AKA: Jon
FRC #1546 (Chaos Inc.)
Team Role: Alumni
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Long Island
Posts: 26
Workaphobia will become famous soon enough
Re: Big Giant Super Humongous Problems

Ok, if your robot turns when it should be moving straight, then the joystick might be somehow transposing the axes so that forward and backwards is read in as p1_x instead of p1_y. I'm not sure if that ever really happens though - the much more likely cause is that because of the way the motors were wired, one of them moves in the opposite direction from whichever way it's supposed to go, so that when the code thinks its moving both forward it's really turning. The solution is to go into the part of the code that maps inputs to outputs (Default_Routine in user_routines.c if you haven't changed it) and check out what's going on there.

"pwm01-04" are probably your motor outputs, "p1_y" and "p1_x" are your joystick axes. Both of them can range from 0 to 255 (ideally 254) with 127 being neutral. You can reverse the value of pwm01 by doing "pwm01 = 254 - pwm01;". Experiment with reversing the values of the outputs until both sides move forward when the joystick does.

Also be careful that you don't run two motors in opposition, if they are attached to one gear.


As for sensitivity, you can add a deadzone to the joystick so that within a certain center range it'll output no motion. Use an if() statement in your code to detect if its close to 127, and if so, set the pwms to 127.

I have no idea what would cause the robot to move when the trigger is pressed, but you can check and see if it's referred to in user_routines.c by the default code. Do a search for "p1_sw_trig".