summaryrefslogtreecommitdiff
path: root/digital/io-hub/src
diff options
context:
space:
mode:
Diffstat (limited to 'digital/io-hub/src')
-rw-r--r--digital/io-hub/src/common/debug_draw.host.c6
-rw-r--r--digital/io-hub/src/common/debug_draw.host.h4
-rw-r--r--digital/io-hub/src/guybrush/strat.c15
3 files changed, 25 insertions, 0 deletions
diff --git a/digital/io-hub/src/common/debug_draw.host.c b/digital/io-hub/src/common/debug_draw.host.c
index ea743bad..a6b7e7ba 100644
--- a/digital/io-hub/src/common/debug_draw.host.c
+++ b/digital/io-hub/src/common/debug_draw.host.c
@@ -74,3 +74,9 @@ debug_draw_point (const vect_t *p, uint8_t color)
mex_msg_push (debug_draw_msg, "Bhhb", 'p', p->x, p->y, color);
}
+void
+debug_draw_number (const vect_t *p, int32_t number)
+{
+ mex_msg_push (debug_draw_msg, "Bhhl", 'n', p->x, p->y, number);
+}
+
diff --git a/digital/io-hub/src/common/debug_draw.host.h b/digital/io-hub/src/common/debug_draw.host.h
index fe46e80a..e9ebb738 100644
--- a/digital/io-hub/src/common/debug_draw.host.h
+++ b/digital/io-hub/src/common/debug_draw.host.h
@@ -53,6 +53,10 @@ debug_draw_segment (const vect_t *p1, const vect_t *p2, uint8_t color);
void
debug_draw_point (const vect_t *p, uint8_t color);
+/** Append a debug number. */
+void
+debug_draw_number (const vect_t *p, int32_t number);
+
#endif
#endif /* debug_draw_host_h */
diff --git a/digital/io-hub/src/guybrush/strat.c b/digital/io-hub/src/guybrush/strat.c
index 47f9c4bc..b5736687 100644
--- a/digital/io-hub/src/guybrush/strat.c
+++ b/digital/io-hub/src/guybrush/strat.c
@@ -33,6 +33,12 @@
#include "asserv.h"
#include "chrono.h"
+#define STRAT_DEBUG_DRAW 0
+
+#if STRAT_DEBUG_DRAW
+#include "debug_draw.host.h"
+#endif
+
/*
* This file implements strategic decisions.
*/
@@ -249,6 +255,9 @@ strat_decision (vect_t *pos)
*pos = strat.prepared_pos;
return strat.last_decision;
}
+#if STRAT_DEBUG_DRAW
+ debug_draw_start ();
+#endif
/* Else compute the best decision. */
uint16_t path_score[STRAT_PLACE_NB];
strat_path_score_prepare (path_score);
@@ -260,7 +269,13 @@ strat_decision (vect_t *pos)
best_score = score;
best_place = i;
}
+#if STRAT_DEBUG_DRAW
+ debug_draw_number (&strat_place[i].pos, score);
+#endif
}
+#if STRAT_DEBUG_DRAW
+ debug_draw_send ();
+#endif
if (best_score != -1)
{
*pos = strat_place[best_place].pos;