git.droids-corp.org
/
aversive.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
2d718b9
)
add robot trail
author
zer0
<zer0@platinum>
Fri, 22 Jan 2010 18:43:57 +0000
(19:43 +0100)
committer
zer0
<zer0@platinum>
Fri, 22 Jan 2010 18:43:57 +0000
(19:43 +0100)
projects/microb2010/tests/hostsim/display.py
patch
|
blob
|
history
diff --git
a/projects/microb2010/tests/hostsim/display.py
b/projects/microb2010/tests/hostsim/display.py
index
412f936
..
a6c90e7
100644
(file)
--- a/
projects/microb2010/tests/hostsim/display.py
+++ b/
projects/microb2010/tests/hostsim/display.py
@@
-14,13
+14,25
@@
robot = box(pos = (0, 0, 150),
size = (300,300,300),
color = (1, 0, 0) )
size = (300,300,300),
color = (1, 0, 0) )
+last_pos = robot.pos.x, robot.pos.y, robot.pos.z
+robot_trail = curve()
+max_trail = 500
+
def set_robot(x, y, a):
def set_robot(x, y, a):
- global robot
+ global robot
, last_pos
robot.pos = (x - AREA_X/2, y - AREA_Y/2, 150)
robot.axis = (math.cos(a*math.pi/180) * 300,
math.sin(a*math.pi/180) * 300,
0)
robot.pos = (x - AREA_X/2, y - AREA_Y/2, 150)
robot.axis = (math.cos(a*math.pi/180) * 300,
math.sin(a*math.pi/180) * 300,
0)
+ pos = robot.pos.x, robot.pos.y, robot.pos.z
+ if pos != last_pos:
+ robot_trail.append(pos)
+ last_pos = pos
+ robot_trail_l = len(robot_trail.pos)
+ if robot_trail_l> max_trail:
+ robot_trail.pos = robot_trail.pos[robot_trail_l - max_trail:]
+
while True:
try:
os.mkfifo("/tmp/.robot")
while True:
try:
os.mkfifo("/tmp/.robot")