Asked — Edited
Resolved Resolved by DJ Sures!

Retrieving Array Values Via Tcp Server

I was wondering what the best method is of retrieving values in an array via the TCP server.

Thanks


ARC Pro

Upgrade to ARC Pro

Stay on the cutting edge of robotics with ARC Pro, guaranteeing that your robot is always ahead of the game.

PRO
Synthiam
#1  

Are you using something like C# to query?

You could ask for the variable something like this....



bool success = true;

int cnt = 0;

List<string> values = new List<string>();

while (success) {

  send(string.format("print($variable[0])", cnt));

  string val = readLine();

  if (val.contains("Index was outside the bounds of the array.")) {

    success = false;
  } else {

    values.Add(val);

    cnt++;
  }
}


#2  

This was really a request from STeven from Roborealm so let me check with him.

#3  

So when the Array is created inside ARC it really is multiple variables with the index at the end and you use the print command to read the variable

If that's true my initial response to him was correct.

I wanted to verify if my logic was sound.

#4  

A second question I had for myself was does EZ-Script support Multidimensional or Jagged arrays?

Thanks for your help DJ

PRO
Synthiam
#5  

if this is for steven, tell him that I will be creating a "dump variables" option for him

#6  

I will let him know what you said.

As of now you can in fact get the arrays from the RR EZRobot_variables module into ARC.

It was the retrieving them that prompted the question from STeven

Thanks

PRO
Synthiam
#7  

I have just implemented a DumpVariables() function which will output a list of all variables in ARC and their respective values. It will be included in the next release which is now postponed until after tomorrow's testing.

#8  

Thank you very much DJ.

Your hard work and that of your team is really appreciated.

#9  

That is awesome. I will add a function into EZ-DB to call that and store all current variables to a database.