Commit from zer0 on branch b_zer0 (2008-03-31 18:51 CEST)
=================================
update position_manager and angle_distance
aversive modules/devices/robot/position_manager/position_manager.c 1.6.4.3
aversive modules/devices/robot/robot_system/angle_distance.c 1.4.4.3
==================================================================
aversive/modules/devices/robot/position_manager/position_manager.c (1.6.4.2 ->
1.6.4.3)
==================================================================
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Revision : $Id: position_manager.c,v 1.6.4.2 2007-08-19 10:39:31 zer0 Exp $
+ * Revision : $Id: position_manager.c,v 1.6.4.3 2008-03-31 16:51:27 zer0 Exp $
*
*/
@@ -109,7 +109,7 @@
*/
void position_manage(struct robot_position * pos)
{
- double x, y, a;
+ double x, y, a, r, arc_angle;
s16 x_s16, y_s16, a_s16;
struct rs_polar encoders;
struct rs_polar delta;
@@ -148,17 +148,28 @@
x = pos->pos_d.x;
y = pos->pos_d.y;
IRQ_UNLOCK(flags);
-
- a += (double) delta.angle / (pos->phys.track_cm *
pos->phys.distance_imp_per_cm/2);
+
+
+ if (delta.angle == 0) {
+ /* we go straight */
+ x = x + cos(a) * ((double) delta.distance /
(pos->phys.distance_imp_per_cm)) ;
+ y = y + sin(a) * ((double) delta.distance /
(pos->phys.distance_imp_per_cm)) ;
+ }
+ else {
+ /* r the radius of the circle arc */
+ r = (double)delta.distance * pos->phys.track_cm / (double)
delta.angle;
+ arc_angle = (double) delta.angle / (pos->phys.track_cm *
pos->phys.distance_imp_per_cm);
+
+ x += r * (-sin(a) + sin(a+arc_angle));
+ y += r * (cos(a) - cos(a+arc_angle));
+ a += arc_angle;
+ }
if(a < -M_PI)
a += (M_PI*2);
else if (a > (M_PI))
a -= (M_PI*2);
- x += cos(a) * ((double) delta.distance /
(pos->phys.distance_imp_per_cm)) ;
- y += sin(a) * ((double) delta.distance /
(pos->phys.distance_imp_per_cm)) ;
-
/* update int position */
x_s16 = (int16_t)x;
y_s16 = (int16_t)y;
============================================================
aversive/modules/devices/robot/robot_system/angle_distance.c (1.4.4.2 ->
1.4.4.3)
============================================================
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Revision : $Id: angle_distance.c,v 1.4.4.2 2007-06-17 21:23:41 zer0 Exp $
+ * Revision : $Id: angle_distance.c,v 1.4.4.3 2008-03-31 16:51:27 zer0 Exp $
*
*/
@@ -27,8 +27,8 @@
*/
void rs_get_polar_from_wheels(struct rs_polar * p_dst, struct rs_wheels *
w_src)
{
- p_dst->distance = w_src->right + w_src->left;
- p_dst->angle = w_src->right - w_src->left;
+ p_dst->distance = (w_src->right + w_src->left) / 2;
+ p_dst->angle = (w_src->right - w_src->left) / 2;
}
/**
@@ -36,7 +36,7 @@
*/
void rs_get_wheels_from_polar(struct rs_wheels * w_dst, struct rs_polar *
p_src)
{
- w_dst->left = (p_src->distance - p_src->angle) / 2;
- w_dst->right = (p_src->distance + p_src->angle) / 2;
+ w_dst->left = p_src->distance - p_src->angle;
+ w_dst->right = p_src->distance + p_src->angle;
}
Commit from zer0 (2008-03-31 18:51 CEST)
================
update coefs after position_manager modification
aversive_projects microb2008/main/main.h 1.15
========================================
aversive_projects/microb2008/main/main.h (1.14 -> 1.15)
========================================
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Revision : $Id: main.h,v 1.14 2008-03-30 22:02:53 zer0 Exp $
+ * Revision : $Id: main.h,v 1.15 2008-03-31 16:51:47 zer0 Exp $
*
*/
@@ -42,11 +42,11 @@
#define EXT_TRACK_CM 29.9
#define VIRTUAL_TRACK_CM EXT_TRACK_CM
-/* it should be a 2000 imps ; huh ?
+/* it is a 2000 imps -> 8000 because we see 1/4 period
* and diameter: 40.5mm -> perimeter 127.23mm
- * 16000/12.723 -> 1257.565 */
+ * 8000/12.723 -> 628.78 */
/* increase it to go further */
-#define DIST_IMP_CM 1270.0
+#define DIST_IMP_CM 635.0
#define LEFT_ENCODER_MOT ((void *)1)
#define RIGHT_ENCODER_MOT ((void *)0)
Commit from zer0 on branch b_zer0 (2008-04-01 00:16 CEST)
=================================
fix comment
aversive modules/devices/robot/trajectory_manager/trajectory_manager.c
1.4.4.9
aversive modules/devices/robot/trajectory_manager/trajectory_manager.h
1.4.4.7
======================================================================
aversive/modules/devices/robot/trajectory_manager/trajectory_manager.c
(1.4.4.8 -> 1.4.4.9)
======================================================================
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Revision : $Id: trajectory_manager.c,v 1.4.4.8 2008-03-27 19:22:19 zer0
Exp $
+ * Revision : $Id: trajectory_manager.c,v 1.4.4.9 2008-03-31 22:16:50 zer0
Exp $
*
*/
======================================================================
aversive/modules/devices/robot/trajectory_manager/trajectory_manager.h
(1.4.4.6 -> 1.4.4.7)
======================================================================
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Revision : $Id: trajectory_manager.h,v 1.4.4.6 2008-03-27 19:22:19 zer0
Exp $
+ * Revision : $Id: trajectory_manager.h,v 1.4.4.7 2008-03-31 22:16:50 zer0
Exp $
*
*/
@@ -130,7 +130,7 @@
/** update angle consign without changing distance consign */
void trajectory_only_a_rel(struct trajectory * traj, double a_deg);
-/** turn by 'a' degrees */
+/** turn by 'a' degrees and go by 'd' cm */
void trajectory_d_a_rel(struct trajectory * traj, double d_cm, double a_deg);
/* commands using events */
Commit from zer0 (2008-04-01 00:22 CEST)
================
- Add command for camera (dump and init)
- Display position and time during strat
- traj interruption by user
aversive_projects microb2008/main/action.c 1.5
aversive_projects microb2008/main/action.h 1.3
aversive_projects microb2008/main/cam.c 1.4
aversive_projects microb2008/main/cam.h 1.3
aversive_projects microb2008/main/commands.c 1.18
aversive_projects microb2008/main/eeprom.c 1.2
aversive_projects microb2008/main/eeprom.h 1.2
aversive_projects microb2008/main/encoders_microb_config.h 1.3
aversive_projects microb2008/main/error_config.h 1.2
aversive_projects microb2008/main/i2c_config.h 1.2
aversive_projects microb2008/main/i2c_protocol.c 1.14
aversive_projects microb2008/main/i2c_protocol.h 1.10
aversive_projects microb2008/main/main.c 1.26
aversive_projects microb2008/main/main.h 1.16
aversive_projects microb2008/main/pwm_config.h 1.5
aversive_projects microb2008/main/scheduler_config.h 1.4
aversive_projects microb2008/main/sensor.c 1.4
aversive_projects microb2008/main/sensor.h 1.3
aversive_projects microb2008/main/strat.c 1.8
aversive_projects microb2008/main/strat.h 1.5
aversive_projects microb2008/main/strat_base.c 1.10
aversive_projects microb2008/main/strat_base.h 1.8
aversive_projects microb2008/main/time_config.h 1.3
aversive_projects microb2008/main/timer_config.h 1.2
aversive_projects microb2008/main/uart_config.h 1.5
==========================================
aversive_projects/microb2008/main/action.c (1.4 -> 1.5)
==========================================
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Revision : $Id: action.c,v 1.4 2008-03-24 17:59:46 zer0 Exp $
+ * Revision : $Id: action.c,v 1.5 2008-03-31 22:22:52 zer0 Exp $
*
*/
==========================================
aversive_projects/microb2008/main/action.h (1.2 -> 1.3)
==========================================
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Revision : $Id: action.h,v 1.2 2007-12-31 16:23:48 zer0 Exp $
+ * Revision : $Id: action.h,v 1.3 2008-03-31 22:22:52 zer0 Exp $
*
*/
=======================================
aversive_projects/microb2008/main/cam.c (1.3 -> 1.4)
=======================================
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Revision : $Id: cam.c,v 1.3 2008-03-24 17:59:46 zer0 Exp $
+ * Revision : $Id: cam.c,v 1.4 2008-03-31 22:22:52 zer0 Exp $
*
*/
#include <avr/pgmspace.h>
@@ -125,7 +125,7 @@
if (! wait_cond_or_timeout(cam_state == CAM_READY, CAM_TIMEOUT))
goto err;
- return 0;
+ return cam_nb_balls;
err:
if (!cam_is_ok()) {
=======================================
aversive_projects/microb2008/main/cam.h (1.2 -> 1.3)
=======================================
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Revision : $Id: cam.h,v 1.2 2008-03-24 17:59:46 zer0 Exp $
+ * Revision : $Id: cam.h,v 1.3 2008-03-31 22:22:52 zer0 Exp $
*
*/
@@ -26,7 +26,7 @@
struct cam_ball {
#define CAM_COLOR_BLUE 1 /* set if the ball color is blue */
#define CAM_COLOR_RED 2 /* set if the ball color is red */
-#define CAM_WHITE_BALL 4 /* set if the ball color is white */
+#define CAM_COLOR_WHITE 4 /* set if the ball color is white */
#define CAM_END_FRAME 128 /* set if there is no more ball in the frame */
uint8_t flags;
============================================
aversive_projects/microb2008/main/commands.c (1.17 -> 1.18)
============================================
@@ -21,7 +21,7 @@
#include "main.h"
#include "i2c_protocol.h"
#include "eeprom.h"
-//#include "test.h"
+#include "cam.h"
#include "sensor.h"
#include "../common/i2c_commands.h"
#include "strat_base.h"
@@ -1582,6 +1582,68 @@
};
/**********************************************************/
+/* Cam */
+
+/* this structure is filled when cmd_cam is parsed successfully */
+struct cmd_cam_result {
+ fixed_string_t arg0;
+ fixed_string_t type;
+};
+
+/* function called when cmd_cam is parsed successfully */
+static void cmd_cam_parsed(void * parsed_result, void * data)
+{
+ struct cmd_cam_result *res = parsed_result;
+ int8_t n, i;
+
+ if (!strcmp_P(res->type, PSTR("init"))) {
+ cam_init();
+ }
+
+ /* else it's a "dump" or a "harvest" */
+ n = cam_get_balls();
+ for (i=0 ; i<n; i++) {
+ if (cam_ball_tab[i].flags == CAM_COLOR_BLUE)
+ printf_P(PSTR("blue "));
+ else if (cam_ball_tab[i].flags == CAM_COLOR_RED)
+ printf_P(PSTR("red "));
+ else if (cam_ball_tab[i].flags == CAM_COLOR_WHITE)
+ printf_P(PSTR("white "));
+ else
+ printf_P(PSTR("? "));
+ printf_P(PSTR("%d cm, %d deg\r\n"),
+ cam_ball_tab[i].distance,
+ cam_ball_tab[i].angle);
+ }
+ if (!strcmp_P(res->type, PSTR("harvest"))) {
+ if (n) {
+ trajectory_goto_d_a_rel(&robot.traj,
+ cam_ball_tab[i].distance,
+ cam_ball_tab[i].angle);
+ wait_traj_end(0xFF);
+ trajectory_stop(&robot.traj);
+ }
+ }
+}
+
+prog_char str_cam_arg0[] = "cam";
+parse_pgm_token_string_t cmd_cam_arg0 = TOKEN_STRING_INITIALIZER(struct
cmd_cam_result, arg0, str_cam_arg0);
+prog_char str_cam_type[] = "init#dump";
+parse_pgm_token_string_t cmd_cam_type = TOKEN_STRING_INITIALIZER(struct
cmd_cam_result, type, str_cam_type);
+
+prog_char help_cam[] = "Cam the robot";
+parse_pgm_inst_t cmd_cam = {
+ .f = cmd_cam_parsed, /* function to call */
+ .data = NULL, /* 2nd arg of func */
+ .help_str = help_cam,
+ .tokens = { /* token list, NULL terminated */
+ (prog_void *)&cmd_cam_arg0,
+ (prog_void *)&cmd_cam_type,
+ NULL,
+ },
+};
+
+/**********************************************************/
/* Substrat */
/* this structure is filled when cmd_substrat is parsed successfully */
@@ -2478,6 +2540,7 @@
(parse_pgm_inst_t *)&cmd_log_type,
(parse_pgm_inst_t *)&cmd_debug,
(parse_pgm_inst_t *)&cmd_start,
+ (parse_pgm_inst_t *)&cmd_cam,
(parse_pgm_inst_t *)&cmd_consign,
(parse_pgm_inst_t *)&cmd_consign_all,
(parse_pgm_inst_t *)&cmd_goto1,
==========================================
aversive_projects/microb2008/main/eeprom.c (1.1 -> 1.2)
==========================================
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Revision : $Id: eeprom.c,v 1.1 2007-12-04 09:38:52 zer0 Exp $
+ * Revision : $Id: eeprom.c,v 1.2 2008-03-31 22:22:52 zer0 Exp $
*
*/
==========================================
aversive_projects/microb2008/main/eeprom.h (1.1 -> 1.2)
==========================================
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Revision : $Id: eeprom.h,v 1.1 2007-12-04 09:38:52 zer0 Exp $
+ * Revision : $Id: eeprom.h,v 1.2 2008-03-31 22:22:52 zer0 Exp $
*
*/
==========================================================
aversive_projects/microb2008/main/encoders_microb_config.h (1.2 -> 1.3)
==========================================================
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Revision : $Id: encoders_microb_config.h,v 1.2 2008-03-24 17:59:46 zer0
Exp $
+ * Revision : $Id: encoders_microb_config.h,v 1.3 2008-03-31 22:22:52 zer0
Exp $
*
*/
#ifndef _ENCODERS_MICROB_CONFIG_H_
================================================
aversive_projects/microb2008/main/error_config.h (1.1 -> 1.2)
================================================
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Revision : $Id: error_config.h,v 1.1 2007-06-28 22:13:04 zer0 Exp $
+ * Revision : $Id: error_config.h,v 1.2 2008-03-31 22:22:52 zer0 Exp $
*
*/
==============================================
aversive_projects/microb2008/main/i2c_config.h (1.1 -> 1.2)
==============================================
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Revision : $Id: i2c_config.h,v 1.1 2007-06-28 22:13:04 zer0 Exp $
+ * Revision : $Id: i2c_config.h,v 1.2 2008-03-31 22:22:52 zer0 Exp $
*
*/
================================================
aversive_projects/microb2008/main/i2c_protocol.c (1.13 -> 1.14)
================================================
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Revision : $Id: i2c_protocol.c,v 1.13 2008-03-24 23:29:13 zer0 Exp $
+ * Revision : $Id: i2c_protocol.c,v 1.14 2008-03-31 22:22:52 zer0 Exp $
*
*/
================================================
aversive_projects/microb2008/main/i2c_protocol.h (1.9 -> 1.10)
================================================
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Revision : $Id: i2c_protocol.h,v 1.9 2008-03-24 23:29:13 zer0 Exp $
+ * Revision : $Id: i2c_protocol.h,v 1.10 2008-03-31 22:22:52 zer0 Exp $
*
*/
========================================
aversive_projects/microb2008/main/main.c (1.25 -> 1.26)
========================================
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Revision : $Id: main.c,v 1.25 2008-03-30 22:02:53 zer0 Exp $
+ * Revision : $Id: main.c,v 1.26 2008-03-31 22:22:52 zer0 Exp $
*
*/
@@ -87,7 +87,7 @@
/* called every 5 ms */
void do_cs(void * dummy)
{
- static uint8_t cpt = 0;
+ static uint16_t cpt = 0;
/* used for cs debugging */
static uint32_t debug_cs_cpt = 0;
@@ -150,6 +150,13 @@
robot.pwm_r);
}
+ if (cpt % 512 == 0) {
+ DEBUG(E_USER_STRAT, "time %d, position=%d,%d,%d",
+ position_get_x_s16(&robot.pos),
+ position_get_y_s16(&robot.pos),
+ position_get_a_deg_s16(&robot.pos));
+ }
+
#if 0
if(robot.cs_events & DO_TIMER) {
uint8_t second;
@@ -227,6 +234,8 @@
static void emergency(char c) {
static uint8_t i = 0;
+ /* interrupt traj here XXX */
+
if( (i == 0 && c == 'p') ||
(i == 1 && c == 'o') ||
(i == 2 && c == 'p') )
@@ -404,6 +413,7 @@
100000L / SCHEDULER_UNIT,
LED_PRIO);
/* I2C */
+ wait_ms(50);
i2c_protocol_init();
i2c_init(I2C_MODE_MASTER, I2C_MAIN_ADDR);
i2c_register_recv_event(i2c_recvevent);
@@ -439,7 +449,7 @@
/* CS DISTANCE */
pid_init(&robot.pid_d);
pid_set_gains(&robot.pid_d, 400, 5, 11000);
- pid_set_maximums(&robot.pid_d, 0, 50000, 4095);
+ pid_set_maximums(&robot.pid_d, 0, 50000, 0);
pid_set_out_shift(&robot.pid_d, 6);
pid_set_derivate_filter(&robot.pid_d, 6);
@@ -457,7 +467,7 @@
/* CS ANGLE */
pid_init(&robot.pid_a);
pid_set_gains(&robot.pid_a, 500, 5, 7000);
- pid_set_maximums(&robot.pid_a, 0, 100000, 4095);
+ pid_set_maximums(&robot.pid_a, 0, 100000, 0);
pid_set_out_shift(&robot.pid_a, 6);
pid_set_derivate_filter(&robot.pid_a, 6);
========================================
aversive_projects/microb2008/main/main.h (1.15 -> 1.16)
========================================
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Revision : $Id: main.h,v 1.15 2008-03-31 16:51:47 zer0 Exp $
+ * Revision : $Id: main.h,v 1.16 2008-03-31 22:22:52 zer0 Exp $
*
*/
==============================================
aversive_projects/microb2008/main/pwm_config.h (1.4 -> 1.5)
==============================================
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Revision : $Id: pwm_config.h,v 1.4 2008-03-24 17:59:46 zer0 Exp $
+ * Revision : $Id: pwm_config.h,v 1.5 2008-03-31 22:22:52 zer0 Exp $
*
*/
====================================================
aversive_projects/microb2008/main/scheduler_config.h (1.3 -> 1.4)
====================================================
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Revision : $Id: scheduler_config.h,v 1.3 2007-12-04 09:38:52 zer0 Exp $
+ * Revision : $Id: scheduler_config.h,v 1.4 2008-03-31 22:22:52 zer0 Exp $
*
*/
==========================================
aversive_projects/microb2008/main/sensor.c (1.3 -> 1.4)
==========================================
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Revision : $Id: sensor.c,v 1.3 2008-01-05 22:47:12 zer0 Exp $
+ * Revision : $Id: sensor.c,v 1.4 2008-03-31 22:22:52 zer0 Exp $
*
*/
==========================================
aversive_projects/microb2008/main/sensor.h (1.2 -> 1.3)
==========================================
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Revision : $Id: sensor.h,v 1.2 2008-01-05 22:47:12 zer0 Exp $
+ * Revision : $Id: sensor.h,v 1.3 2008-03-31 22:22:52 zer0 Exp $
*
*/
=========================================
aversive_projects/microb2008/main/strat.c (1.7 -> 1.8)
=========================================
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Revision : $Id: strat.c,v 1.7 2008-03-30 22:02:53 zer0 Exp $
+ * Revision : $Id: strat.c,v 1.8 2008-03-31 22:22:52 zer0 Exp $
*
*/
=========================================
aversive_projects/microb2008/main/strat.h (1.4 -> 1.5)
=========================================
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Revision : $Id: strat.h,v 1.4 2008-03-30 22:02:53 zer0 Exp $
+ * Revision : $Id: strat.h,v 1.5 2008-03-31 22:22:52 zer0 Exp $
*
*/
==============================================
aversive_projects/microb2008/main/strat_base.c (1.9 -> 1.10)
==============================================
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Revision : $Id: strat_base.c,v 1.9 2008-03-30 22:02:53 zer0 Exp $
+ * Revision : $Id: strat_base.c,v 1.10 2008-03-31 22:22:52 zer0 Exp $
*
*/
#include <stdio.h>
@@ -36,6 +36,8 @@
#include "main.h"
#include "../common/i2c_commands.h"
+static uint8_t traj_intr=0;
+
/* Strings that match the end traj cause */
/* /!\ keep it sync with stat_base.h */
const char * err_tab []= {
@@ -357,9 +359,18 @@
strat_uninit();
}
+void interrupt_traj(void)
+{
+ traj_intr = 1;
+}
uint8_t test_traj_end(uint8_t why)
{
+ if ((why & END_INTR) && traj_intr) {
+ traj_intr = 0;
+ return END_INTR;
+ }
+
if ((why & END_TRAJ) && trajectory_finished(&robot.traj))
return END_TRAJ;
==============================================
aversive_projects/microb2008/main/strat_base.h (1.7 -> 1.8)
==============================================
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Revision : $Id: strat_base.h,v 1.7 2008-03-30 22:02:53 zer0 Exp $
+ * Revision : $Id: strat_base.h,v 1.8 2008-03-31 22:22:52 zer0 Exp $
*
*/
@@ -30,6 +30,7 @@
#define END_NEAR 4 /* we are near destination */
#define END_OBSTACLE 8 /* There is an obstacle in front of us */
#define END_ERROR 16 /* Cannot do the command */
+#define END_INTR 128 /* interrupted by user */
#define BLUE I2C_EXTENSION_COLOR_BLUE
#define RED I2C_EXTENSION_COLOR_RED
@@ -64,6 +65,7 @@
uint8_t get_opponent_color(void);
void start(void);
+void interrupt_traj(void);
uint8_t test_traj_end(uint8_t why);
uint8_t wait_traj_end(uint8_t why);
===============================================
aversive_projects/microb2008/main/time_config.h (1.2 -> 1.3)
===============================================
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Revision : $Id: time_config.h,v 1.2 2007-12-04 09:38:52 zer0 Exp $
+ * Revision : $Id: time_config.h,v 1.3 2008-03-31 22:22:52 zer0 Exp $
*
*/
================================================
aversive_projects/microb2008/main/timer_config.h (1.1 -> 1.2)
================================================
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Revision : $Id: timer_config.h,v 1.1 2007-06-28 22:13:04 zer0 Exp $
+ * Revision : $Id: timer_config.h,v 1.2 2008-03-31 22:22:52 zer0 Exp $
*
*/
===============================================
aversive_projects/microb2008/main/uart_config.h (1.4 -> 1.5)
===============================================
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Revision : $Id: uart_config.h,v 1.4 2008-03-02 17:17:19 zer0 Exp $
+ * Revision : $Id: uart_config.h,v 1.5 2008-03-31 22:22:52 zer0 Exp $
*
*/
_______________________________________________
Avr-list mailing list
[email protected]
CVSWEB : http://cvsweb.droids-corp.org/cgi-bin/viewcvs.cgi/aversive
WIKI : http://wiki.droids-corp.org/index.php/Aversive
DOXYGEN : http://zer0.droids-corp.org/doxygen_aversive/html/
BUGZILLA : http://bugzilla.droids-corp.org
COMMIT LOGS : http://zer0.droids-corp.org/aversive_commitlog