diff --git a/launch/rosbuzzm100.launch b/launch/rosbuzzm100.launch index a5b5f4a..5f62007 100644 --- a/launch/rosbuzzm100.launch +++ b/launch/rosbuzzm100.launch @@ -8,7 +8,7 @@ - + diff --git a/src/buzz_utility.cpp b/src/buzz_utility.cpp index 11b27f7..0c970e5 100644 --- a/src/buzz_utility.cpp +++ b/src/buzz_utility.cpp @@ -175,7 +175,10 @@ namespace buzz_utility{ buzzvm_pushs(VM, buzzvm_string_register(VM, "print", 1)); buzzvm_pushcc(VM, buzzvm_function_register(VM, buzzuav_closures::buzzros_print)); buzzvm_gstore(VM); - buzzvm_pushs(VM, buzzvm_string_register(VM, "uav_goto", 1)); + buzzvm_pushs(VM, buzzvm_string_register(VM, "log", 1)); + buzzvm_pushcc(VM, buzzvm_function_register(VM, buzzuav_closures::buzzros_print)); + buzzvm_gstore(VM); + buzzvm_pushs(VM, buzzvm_string_register(VM, "uav_goto", 1)); buzzvm_pushcc(VM, buzzvm_function_register(VM, buzzuav_closures::buzzuav_goto)); buzzvm_gstore(VM); buzzvm_pushs(VM, buzzvm_string_register(VM, "uav_takeoff", 1)); diff --git a/src/test1.bzz b/src/test1.bzz index 3b4af86..fe425cc 100644 --- a/src/test1.bzz +++ b/src/test1.bzz @@ -26,13 +26,23 @@ function barrier_set(threshold, transf) { # Make yourself ready # function barrier_ready() { + barrier.put(id, 1) + print ("before put") + barrier.get(id) + print("barrier put : ") } # # Executes the barrier # +function table_print(t) { + foreach(t, function(key, value) { + log(key, " -> ", value) + }) +} function barrier_wait(threshold, transf) { + table_print(barrier) barrier.get(id) extradbg = barrier.size() if(barrier.size() >= threshold) { @@ -44,6 +54,16 @@ function barrier_wait(threshold, transf) { # flight status function 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 + } + } +) } function takeoff() { @@ -86,20 +106,6 @@ statef=idle # Executed at each time step. function step() { -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 - } - } -) - - -print("Flight status: ",flight.status) - if(flight.rc_cmd!=oldcmd) { if(flight.rc_cmd==22) {