View Single Post
  #1   Spotlight this post!  
Unread 22-04-2008, 17:19
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Silly Programming screw ups (funny)

Quote:
Originally Posted by Water Bandit23 View Post
Code:
autonomous_mode = p2_sw_aux1;
I am NOT a programmer, so what does that mean? I really hate programming, its confusing!
It replaces the field control system's "autonomous mode" signal with the state of a switch on the operator console. This has two results. First, the robot will not run its autonomous/hybrid mode routine when the field tells it to. Second, the robot will run that routine any time the switch is activated.

This line of code was inserted into a file which contains prominent warnings that it is not to be modified. Some of us programmers know the reason for the warnings, and know that some modifications are "safe". We just fail to clean up after ourselves sometimes.

Oh! That reminds me of my silly programming mistake this year. Our prototype drivebase was built with Mecanum wheels and four independent drive motors, but we settled on a six-wheel skid steer system for the competition 'bot. I decided it was "safe" to leave the strafe function in the code, since we went with y-cables to the drive motors and would thus never be commanding the paired motors to different speeds. Because of the choice of pwm outputs, pushing the joysticks from side to side would end up making the 'bot turn in the expected direction, so I figured we'd be okay with it.

In the pit at Atlanta, after replacing a Victor, we suddenly started having extreme difficulty with the joystick centering. Everything was calibrated properly. The dashboard data told me the joystick trim was perfect. The telemetry from the robot told me both the steering and speed command values were zero, yet the Victors were buzzing and the wheels were turning slowly. After puzzling over it for a very long time, eventually I noticed that the x axis trim was not perfect. Setting it to center made everything fine again.

I immediately changed the code to ensure that the strafe command value was always zero. The speed/steer/strafe mixing is still there, however.