ROSBuzz_MISTLab/script/test.bzz

46 lines
759 B
Plaintext
Raw Normal View History

2016-09-19 15:08:14 -03:00
# Executed once at init time.
function init() {
i = 1
a = 0
val = 0
2016-09-19 15:08:14 -03:00
}
# Executed at each time step.
function step() {
2016-10-09 20:58:50 -03:00
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")
}
2016-09-20 13:37:33 -03:00
2016-09-19 15:08:14 -03:00
}
# Executed once when the robot (or the simulator) is reset.
function reset() {
}
# Executed once at the end of experiment.
function destroy() {
}
2016-09-20 13:37:33 -03:00