summaryrefslogtreecommitdiff
path: root/n/line-follower/src/main.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/main.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/main.c')
-rw-r--r--n/line-follower/src/main.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/n/line-follower/src/main.c b/n/line-follower/src/main.c
index 3e7d84e..91b5a8b 100644
--- a/n/line-follower/src/main.c
+++ b/n/line-follower/src/main.c
@@ -55,7 +55,6 @@ uint8_t motor_stat_pwm, motor_stat_pwm_cpt;
/** Statistics about pid components. */
uint8_t motor_stat_pid, motor_stat_pid_cpt;
-int16_t pid_pid,pid_p,pid_i,pid_d
/** Report of timer. */
uint8_t motor_stat_timer, motor_stat_timer_cpt;
@@ -241,18 +240,14 @@ proto_callback (uint8_t cmd, uint8_t argc, proto_arg_t argv[])
linesensor_reset ();
linefol_max_pwm = argv[0];
break;
- case c ('l', 5):
+ case c ('l', 3):// set linefol general coefs : "!lmmKKKK"
motor_mode = 3;
linesensor_reset ();
linefol_max_pwm = argv[0];
- speed_kp = argv[1];
- speed_ki = argv[2];
- speed_kd = argv[3];
- K_ATT_LINEPOS_DER = argv[4];
+ K_ATT_LINEPOS_DER = argv[1] << 8 | argv[2];
break;
case c ('a', 1):
speed_acc_cpt = speed_acc = argv[0];
- break;
case c ('p', 2):
speed_kp = argv[0] << 8 | argv[1];
break;
@@ -261,6 +256,18 @@ proto_callback (uint8_t cmd, uint8_t argc, proto_arg_t argv[])
break;
case c ('d', 2):
speed_kd = argv[0] << 8 | argv[1];
+ break;break;
+ case c ('I', 6): // set lInefol pid coefs : "!Ippppiiiidddd"
+ speed_kp = argv[0] << 8 | argv[1];
+ speed_ki = argv[2] << 8 | argv[3];
+ speed_kd = argv[4] << 8 | argv[5];
+ break;
+ case c ('I', 4): // set lInefol pid coefs : "!Ippppiiiidddd"
+ speed_kp = argv[0] << 8 | argv[1];
+ speed_ki = argv[2] << 8 | argv[3];
+ break;
+ case c ('I', 2): // set lInefol pid coefs : "!Ippppiiiidddd"
+ speed_kp = argv[0] << 8 | argv[1];
break;
case c ('f', 2):
postrack_set_footing (argv[0] << 8 | argv[1]);
@@ -269,7 +276,7 @@ proto_callback (uint8_t cmd, uint8_t argc, proto_arg_t argv[])
motor_stat_speed_cpt = motor_stat_speed = argv[0];
motor_stat_pwm_cpt = motor_stat_pwm = argv[0];
break;
- case c ('C', 1):
+ case c ('C', 1): // display components of PID
motor_stat_pid_cpt = motor_stat_pid = argv[0];
break;
case c ('c', 1):
@@ -281,7 +288,7 @@ proto_callback (uint8_t cmd, uint8_t argc, proto_arg_t argv[])
case c ('T', 1):
motor_stat_postrack_cpt = motor_stat_postrack = argv[0];
break;
- case c ('P', 1):
+ case c ('P', 1): // switch PWM frequency mode
pwm_init (argv[0]);
break;
default: