Adapted graph script for tests.

This commit is contained in:
vivek-shankar 2018-07-29 19:05:08 -04:00
parent f86da0d2e1
commit 92cf7c4412
2 changed files with 18 additions and 16 deletions

View File

@ -10,7 +10,7 @@ include "taskallocate/graphs/shapes_Y.bzz"
ROBOT_RADIUS = 50
ROBOT_DIAMETER = 2.0*ROBOT_RADIUS
ROBOT_SAFETYDIST = 2.0*ROBOT_DIAMETER
ROOT_ID = 2
ROOT_ID = 5
#
# Global variables
@ -389,7 +389,7 @@ function TransitionToJoined(){
#write statues
#v_tag.put(m_nLabel, m_lockstig)
barrier_create()
barrier_ready()
barrier_ready(940)
m_navigation.x=0.0
m_navigation.y=0.0
@ -568,7 +568,7 @@ function set_rc_goto() {
goal = gps_from_vec(math.vec2.newp(math.vec2.length(S2Target)/100.0, math.atan(S2Target.y,S2Target.x)))
print("Saving GPS goal: ",goal.latitude, goal.longitude)
uav_storegoal(goal.latitude, goal.longitude, pose.position.altitude)
storegoal(goal.latitude, goal.longitude, pose.position.altitude)
m_gotjoinedparent = 1
}
}
@ -655,8 +655,7 @@ function DoJoined(){
return
}
}
barrier_wait(ROBOTS, "GRAPH_TRANSTOLOCK", "GRAPH_JOINED")
barrier_wait(ROBOTS, "GRAPH_TRANSTOLOCK", "GRAPH_JOINED",941)
BroadcastGraph()
}
#
@ -681,17 +680,17 @@ function DoLock() {
goto_abs(m_navigation.x, m_navigation.y, 0.0, 0.0)
BroadcastGraph()
if(loop) {
if(timeout_graph==0) {
if(graphid < 3)
graphid = graphid + 1
else
graphid = 0
timeout_graph = 40
BVMSTATE="TASK_ALLOCATE"
}
timeout_graph = timeout_graph - 1
}
# if(loop) {
# if(timeout_graph==0) {
# if(graphid < 3)
# graphid = graphid + 1
# else
# graphid = 0
# timeout_graph = 40
# BVMSTATE="TASK_ALLOCATE"
# }
# timeout_graph = timeout_graph - 1
# }
}
#

View File

@ -32,6 +32,7 @@ goal_list = {
function init() {
init_stig()
init_swarm()
initGraph()
TARGET_ALTITUDE = 5 + (id-LOWEST_ROBOT_ID)*3.0 # m
loop = 1
@ -108,8 +109,10 @@ function step() {
# Executed once when the robot (or the simulator) is reset.
function reset() {
resetGraph()
}
# Executed once at the end of experiment.
function destroy() {
destroyGraph()
}