ROSBuzz_MISTLab/src/test1.bzz

45 lines
756 B
Plaintext
Raw Normal View History

# Executed once at init time.
function init() {
i = 0
2016-12-05 18:57:20 -04:00
a = 0
val = 0
}
# Executed at each time step.
function step() {
if (i == 0) {
neighbors.listen("Take",
function(vid, value, rid) {
print("Got (", vid, ",", value, ") from robot #", rid)
}
)
neighbors.listen("key",
function(vid, value, rid) {
print("Got (", vid, ",", value, ") from robot #", rid)
2016-12-05 18:57:20 -04:00
val = value
}
)
2016-12-05 18:57:20 -04:00
print(val)
if ((val==23) and (a == 0)) {
uav_takeoff()
a=1
}
if (a == 10) uav_land()
if (a != 0) a = a+1
}
else{
2016-12-05 18:57:20 -04:00
neighbors.broadcast("key", 23)
neighbors.broadcast("Take", "no")
}
}
# Executed once when the robot (or the simulator) is reset.
function reset() {
}
# Executed once at the end of experiment.
function destroy() {
}