1
0
Fork 0

Add a (test) script to open and close the doors of the bo105.

This commit is contained in:
ehofman 2003-11-28 12:19:49 +00:00
parent 0abab4423f
commit df52e98fd8

36
Nasal/bo105.nas Normal file
View file

@ -0,0 +1,36 @@
# $Id$
print("Loading bo105.nas");
print("\tShift-C ... open/close rear door");
rearpos = "/controls/doors/rear";
rearstep = "/controls/doors/rear-state";
setprop(rearstep, 0);
reardoor = func {
pos = getprop(rearpos);
step = getprop(rearstep);
if (pos == 0 or step < 0) {
setprop(rearstep, 0.02);
} elsif (pos == 1 or step > 0) {
setprop(rearstep, -0.02);
}
settimer(MoveDoor, 0.05);
}
MoveDoor = func {
pos = getprop(rearpos);
step = getprop(rearstep);
if (pos + step >= 0 and pos + step <= 1) {
setprop(rearpos, pos + step);
settimer(MoveDoor, 0.05);
} else {
if (step < 0) {
setprop(rearpos, 0);
} elsif (step > 0) {
setprop(rearpos, 1);
}
setprop(rearstep, 0);
}
}
print("Finished loading bo105.nas");