log addition

This commit is contained in:
David St-Onge 2016-12-23 16:36:31 -05:00
parent c30cc48455
commit 12f6cfe1ae
3 changed files with 25 additions and 16 deletions

View File

@ -8,7 +8,7 @@
<param name="fcclient_name" value="/dji_mavcmd" /> <param name="fcclient_name" value="/dji_mavcmd" />
<param name="in_payload" value="/inMavlink"/> <param name="in_payload" value="/inMavlink"/>
<param name="out_payload" value="/outMavlink"/> <param name="out_payload" value="/outMavlink"/>
<param name="robot_id" value="1"/> <param name="robot_id" value="3"/>
</node> </node>

View File

@ -175,6 +175,9 @@ namespace buzz_utility{
buzzvm_pushs(VM, buzzvm_string_register(VM, "print", 1)); buzzvm_pushs(VM, buzzvm_string_register(VM, "print", 1));
buzzvm_pushcc(VM, buzzvm_function_register(VM, buzzuav_closures::buzzros_print)); buzzvm_pushcc(VM, buzzvm_function_register(VM, buzzuav_closures::buzzros_print));
buzzvm_gstore(VM); buzzvm_gstore(VM);
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_pushs(VM, buzzvm_string_register(VM, "uav_goto", 1));
buzzvm_pushcc(VM, buzzvm_function_register(VM, buzzuav_closures::buzzuav_goto)); buzzvm_pushcc(VM, buzzvm_function_register(VM, buzzuav_closures::buzzuav_goto));
buzzvm_gstore(VM); buzzvm_gstore(VM);

View File

@ -26,13 +26,23 @@ function barrier_set(threshold, transf) {
# Make yourself ready # Make yourself ready
# #
function barrier_ready() { function barrier_ready() {
barrier.put(id, 1) barrier.put(id, 1)
print ("before put")
barrier.get(id)
print("barrier put : ")
} }
# #
# Executes the barrier # Executes the barrier
# #
function table_print(t) {
foreach(t, function(key, value) {
log(key, " -> ", value)
})
}
function barrier_wait(threshold, transf) { function barrier_wait(threshold, transf) {
table_print(barrier)
barrier.get(id) barrier.get(id)
extradbg = barrier.size() extradbg = barrier.size()
if(barrier.size() >= threshold) { if(barrier.size() >= threshold) {
@ -44,6 +54,16 @@ function barrier_wait(threshold, transf) {
# flight status # flight status
function idle() { 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() { function takeoff() {
@ -86,20 +106,6 @@ statef=idle
# Executed at each time step. # Executed at each time step.
function 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!=oldcmd) {
if(flight.rc_cmd==22) { if(flight.rc_cmd==22) {