summaryrefslogtreecommitdiff
path: root/2004/n/asserv/src/motor.h
diff options
context:
space:
mode:
authorschodet2003-09-30 22:17:01 +0000
committerschodet2003-09-30 22:17:01 +0000
commitea695ca13b725b6f2037986ef26fa1fea06b8faf (patch)
tree3dbe01ef7cca286eca1ad9433599699fa8f5ea52 /2004/n/asserv/src/motor.h
parent45e9ad53c377e594e03bf14fa4c6bab5322ada64 (diff)
Initial revision
Diffstat (limited to '2004/n/asserv/src/motor.h')
-rw-r--r--2004/n/asserv/src/motor.h91
1 files changed, 91 insertions, 0 deletions
diff --git a/2004/n/asserv/src/motor.h b/2004/n/asserv/src/motor.h
new file mode 100644
index 0000000..92b1680
--- /dev/null
+++ b/2004/n/asserv/src/motor.h
@@ -0,0 +1,91 @@
+#ifndef motor_h
+#define motor_h
+/* motor.h */
+/* APBTasserv - asservissement Robot 2004 {{{
+ *
+ * Copyright (C) 2003 Nicolas Schodet
+ *
+ * Robot APB Team/Efrei 2004.
+ * Web: http://assos.efrei.fr/robot/
+ * Mail: robot AT efrei DOT fr
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * }}} */
+
+/* +AutoDec */
+
+/* Initialise le modue moteur. */
+void
+motor_init (void);
+
+/* Addition limitée à 32000. */
+signed long
+safe_add_long (signed long &a, signed long &b);
+
+/* Limite un entier entre -MAX et MAX. */
+signed long
+boundary (signed long &n, signed long &max);
+
+/* Multiplication par les coef. */
+signed long
+safe_mul_long (signed long &a, unsigned int &k);
+
+/* Met à jour la vitesse du moteur gauche. */
+void
+motor_update_left_speed (void);
+
+/* Met à jour la vitesse du moteur droit. */
+void
+motor_update_right_speed (void);
+
+/* Calcule le PID associé au moteur gauche. */
+void
+motor_compute_left_pid (void);
+
+/* Calcule le PID associé au moteur droit. */
+void
+motor_compute_right_pid (void);
+
+/* Paramètre la PWM pour le moteur gauche. */
+void
+motor_g_pwm (signed long &pwm);
+
+/* Paramètre la PWM pour le moteur droit. */
+void
+motor_d_pwm (signed long &pwm);
+
+/* Interruptions de comptage moteur. */
+#int_EXT
+EXT_isr();
+
+#int_EXT1
+EXT1_isr();
+
+/* Interruption de PID. */
+#int_TIMER2
+TIMER2_isr ();
+
+/* Traite une entrée série. */
+short
+motor_parse (void);
+
+/* Démarre l'asservissement. */
+void
+motor_toggle_asservi (short fl);
+
+/* -AutoDec */
+
+#endif /* motor_h */