att/rep in vstig table-in-table and webcontrol adapted to garbage collector

This commit is contained in:
dave 2018-11-12 21:07:54 -05:00
parent fa0e872928
commit fd7490b6c9
3 changed files with 19 additions and 8 deletions

View File

@ -127,6 +127,7 @@ function nei_cmd_listen() {
}
firsttimeinwp = 1
WPtab_id = 10
function check_rc_wp() {
if(firsttimeinwp) {
v_wp = stigmergy.create(WP_STIG)
@ -140,6 +141,16 @@ function check_rc_wp() {
return
} else {
var ls = packWP2i(rc_goto.latitude, rc_goto.longitude, 0)
if(rc_goto.id>49) { # Attractor/repulsor table
WPtab = v_wp.get(WPtab_id)
if(WPtab!=nil)
WPtab[rc_goto.id]=ls
else {
WPtab={}
WPtab[rc_goto.id]=ls
}
v_wp.put(WPtab_id,WPtab)
} else
v_wp.put(rc_goto.id,ls)
reset_rc()
}

View File

@ -256,15 +256,15 @@ counter = 0
function voronoicentroid() {
BVMSTATE="DEPLOY"
check_rc_wp()
log("V_wp size:",v_wp.size())
if(V_TYPE == 2) # NOT MOVING!
wptab = v_wp.get(WPtab_id)
if(wptab==nil or V_TYPE == 2)
return
if(not(v_wp.size() > 0))
else if(not(size(wptab) > 0))
return
log("WP table size:", size(wptab))
it_pts = 0
att = {}
v_wp.foreach(
function(key, value, robot){
foreach(wptab, function(key, value){
wp = unpackWP2i(value)
if(key > 99)
log("Nothing planed for the repulsors yet....")

View File

@ -53,7 +53,7 @@ function i2s(value){
return "INDIWP"
}
else if(value==7){
return "TASK_ALLOCATE"
return "GOHOME"
}
else if(value==8){
return "LAUNCH"
@ -87,7 +87,7 @@ function s2i(value){
else if(value=="WAYPOINT"){
return 6
}
else if(value=="TASK_ALLOCATE"){
else if(value=="GOHOME"){
return 7
}
else if(value=="LAUNCH"){