summaryrefslogtreecommitdiff
path: root/n/asserv/src
diff options
context:
space:
mode:
authorschodet2005-04-11 23:08:58 +0000
committerschodet2005-04-11 23:08:58 +0000
commit6700e44b454ba7af81521c5e5a71f75e4182ad32 (patch)
tree342ef01fe3cf54e3a3989bfc8bf70b6df960d96b /n/asserv/src
parent2cd194c92ebefa7f88c03a851854b0a8b1512413 (diff)
Ajout de commentaires sur les commandes.
Diffstat (limited to 'n/asserv/src')
-rw-r--r--n/asserv/src/main.c44
1 files changed, 35 insertions, 9 deletions
diff --git a/n/asserv/src/main.c b/n/asserv/src/main.c
index fb6b2d4..e6fb72b 100644
--- a/n/asserv/src/main.c
+++ b/n/asserv/src/main.c
@@ -189,6 +189,8 @@ proto_callback (uint8_t cmd, uint8_t size, uint8_t *args)
break;
/* Commands. */
case c ('l', 2):
+ /* Linear move.
+ * - w: distance (negative to go backward). */
motor_mode = 2;
goto_mode = 0;
goto_sign = args[0] >> 7;
@@ -198,68 +200,85 @@ proto_callback (uint8_t cmd, uint8_t size, uint8_t *args)
goto_y = postrack_y;
break;
case c ('a', 1):
+ /* Angular move.
+ * - b: absolute angle. */
motor_mode = 2;
goto_mode = 1;
goto_a = args[0];
break;
case c ('g', 8):
+ /* Go to position move.
+ * - d: f24.8, x position.
+ * - d: f24.8, y position. */
motor_mode = 2;
goto_mode = 2;
goto_x = v8_to_v32 (args[0], args[1], args[2], args[3]);
goto_y = v8_to_v32 (args[4], args[5], args[6], args[7]);
break;
case c ('f', 1):
+ /* Fuck the wall move.
+ * - b: speed. */
motor_mode = 2;
goto_mode = 10;
goto_s = args[0];
break;
case c ('s', 0):
+ /* Set zero speed (stop). */
motor_mode = 1;
speed_left_aim = 0;
speed_right_aim = 0;
break;
case c ('s', 2):
- motor_mode = 1;
- speed_left_aim = args[0];
- speed_right_aim = args[1];
- break;
- case c ('s', 3):
+ /* Set speed.
+ * - b: left speed.
+ * - b: right speed. */
motor_mode = 1;
speed_left_aim = args[0];
speed_right_aim = args[1];
break;
case c ('w', 0):
+ /* Set zero pwm. */
speed_restart ();
motor_mode = 0;
pwm_left = 0;
pwm_right = 0;
break;
case c ('w', 4):
+ /* Set pwm.
+ * - w: left pwm.
+ * - w: right pwm. */
speed_restart ();
motor_mode = 0;
pwm_left = v8_to_v16 (args[0], args[1]);
pwm_right = v8_to_v16 (args[2], args[3]);
break;
- /* Stats. */
+ /* Stats.
+ * - b: interval between stats. */
case c ('C', 1):
+ /* Counter stats. */
motor_stat_counter_cpt = motor_stat_counter = args[0];
break;
case c ('X', 1):
+ /* Position report. */
motor_stat_postrack_cpt = motor_stat_postrack = args[0];
break;
case c ('G', 1):
motor_stat_goto_debug_cpt = motor_stat_goto_debug = args[0];
break;
case c ('S', 1):
+ /* Motor control stats. */
motor_stat_speed_cpt = motor_stat_speed = args[0];
break;
case c ('W', 1):
+ /* Pwm stats. */
motor_stat_pwm_cpt = motor_stat_pwm = args[0];
break;
case c ('T', 1):
+ /* Timing stats. */
motor_stat_timer_cpt = motor_stat_timer = args[0];
break;
case c ('P', 1):
+ /* Input port stats. */
motor_print_pinc_cpt = motor_print_pinc = args[0];
break;
default:
@@ -269,18 +288,23 @@ proto_callback (uint8_t cmd, uint8_t size, uint8_t *args)
switch (c (args[0], size))
{
case c ('x', 5):
+ /* Set current x position. */
postrack_x = v8_to_v32 (args[1], args[2], args[3], args[4]);
break;
case c ('y', 5):
+ /* Set current y position. */
postrack_y = v8_to_v32 (args[1], args[2], args[3], args[4]);
break;
case c ('a', 5):
+ /* Set current angle. */
postrack_a = v8_to_v32 (args[1], args[2], args[3], args[4]);
break;
case c ('f', 3):
+ /* Set footing. */
postrack_set_footing (v8_to_v16 (args[1], args[2]));
break;
case c ('e', 5):
+ /* Set epsillon. */
goto_eps = v8_to_v32 (args[1], args[2], args[3], args[4]);
break;
case c ('p', 3):
@@ -290,25 +314,27 @@ proto_callback (uint8_t cmd, uint8_t size, uint8_t *args)
speed_ki = v8_to_v16 (args[1], args[2]);
break;
case c ('d', 3):
- speed_dead_zone = v8_to_v16 (args[1], args[2]);
+ speed_kd = v8_to_v16 (args[1], args[2]);
break;
case c ('I', 3):
speed_int_max = v8_to_v16 (args[1], args[2]);
break;
case c ('a', 2):
+ /* Set acceleration. */
speed_acc_cpt = speed_acc = args[1];
break;
case c ('m', 2):
+ /* Set maximum speed for automatic movements. */
speed_max = args[1];
break;
default:
- proto_send0 ('e');
+ proto_send0 ('?');
return;
}
}
else
{
- proto_send0 ('e');
+ proto_send0 ('?');
return;
}
break;