summaryrefslogtreecommitdiff
path: root/n/line-follower/src/speed.c
diff options
context:
space:
mode:
authorprot2004-12-20 15:49:47 +0000
committerprot2004-12-20 15:49:47 +0000
commit792e00386f06f5d71ae4019e4d07ee335290608e (patch)
treed107c9553bbf7295056493188d9f4ed183f35705 /n/line-follower/src/speed.c
parent767c8d28dae96ad41ab3b4dd333b4004e9b5f9ca (diff)
Added :
- specialized coefs for linefol - protocol for changing these coefs ('I') - protocol for pid components stats ('C')
Diffstat (limited to 'n/line-follower/src/speed.c')
-rw-r--r--n/line-follower/src/speed.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/n/line-follower/src/speed.c b/n/line-follower/src/speed.c
index 8eaa9ba..ea31286 100644
--- a/n/line-follower/src/speed.c
+++ b/n/line-follower/src/speed.c
@@ -29,16 +29,16 @@
extern uint8_t motor_mode;
/** Statistics about pid components. */
-extern int16_t pid_pid,pid_p,pid_i,pid_d
+int16_t pid_pid,pid_p,pid_i,pid_d;
/** Coefs for linefol mode. */
-extern uint16_t line_kp,line_ki,line_kd
+uint16_t line_kp,line_ki,line_kd;
/** Maximum value the pwm can reach (defined by the avr configuration). */
#define PWM_MAX 255
/** Maximum value for the pwm in linefol mode (controls avg speed). */
-int8_t linefol_max_pwm = 80;
-/** Attenuation for filtering the derivate term (f88). */
+uint8_t linefol_max_pwm = 80;
+/** Attenuation for filtering the derivate term. */
uint16_t K_ATT_LINEPOS_DER = 0x00FE; // ~= 95%
/** Table and index for calculating the derivate term. */
#define N_LINEPOS_DER_TAB 8 // max : 255 (8bit-addressing)
@@ -207,15 +207,11 @@ speed_compute_linefol_pwm (void)
{
speed_left = linefol_saturate (((linefol_max_pwm * PWM_MAX) >> 8) - pwm);
speed_right = linefol_saturate ((linefol_max_pwm * PWM_MAX) >> 8);
-// pwm_left = ((linefol_max_pwm * PWM_MAX) >> 8) - pwm;
-// pwm_right = ((linefol_max_pwm * PWM_MAX) >> 8);
}
else
{
speed_left = linefol_saturate ((linefol_max_pwm * PWM_MAX) >> 8);
speed_right = linefol_saturate (((linefol_max_pwm * PWM_MAX) >> 8 )+ pwm);
-// pwm_left = ((linefol_max_pwm * PWM_MAX) >> 8);
-// pwm_right = ((linefol_max_pwm * PWM_MAX) >> 8 )+ pwm;
}
}
else