From 8ed9fb23f3ab93374d9bcbe6560e84c6c1de1b2a Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Sat, 7 May 2011 00:30:10 +0200 Subject: digital/{ai,io-hub}, host/simu: use io-hub for simu --- host/simu/robots/robospierre/link/bag.py | 4 ++-- host/simu/robots/robospierre/model/bag.py | 23 +++++++++++------------ host/simu/robots/robospierre/view/bag.py | 2 -- 3 files changed, 13 insertions(+), 16 deletions(-) (limited to 'host/simu') diff --git a/host/simu/robots/robospierre/link/bag.py b/host/simu/robots/robospierre/link/bag.py index 2760aec0..ac68889a 100644 --- a/host/simu/robots/robospierre/link/bag.py +++ b/host/simu/robots/robospierre/link/bag.py @@ -22,7 +22,7 @@ # # }}} """Robospierre bag of links.""" -import io.mex +import io_hub.mex import asserv.mex import mimot.mex @@ -30,6 +30,6 @@ class Bag: def __init__ (self, node): self.asserv = asserv.mex.Mex (node) - self.io = io.mex.Mex (node) + self.io_hub = io_hub.mex.Mex (node) self.mimot = mimot.mex.Mex (node) diff --git a/host/simu/robots/robospierre/model/bag.py b/host/simu/robots/robospierre/model/bag.py index e6810e18..ce55f997 100644 --- a/host/simu/robots/robospierre/model/bag.py +++ b/host/simu/robots/robospierre/model/bag.py @@ -32,26 +32,25 @@ from math import pi class Bag: def __init__ (self, scheduler, table, link_bag): - self.jack = Switch (link_bag.io.jack) - self.color_switch = Switch (link_bag.io.color_switch) - self.contact = [ Switch (contact) for contact in link_bag.io.contact ] + self.color_switch = Switch (link_bag.io_hub.contact[0]) + self.jack = Switch (link_bag.io_hub.contact[1]) + self.contact = [ Switch (contact) + for contact in link_bag.io_hub.contact[2:] ] self.position = Position (link_bag.asserv.position) - self.clamping_motor = MotorBasic (link_bag.io.pwm[0], scheduler, + self.clamping_motor = MotorBasic (link_bag.io_hub.pwm[0], scheduler, 2 * pi, 0, pi) self.clamp = Clamp (table, self.position, link_bag.mimot.aux[0], link_bag.mimot.aux[1], self.clamping_motor) self.distance_sensor = [ - DistanceSensorSensopart (link_bag.io.adc[0], scheduler, table, + DistanceSensorSensopart (link_bag.io_hub.adc[0], scheduler, table, (20, -20), -pi * 10 / 180, (self.position, ), 2), - DistanceSensorSensopart (link_bag.io.adc[1], scheduler, table, + DistanceSensorSensopart (link_bag.io_hub.adc[1], scheduler, table, (20, 20), pi * 10 / 180, (self.position, ), 2), - DistanceSensorSensopart (link_bag.io.adc[2], scheduler, table, + DistanceSensorSensopart (link_bag.io_hub.adc[2], scheduler, table, (-20, 20), pi - pi * 10 / 180, (self.position, ), 2), - DistanceSensorSensopart (link_bag.io.adc[3], scheduler, table, + DistanceSensorSensopart (link_bag.io_hub.adc[3], scheduler, table, (-20, -20), pi + pi * 10 / 180, (self.position, ), 2), ] - link_bag.io.adc[4].value = 0 - link_bag.io.adc[5].value = 0 - self.path = link_bag.io.path - self.pos_report = link_bag.io.pos_report + for adc in link_bag.io_hub.adc[4:]: + adc.value = 0 diff --git a/host/simu/robots/robospierre/view/bag.py b/host/simu/robots/robospierre/view/bag.py index 361c79d3..0b5a85ad 100644 --- a/host/simu/robots/robospierre/view/bag.py +++ b/host/simu/robots/robospierre/view/bag.py @@ -43,6 +43,4 @@ class Bag: ClampSide.height), model_bag.clamp)) self.distance_sensor = [DistanceSensorUS (self.robot, ds) for ds in model_bag.distance_sensor] - self.path = Path (table, model_bag.path) - self.pos_report = PosReport (table, model_bag.pos_report) -- cgit v1.2.3