summaryrefslogtreecommitdiff
path: root/digital/io/src/top_cb.c
diff options
context:
space:
mode:
Diffstat (limited to 'digital/io/src/top_cb.c')
-rw-r--r--digital/io/src/top_cb.c76
1 files changed, 9 insertions, 67 deletions
diff --git a/digital/io/src/top_cb.c b/digital/io/src/top_cb.c
index 078cc9e9..acad13a5 100644
--- a/digital/io/src/top_cb.c
+++ b/digital/io/src/top_cb.c
@@ -14,75 +14,20 @@
#include "move.h" /* move FSM */
/*
- * WAIT_JACK_OUT =jack_removed_from_bot=>
- * => CONFIGURE_ASSERV
- * the match start, start the chronometer
- * we should also initialize all the subsystems of IO (get our color, ...)
- * set the settings of the asserv board (especially the position)
- */
-fsm_branch_t
-top__WAIT_JACK_OUT__jack_removed_from_bot (void)
-{
- /* Set-up our color */
- //bot_color = switch_get_color ();
- /* Start the chronometer */
- chrono_init ();
- /* Reset the position of the bot */
- asserv_set_position (PG_X_START, PG_Y_START, PG_A_START);
- /* Tell the main loop we need to be aware when the asserv acknowledge our
- * settings command */
- //top_waiting_for_settings_ack_ = 1;
- return top_next (WAIT_JACK_OUT, jack_removed_from_bot);
-}
-
-/*
- * MOVE_BACKWARD =move_fsm_finished=>
- * => MOVE_FORWARD
- * move forward again
- */
-fsm_branch_t
-top__MOVE_BACKWARD__move_fsm_finished (void)
-{
- /* Get current position */
- asserv_position_t position;
- asserv_get_position (&position);
- /* FIXME: linear move is better? */
- move_start (position.x, position.y - 1500, 0);
- return top_next (MOVE_BACKWARD, move_fsm_finished);
-}
-
-/*
* IDLE =start=>
* => WAIT_JACK_IN
- * wait for the jack to be inserted into the bot
+ * nothing to do.
*/
fsm_branch_t
top__IDLE__start (void)
{
- //top_fsm_loop_count_ = 0;
return top_next (IDLE, start);
}
/*
- * MOVE_FORWARD =move_fsm_finished=>
- * => MOVE_BACKWARD
- * return to initial position (yep it's useless but it's for test)
- */
-fsm_branch_t
-top__MOVE_FORWARD__move_fsm_finished (void)
-{
- /* Get current position */
- asserv_position_t position;
- asserv_get_position (&position);
- /* FIXME: linear move is better? */
- move_start (position.x, position.y + 1500, 0);
- return top_next (MOVE_FORWARD, move_fsm_finished);
-}
-
-/*
* WAIT_JACK_IN =jack_inserted_into_bot=>
* => WAIT_JACK_OUT
- * wait for the jack to be removed from the bot
+ * configure the asserv board.
*/
fsm_branch_t
top__WAIT_JACK_IN__jack_inserted_into_bot (void)
@@ -91,19 +36,16 @@ top__WAIT_JACK_IN__jack_inserted_into_bot (void)
}
/*
- * CONFIGURE_ASSERV =settings_acknowledged=>
- * => MOVE_FORWARD
- * move the bot forward
+ * WAIT_JACK_OUT =jack_removed_from_bot=>
+ * => GET_PUCK_FROM_THE_GROUND
+ * the match start, start the chronometer
*/
fsm_branch_t
-top__CONFIGURE_ASSERV__settings_acknowledged (void)
+top__WAIT_JACK_OUT__jack_removed_from_bot (void)
{
- /* Get current position */
- asserv_position_t position;
- asserv_get_position (&position);
- /* FIXME: linear move is better? */
- move_start (position.x, position.y - 1500, 0);
- return top_next (CONFIGURE_ASSERV, settings_acknowledged);
+ /* Start the chronometer */
+ chrono_init ();
+ return top_next (WAIT_JACK_OUT, jack_removed_from_bot);
}