summaryrefslogtreecommitdiff
path: root/n/line-follower/src/speed.c
diff options
context:
space:
mode:
Diffstat (limited to 'n/line-follower/src/speed.c')
-rw-r--r--n/line-follower/src/speed.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/n/line-follower/src/speed.c b/n/line-follower/src/speed.c
index a2f2c54..1a66486 100644
--- a/n/line-follower/src/speed.c
+++ b/n/line-follower/src/speed.c
@@ -23,6 +23,8 @@
*
* }}} */
+#include "linesensor.c"
+
/** 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) */
@@ -31,6 +33,9 @@ int16_t linefol_max_pwm = 80;
#define N_LINEPOS_DER_TAB 8 // max : 256
int16_t linepos_der_tab[N_LINEPOS_DER_TAB];
uint8_t linepos_der_index;
+/** Attenuation for filtering the derivate term */
+#define K_ATT_LINEPOS_DER 0.95
+
/** Actual speed. */
int8_t speed_left, speed_right;
/** Wanted speed. */
@@ -49,6 +54,8 @@ int16_t speed_left_e_old, speed_right_e_old;
uint16_t speed_kp = 2 * 255;
/** I coeficients. 4.8 fixed point format. */
uint16_t speed_ki = 1 * 255;
+/** D coeficient. 4.8 fixed point format. */
+uint16_t speed_kd = 1 * 255;
/* +AutoDec */