summaryrefslogtreecommitdiffhomepage
path: root/host/simu/robots
diff options
context:
space:
mode:
authorNicolas Schodet2011-04-29 20:35:20 +0200
committerNicolas Schodet2011-04-29 20:35:20 +0200
commit9c9f35753489cba5a61816104ac294857be20941 (patch)
treeba36dbe8fda70ca491fc499128c6f317c532cbc7 /host/simu/robots
parentde2a1e81eef5054725ae218afaf51dc8e06dedd0 (diff)
host/simu: transpose transformation matrix, reverse transformation order
This is better because transformations can be built incrementally from the container to the contained. This use the same semantic as OpenGL.
Diffstat (limited to 'host/simu/robots')
-rw-r--r--host/simu/robots/aquajim/model/sorter.py2
-rw-r--r--host/simu/robots/aquajim/view/robot.py2
-rw-r--r--host/simu/robots/giboulee/view/robot.py2
-rw-r--r--host/simu/robots/marcel/model/loader.py4
-rw-r--r--host/simu/robots/marcel/view/loader.py2
-rw-r--r--host/simu/robots/marcel/view/robot.py2
6 files changed, 7 insertions, 7 deletions
diff --git a/host/simu/robots/aquajim/model/sorter.py b/host/simu/robots/aquajim/model/sorter.py
index e7b69761..93ff5e2a 100644
--- a/host/simu/robots/aquajim/model/sorter.py
+++ b/host/simu/robots/aquajim/model/sorter.py
@@ -58,8 +58,8 @@ class Sorter (Observable):
for i in self.into:
if i.pos is None:
return None
- m.rotate (i.angle)
m.translate (i.pos)
+ m.rotate (i.angle)
return m.apply (pos)
def __arm_motor_notified (self):
diff --git a/host/simu/robots/aquajim/view/robot.py b/host/simu/robots/aquajim/view/robot.py
index ad613bba..aefe2170 100644
--- a/host/simu/robots/aquajim/view/robot.py
+++ b/host/simu/robots/aquajim/view/robot.py
@@ -42,8 +42,8 @@ class Robot (simu.inter.drawable.Drawable):
"""Draw the robot."""
self.reset ()
if self.pos is not None:
- self.trans_rotate (self.angle)
self.trans_translate (self.pos)
+ self.trans_rotate (self.angle)
# Draw robot body.
self.draw_polygon ((150, 155), (-90, 155), (-150, 70),
(-150, -70), (-90, -155), (150, -155))
diff --git a/host/simu/robots/giboulee/view/robot.py b/host/simu/robots/giboulee/view/robot.py
index ab1ffc6d..42ebe6fb 100644
--- a/host/simu/robots/giboulee/view/robot.py
+++ b/host/simu/robots/giboulee/view/robot.py
@@ -42,8 +42,8 @@ class Robot (simu.inter.drawable.Drawable):
"""Draw the robot."""
self.reset ()
if self.pos is not None:
- self.trans_rotate (self.angle)
self.trans_translate (self.pos)
+ self.trans_rotate (self.angle)
# Draw robot body.
self.draw_polygon ((115, 30), (170, 85), (150, 127), (130, 145),
(-25, 200), (-70, 200), (-70, -200), (-25, -200),
diff --git a/host/simu/robots/marcel/model/loader.py b/host/simu/robots/marcel/model/loader.py
index 0270ce79..ae1caa7d 100644
--- a/host/simu/robots/marcel/model/loader.py
+++ b/host/simu/robots/marcel/model/loader.py
@@ -159,8 +159,8 @@ class Loader (Observable):
# If gate is high, drop elements.
if self.load and self.gate_angle > self.GATE_STROKE / 2:
m = TransMatrix ()
- m.rotate (self.robot_position.angle)
m.translate (self.robot_position.pos)
+ m.rotate (self.robot_position.angle)
pos = m.apply ((-250, 0))
for e in self.load:
e.pos = pos
@@ -177,9 +177,9 @@ class Loader (Observable):
return elements
# Matrix to transform an obstacle position into robot coordinates.
m = TransMatrix ()
+ m.rotate (-self.robot_position.angle)
m.translate ((-self.robot_position.pos[0],
-self.robot_position.pos[1]))
- m.rotate (-self.robot_position.angle)
# Look up elements.
# This could be used if clamp blocking is handled or elements are
# pushed:
diff --git a/host/simu/robots/marcel/view/loader.py b/host/simu/robots/marcel/view/loader.py
index 5bda5d5b..d4ed336e 100644
--- a/host/simu/robots/marcel/view/loader.py
+++ b/host/simu/robots/marcel/view/loader.py
@@ -67,8 +67,8 @@ class Loader (Drawable):
(300, 25 + 25 * i + (150 - 20 * i) * ratio))
if self.model.elevator_height is not None:
self.trans_identity ()
- self.trans_rotate (-self.model.elevator_angle)
self.trans_translate ((-100, -100 + self.model.elevator_height))
+ self.trans_rotate (-self.model.elevator_angle)
# Draw clamp load.
if self.model.clamp_load:
elements = self.model.clamp_load
diff --git a/host/simu/robots/marcel/view/robot.py b/host/simu/robots/marcel/view/robot.py
index 4e2135f2..67d505a2 100644
--- a/host/simu/robots/marcel/view/robot.py
+++ b/host/simu/robots/marcel/view/robot.py
@@ -52,8 +52,8 @@ class Robot (simu.inter.drawable.Drawable):
"""Draw the robot."""
self.reset ()
if self.pos is not None:
- self.trans_rotate (self.angle)
self.trans_translate (self.pos)
+ self.trans_rotate (self.angle)
# Draw robot body.
self.draw_polygon ((120, 155), (-95, 155), (-160, 90),
(-160, -90), (-95, -155), (120, -155))