View Single Post
  #10   Spotlight this post!  
Unread 04-01-2006, 01:53
jaustin jaustin is offline
Registered User
AKA: Jeff Austin
FRC #2930 (The Taterbotz)
Team Role: Mentor
 
Join Date: Dec 2004
Rookie Year: 2005
Location: Snohomish, WA
Posts: 33
jaustin is an unknown quantity at this point
Re: EDU Mini Controller & 2005 Nav Code

Hi Guys,
I hope we are not "debugging the debug code" again, but here is the latest situation:

We are trying to modify Kevin's Nav Code (pid.c specifically) to allow a third motor (arm shoulder joint) to be pid controlled using a potentiometer for the feedback device. We have the adc stuff all worked so we are correctly reading the pot and the command.h and robot.c have been modified to include the commands and code for a third motor. But we are currently stuck at the point where robot.c calls the set_pos() function so that pid.c knows where to go. Robot.c is passing the correct motor number and command position to the set_pos function, but when set_pos() function goes to load it into the motor_info structure, the value changes. This change only occurs when we run a command for the third motor. When we use a CMD_DRIVE for example, pos and pos_cmd are always the same value but when we use our CMD_SHOULDER, pos = 760 (correct value) and pos_cmd = 25637.

Kevin's Code from pid.c:
void set_pos(int motor, long int pos) // pos = encoder counts or pot input)
// 256 = 1 rev
{
motor_info[motor].pid_mode = PID_POS;
motor_info[motor].pos_cmd = pos;
pid_time = 1; // Start over
}

Printing the output looks like this:
motor = 3 This is correct
pos = 760 This is correct
pos_cmd = 25637 Not sure what this is
pos_cmd & pos should be the same value

Any ideas?