some test changes

This commit is contained in:
Mario Alexis Labrana 2016-12-23 17:48:01 -05:00
parent 12f6cfe1ae
commit 53d400da27
2 changed files with 11 additions and 7 deletions

View File

@ -2,7 +2,7 @@
<launch> <launch>
<node name="rosbuzz_node" pkg="rosbuzz" type="rosbuzz_node" respawn="false" output="screen" > <node name="rosbuzz_node" pkg="rosbuzz" type="rosbuzz_node" respawn="false" output="screen" >
<param name="bzzfile_name" value="../ROS_WS/src/ROSBuzz/src/test1.bzz" /> <param name="bzzfile_name" value="../djiros_ws/src/ROSBuzz/src/test1.bzz" />
<param name="rcclient" value="true" /> <param name="rcclient" value="true" />
<param name="rcservice_name" value="/buzzcmd" /> <param name="rcservice_name" value="/buzzcmd" />
<param name="fcclient_name" value="/dji_mavcmd" /> <param name="fcclient_name" value="/dji_mavcmd" />

View File

@ -42,7 +42,7 @@ function table_print(t) {
}) })
} }
function barrier_wait(threshold, transf) { function barrier_wait(threshold, transf) {
table_print(barrier) #table_print(barrier)
barrier.get(id) barrier.get(id)
extradbg = barrier.size() extradbg = barrier.size()
if(barrier.size() >= threshold) { if(barrier.size() >= threshold) {
@ -54,6 +54,7 @@ function barrier_wait(threshold, transf) {
# flight status # flight status
function idle() { function idle() {
statef=idle
neighbors.listen("cmd", neighbors.listen("cmd",
function(vid, value, rid) { function(vid, value, rid) {
print("Got (", vid, ",", value, ") from robot #", rid) print("Got (", vid, ",", value, ") from robot #", rid)
@ -85,6 +86,7 @@ function land() {
function transition_to_land() { function transition_to_land() {
statef=transition_to_land
if(tim>=100){ if(tim>=100){
statef=land statef=land
tim=0 tim=0
@ -106,17 +108,19 @@ statef=idle
# Executed at each time step. # Executed at each time step.
function step() { function step() {
if(flight.rc_cmd!=oldcmd) { #if(flight.rc_cmd!=oldcmd) {
if(flight.rc_cmd==22) { if(flight.rc_cmd==22 and flight.status==1) {
flight.rc_cmd=0
statef=takeoff statef=takeoff
neighbors.broadcast("cmd", 22) neighbors.broadcast("cmd", 22)
} else if(flight.rc_cmd==21) { } else if(flight.rc_cmd==21 and flight.status==2) {
flight.rc_cmd=0
statef=land statef=land
neighbors.broadcast("cmd", 21) neighbors.broadcast("cmd", 21)
} }
oldcmd=flight.rc_cmd # oldcmd=flight.rc_cmd
} #}
statef() statef()
} }