From 5e4f6921f117d650025fee172af7bf4e68b69129 Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Mon, 30 May 2011 11:45:09 +0200 Subject: digital/io-hub, host/simu: add Strat contact --- digital/io-hub/src/robospierre/contact_defs.h | 8 +++++--- digital/io-hub/src/robospierre/pawn_sensor.c | 2 +- digital/io-hub/tools/io_hub/mex.py | 2 +- host/simu/robots/robospierre/model/bag.py | 3 ++- host/simu/robots/robospierre/view/bag.py | 2 ++ 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/digital/io-hub/src/robospierre/contact_defs.h b/digital/io-hub/src/robospierre/contact_defs.h index 1e04f6bf..8c60342a 100644 --- a/digital/io-hub/src/robospierre/contact_defs.h +++ b/digital/io-hub/src/robospierre/contact_defs.h @@ -25,8 +25,9 @@ * * }}} */ -#define CONTACT_COLOR A, 7 -#define CONTACT_JACK F, 7 +#define CONTACT_COLOR E, 5 +#define CONTACT_JACK E, 6 +#define CONTACT_STRAT E, 5 #define CONTACT_FRONT_BOTTOM A, 4 #define CONTACT_FRONT_MIDDLE F, 4 #define CONTACT_BACK_BOTTOM A, 5 @@ -42,6 +43,7 @@ CONTACT (CONTACT_BACK_BOTTOM) \ CONTACT (CONTACT_BACK_MIDDLE) \ CONTACT (CONTACT_BACK_TOP) \ - CONTACT (CONTACT_SIDE) + CONTACT (CONTACT_SIDE) \ + CONTACT (CONTACT_STRAT) #endif /* contact_defs_h */ diff --git a/digital/io-hub/src/robospierre/pawn_sensor.c b/digital/io-hub/src/robospierre/pawn_sensor.c index 65f0afe4..3a59e908 100644 --- a/digital/io-hub/src/robospierre/pawn_sensor.c +++ b/digital/io-hub/src/robospierre/pawn_sensor.c @@ -52,7 +52,7 @@ struct pawn_sensor_t pawn_sensor_front, pawn_sensor_back; static uint8_t pawn_sensor_get_type (uint8_t direction) { - uint8_t element_type = contact_get_color () ? ELEMENT_PAWN : ELEMENT_KING; + uint8_t element_type = IO_GET (CONTACT_STRAT) ? ELEMENT_PAWN : ELEMENT_KING; return element_type; } diff --git a/digital/io-hub/tools/io_hub/mex.py b/digital/io-hub/tools/io_hub/mex.py index 44c41010..66060ea1 100644 --- a/digital/io-hub/tools/io_hub/mex.py +++ b/digital/io-hub/tools/io_hub/mex.py @@ -31,7 +31,7 @@ ADC_NB = 8 PWM_NB = 6 PWM_VALUE_MAX = 1024 -CONTACT_NB = 9 +CONTACT_NB = 10 CONTACT_INIT = 0xffffffff class Mex: diff --git a/host/simu/robots/robospierre/model/bag.py b/host/simu/robots/robospierre/model/bag.py index 260960f8..b98dafd9 100644 --- a/host/simu/robots/robospierre/model/bag.py +++ b/host/simu/robots/robospierre/model/bag.py @@ -34,8 +34,9 @@ class Bag: def __init__ (self, scheduler, table, link_bag): self.color_switch = Switch (link_bag.io_hub.contact[0], invert = True) self.jack = Switch (link_bag.io_hub.contact[1], invert = True) + self.strat_switch = Switch (link_bag.io_hub.contact[9], invert = True) self.contact = [ Switch (contact) - for contact in link_bag.io_hub.contact[2:] ] + for contact in link_bag.io_hub.contact[2:9] ] self.position = Position (link_bag.asserv.position) self.clamping_motor = MotorBasic (link_bag.io_hub.pwm[2], scheduler, 8 * pi, 0, pi) diff --git a/host/simu/robots/robospierre/view/bag.py b/host/simu/robots/robospierre/view/bag.py index 73aa9fe3..b718f6fe 100644 --- a/host/simu/robots/robospierre/view/bag.py +++ b/host/simu/robots/robospierre/view/bag.py @@ -35,6 +35,8 @@ class Bag: self.jack = Switch (sensor_frame, model_bag.jack, 'Jack') self.color_switch = Switch (sensor_frame, model_bag.color_switch, 'Color') + self.strat_switch = Switch (sensor_frame, model_bag.strat_switch, + 'Strat') self.robot = Robot (table, model_bag.position, model_bag.clamp) self.clamp = ( ClampTop (actuator_view.add_view (ClampTop.width, -- cgit v1.2.3