View Single Post
  #2   Spotlight this post!  
Unread 24-04-2007, 07:08
CyberWolf_22's Avatar
CyberWolf_22 CyberWolf_22 is offline
Programming and Electrical Mentor
AKA: Allen Gregory
FRC #2587 (Afrobots)
Team Role: Mentor
 
Join Date: Jan 2003
Rookie Year: 2003
Location: Houston, Texas
Posts: 227
CyberWolf_22 is just really niceCyberWolf_22 is just really niceCyberWolf_22 is just really niceCyberWolf_22 is just really nice
Re: Default code question

The basic idea is that it takes the p1_x value and adds it to p1_y for one side of the robots motors and subtracts it from p1_y for the other set of motors.
This makes it so that a single joystick can provide control of a tank steered robot.
The limit_mix function stops the values from going out of range of an ordinary PWM value of 0-254.

Take for example if the y axis is 0 and you move the x axis.
You will be adding and subtracting from zero so each set of motors PWM value will have the same magnitude away from neutral, 127, but in opposite directions so the robot will spin in place.
If you move the y axis while the x axis is non zero the robot will begin to arc because the y axis is added directly to both sides of the robot evenly.

I hope that helps.
__________________