test lj
This commit is contained in:
parent
c83f50d0d4
commit
71f72e5e59
|
@ -99,22 +99,7 @@ function barrier_wait(threshold, transf) {
|
||||||
function idle() {
|
function idle() {
|
||||||
statef=idle
|
statef=idle
|
||||||
CURSTATE = "IDLE"
|
CURSTATE = "IDLE"
|
||||||
neighbors.listen("cmd",
|
|
||||||
function(vid, value, rid) {
|
|
||||||
print("Got (", vid, ",", value, ") from robot #", rid)
|
|
||||||
if(value==22) {
|
|
||||||
statef=takeoff
|
|
||||||
} else if(value==21) {
|
|
||||||
statef=land
|
|
||||||
} else if(value==400) {
|
|
||||||
uav_arm()
|
|
||||||
} else if(value==401){
|
|
||||||
uav_disarm()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function takeoff() {
|
function takeoff() {
|
||||||
|
@ -180,6 +165,21 @@ function step() {
|
||||||
uav_disarm()
|
uav_disarm()
|
||||||
neighbors.broadcast("cmd", 401)
|
neighbors.broadcast("cmd", 401)
|
||||||
}
|
}
|
||||||
|
neighbors.listen("cmd",
|
||||||
|
function(vid, value, rid) {
|
||||||
|
print("Got (", vid, ",", value, ") from robot #", rid)
|
||||||
|
if(value==22 and statef==idle) {
|
||||||
|
statef=takeoff
|
||||||
|
} else if(value==21) {
|
||||||
|
statef=land
|
||||||
|
} else if(value==400 and statef==idle) {
|
||||||
|
uav_arm()
|
||||||
|
} else if(value==401 and statef==idle){
|
||||||
|
uav_disarm()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
)
|
||||||
statef()
|
statef()
|
||||||
log("Current state: ", CURSTATE)
|
log("Current state: ", CURSTATE)
|
||||||
log("Swarm size: ",ROBOTS)
|
log("Swarm size: ",ROBOTS)
|
||||||
|
|
Loading…
Reference in New Issue