From ecbf73892baf0a4ec43ca1d6f144b36c5738e337 Mon Sep 17 00:00:00 2001 From: David St-Onge Date: Tue, 8 Aug 2017 19:18:12 -0400 Subject: [PATCH 1/3] m100 fixes --- misc/cmdlinectr.sh | 8 -------- 1 file changed, 8 deletions(-) diff --git a/misc/cmdlinectr.sh b/misc/cmdlinectr.sh index a41c787..82b7a0b 100644 --- a/misc/cmdlinectr.sh +++ b/misc/cmdlinectr.sh @@ -33,11 +33,3 @@ function updaterobot { # rosrun robot_upstart install --logdir ~/ROS_WS/log/ robot_upstart/launch/m100buzzynocam.launch rosrun robot_upstart install --logdir ~/ROS_WS/log/ dji_sdk_mistlab/launch/m100buzzy.launch } -function updaterobot { -# rosrun robot_upstart install --logdir ~/ROS_WS/log/ robot_upstart/launch/m100buzzynocam.launch - rosrun robot_upstart install --logdir ~/ROS_WS/log/ dji_sdk_mistlab/launch/m100buzzy.launch -} -function updaterobot { -# rosrun robot_upstart install --logdir ~/ROS_WS/log/ robot_upstart/launch/m100buzzynocam.launch - rosrun robot_upstart install --logdir ~/ROS_WS/log/ dji_sdk_mistlab/launch/m100buzzy.launch -} From 04bc85be0342fd00fc3aed6210a816c3c96694f1 Mon Sep 17 00:00:00 2001 From: dave Date: Wed, 30 Aug 2017 17:22:37 -0400 Subject: [PATCH 2/3] fix graph bzz bug --- buzz_scripts/graphform.bzz | 41 ++++-------------------------- buzz_scripts/include/barrier.bzz | 17 +++++++------ buzz_scripts/include/uavstates.bzz | 2 +- buzz_scripts/include/vstigenv.bzz | 27 +++++++++++++++----- 4 files changed, 35 insertions(+), 52 deletions(-) diff --git a/buzz_scripts/graphform.bzz b/buzz_scripts/graphform.bzz index 7382af9..2bcdd30 100644 --- a/buzz_scripts/graphform.bzz +++ b/buzz_scripts/graphform.bzz @@ -4,9 +4,10 @@ include "string.bzz" include "vec2.bzz" include "update.bzz" -include "barrier.bzz" # don't use a stigmergy id=11 with this header. + +include "vstigenv.bzz" # reserve stigmergy id=20 and 21 for this header. +include "barrier.bzz" # reserve stigmergy id=11 for this header. include "uavstates.bzz" # require an 'action' function to be defined here. -include "vstigenv.bzz" include "graphs/shapes_Y.bzz" @@ -88,7 +89,7 @@ m_fTargetDistanceTolerance=0 #step cunt step_cunt=0 -#virtual stigmergy +# virtual stigmergy for the LOCK barrier. m_lockstig = 1 # Lennard-Jones parameters, may need change @@ -101,24 +102,6 @@ function FlockInteraction(dist,target,epsilon){ return mag } -function LimitAngle(angle){ - if(angle>2*math.pi) - return angle-2*math.pi - else if (angle<0) - return angle+2*math.pi - else - return angle -} - -# -# Calculates the angle of the given vector2. -# PARAM v: The vector2. -# RETURN: The angle of the vector. -# -Angle = function(v) { - return math.atan(v.y, v.x) -} - # #return the number of value in table # @@ -205,20 +188,6 @@ function find(table,value){ return index } -function pow(base,exponent){ - var i=0 - var renturn_val=1 - if(exponent==0) - return 1 - else{ - while(i= threshold) { # getlowest() transf() @@ -44,14 +43,16 @@ function barrier_wait(threshold, transf, resumef, bdt) { barrier = nil resumef() timeW=0 - } + } else if(bdt!=-1) + neighbors.broadcast("cmd", bdt) + timeW = timeW+1 } -# get the lowest id of the fleet, but requires too much bandwidth +# get the lowest id of the fleet, but requires too much bandwidth... function getlowest(){ - Lid = 20; - u=20 + Lid = 15; + u=15 while(u>=0){ tab = barrier.get(u) if(tab!=nil){ diff --git a/buzz_scripts/include/uavstates.bzz b/buzz_scripts/include/uavstates.bzz index 180c6cc..8b5a9dd 100644 --- a/buzz_scripts/include/uavstates.bzz +++ b/buzz_scripts/include/uavstates.bzz @@ -28,7 +28,7 @@ function takeoff() { statef=takeoff if( flight.status == 2 and position.altitude >= TARGET_ALTITUDE-TARGET_ALTITUDE/20.0) { - barrier_set(ROBOTS,action,land,22) + barrier_set(ROBOTS,action,land,-1) barrier_ready() } else { diff --git a/buzz_scripts/include/vstigenv.bzz b/buzz_scripts/include/vstigenv.bzz index c983fcc..7fd8e42 100644 --- a/buzz_scripts/include/vstigenv.bzz +++ b/buzz_scripts/include/vstigenv.bzz @@ -1,16 +1,29 @@ -STATUS_VSTIG = 10 -GROUND_VSTIG = 11 +######################################## +# +# FLEET V.STIGMERGY-RELATED FUNCTIONS +# +######################################## +# +# Constants +# +STATUS_VSTIG = 20 +GROUND_VSTIG = 21 +HIGHEST_ROBOTID = 14 WAIT4STEP = 10 -v_status = {} -v_ground = {} + +# +# Init var +# +var v_status = {} +var v_ground = {} b_updating = 0 +counter=WAIT4STEP function uav_initstig() { v_status = stigmergy.create(STATUS_VSTIG) v_ground = stigmergy.create(GROUND_VSTIG) } -counter=WAIT4STEP function uav_updatestig() { # TODO: Push values on update only. if(counter<=0) { @@ -78,7 +91,7 @@ function stattab_print() { if(v_status.size()>0) { if(b_updating==0) { u=0 - while(u<8){ + while(u0) { if(b_updating==0) { u=0 - while(u<8){ + while(u Date: Wed, 30 Aug 2017 20:29:10 -0400 Subject: [PATCH 3/3] launch file change --- misc/cmdlinectr.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/cmdlinectr.sh b/misc/cmdlinectr.sh index 82b7a0b..b519148 100644 --- a/misc/cmdlinectr.sh +++ b/misc/cmdlinectr.sh @@ -31,5 +31,5 @@ function stoprobot { } function updaterobot { # rosrun robot_upstart install --logdir ~/ROS_WS/log/ robot_upstart/launch/m100buzzynocam.launch - rosrun robot_upstart install --logdir ~/ROS_WS/log/ dji_sdk_mistlab/launch/m100buzzy.launch + rosrun robot_upstart install --logdir ~/ROS_WS/log/ dji_sdk_mistlab/launch_robot/m100buzzy.launch }