ROSBuzz_MISTLab/script/test.bzz

46 lines
759 B
Plaintext

# Executed once at init time.
function init() {
i = 1
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)
val = value
}
)
print(val)
if ((val == 23) and (a == 0)) {
uav_takeoff()
a=1
}
if (a == 10) uav_land()
if (a != 0) a = a+1
}
else{
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() {
}