We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
Roborealm + processing problems (Read 447 times)
Roborealm + processing problems
Jan 28th, 2010, 11:20am
 
Hi all, I work a lot on processing and roborealm and i reach this point:
I can't communicate with serial from roborealm to processing because I have arduino connected to processing also, and it gives an error. for this reason I work like this:
i can create a txt file with roborealm and save into a value, like the x value of a detected man in camera. The file appears like this:
COGX 39293489382901923903920910921......
variable is made by 3 numbers
(i can't understand how processing can understand this and split values automatically)
Code:
Code:
String[] lines = loadStrings("vision.txt");
int time = lines.length - 1;
int got = Integer.parseInt(lines[time]);
println(got);
if got > 300 println("hi")


with this i get:
340
HI
340
HI
......

My problem is that i have to take always the last value to detect in real time men movements, for this reason i wrote:  int time = lines.length - 1;

if I start processing all is ok, when I open roborealm suddenly processing give sthis error
ERROR:
numberFormatException : for input string ""

If i write
int got = Integer.parseInt(lines[lines.length]):
it gives this error: Arrayindexoutofbound: and a number..
it i write
int got = Integer.parseInt(lines[lines.length - the number got in the previous error]):
it works with roborealm opened also, but when roborealm does the first value save (when detect something) processing gives again the first error....


if i ask to stamp lines it stamps all lines from the first to the last, and i can se in real time the values saved by roborealm with no problem. Now i have to understand how can i take the last value without problems

Please help me the graduation exam is near and i would like to add this application to my robot!!!
Page Index Toggle Pages: 1