From 2aff3a82387b86b390348adb63cde3fe92b041db Mon Sep 17 00:00:00 2001 From: Jérôme Jutteau Date: Tue, 31 May 2011 13:39:12 +0200 Subject: digital/io: new logistic system --- digital/io-hub/src/robospierre/logistic.h | 33 +++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'digital/io-hub/src/robospierre/logistic.h') diff --git a/digital/io-hub/src/robospierre/logistic.h b/digital/io-hub/src/robospierre/logistic.h index 05b640db..13c849a5 100644 --- a/digital/io-hub/src/robospierre/logistic.h +++ b/digital/io-hub/src/robospierre/logistic.h @@ -27,6 +27,39 @@ #include "element.h" #include "clamp.h" +/** Defines for logistic macro, see LOGISTIC_CASE. */ +/** Any element must be present (not empty). */ +#define LOG_a 0 +/** Do not care if there is an element or not. */ +#define LOG__ 1 +/** There must not be element here. */ +#define LOG_e 2 +/** Pawn to pick up. */ +#define LOG_P 4 +/** A head to pick up. */ +#define LOG_H 5 +/** Pawn who has to be present. */ +#define LOG_p 6 +/** Head who has to be present. */ +#define LOG_h 7 +/** Destination (who has to be empty). */ +#define LOG_D 8 +/* LEFT means we keep the same side, RIGHT means we put the opposed side. */ +#define LOG_DIR_LEFT 0 +#define LOG_DIR_RIGHT 1 +/** Logistic macro to test if a case correspond and to perform movement. + * We have to consider that the moving direction is on the left. + * New direction is indicated (same or opposed). + * Set ready or not. */ +#define LOGISTIC_CASE(e1, e2, \ + e3, e4, e5, \ + e6, e7, new_dir, ready) \ +{ \ + if (logistic_case (LOG_##e1, LOG_##e2, LOG_##e3, LOG_##e4, LOG_##e5, \ + LOG_##e6, LOG_##e7, LOG_DIR_##new_dir, ready, 0)) \ + return; \ +} + /** Logistic context. */ struct logistic_t { -- cgit v1.2.3