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 firsttimeinwp = 1
WPtab_id = 10
function check_rc_wp() { function check_rc_wp() {
if(firsttimeinwp) { if(firsttimeinwp) {
v_wp = stigmergy.create(WP_STIG) v_wp = stigmergy.create(WP_STIG)
@ -140,6 +141,16 @@ function check_rc_wp() {
return return
} else { } else {
var ls = packWP2i(rc_goto.latitude, rc_goto.longitude, 0) 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) v_wp.put(rc_goto.id,ls)
reset_rc() reset_rc()
} }

View File

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

View File

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