Pages: 1 2 [3] 4 5 ... 7   Go Down
Author Topic: RFID Video Daemon  (Read 3996 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Shannon Member
****
Karma: 117
Posts: 10113
:(){:|:&};: TOX id: fcb8e918bef08581e23f6ddf9d4dba77697c25b217bf372736ed959a95fde36df5b8c5b90fbb
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

what is printed in the processing terminal? must be the data received by arduino by println(command)
Logged

my Arduino code: https://github.com/lestofante/arduinoSketch
sei nuovo? non sai da dove partire? leggi qui: http://playground.arduino.cc/Italiano/Newbie

Offline Offline
Jr. Member
**
Karma: 0
Posts: 62
2b/!2b
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

NullPointerException

Stable Library
=========================================
Native lib Version = RXTX-2.1-7
Java lib Version   = RXTX-2.1-7
ø???ø?

The file is ø?? ? ? ? .mov is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable.
processing.app.debug.RunnerException: NullPointerException
   at processing.app.Sketch.placeException(Sketch.java:1543)
   at processing.app.debug.Runner.findException(Runner.java:582)
   at processing.app.debug.Runner.reportException(Runner.java:558)
   at processing.app.debug.Runner.exception(Runner.java:498)
   at processing.app.debug.EventThread.exceptionEvent(EventThread.java:367)
   at processing.app.debug.EventThread.handleEvent(EventThread.java:255)
   at processing.app.debug.EventThread.run(EventThread.java:89)
Exception in thread "Animation Thread" java.lang.NullPointerException
   at quicktime.util.QTHandle.<init>(QTHandle.java:287)
   at processing.video.Movie.init(Unknown Source)
   at processing.video.Movie.<init>(Unknown Source)
   at processing.video.Movie.<init>(Unknown Source)
   at sketch_apr05a.draw(sketch_apr05a.java:47)
   at processing.core.PApplet.handleDraw(Unknown Source)
   at processing.core.PApplet.run(Unknown Source)
   at java.lang.Thread.run(Thread.java:619)
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 62
2b/!2b
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

command = ø???ø?
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 62
2b/!2b
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Could someone please help me figure this out, please
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 62
2b/!2b
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Other advice I have got has been to add code[10] = '\0' to the arduino code, this makes the end of the array?

Another idea is to use Serial.readUntil() method to read the data.
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 62
2b/!2b
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have edited the code to load the absolute video, basically not using the command variable, I am still printing the command variable but I am now recieving a different error message.

The code looks like this:
Quote
import processing.serial.*;
import processing.video.*;

Serial myPort;  // The serial port
Movie myMovie;

void movieEvent(Movie m) {
  m.read();
}

void setup() {
  // Open whatever port is the one you're using.
  myPort = new Serial(this, Serial.list()[1], 9600);
 
}
void draw() {
while (myPort.available() >= 10) {
  //Video Code:
  String command = "";
  for (int i=0;i<10;i++){
     command += myPort.readChar();
  }
  println(command);
  size(400, 400);
  myMovie = new Movie(this,  "3600A9C9F8.mov");
  myMovie.play();
}
 
  if (myMovie != null){
      image(myMovie, 0, 0);
  }
 
}

"3600A9C9F8.mov" is the name of my movie file which is in the sketch folder, the error I am getting is as follows:

ArrayIndexOutOfBoundsException: Coordinate out of bounds!
Quote
processing.app.debug.RunnerException: ArrayIndexOutOfBoundsException: Coordinate out of bounds!
   at processing.app.Sketch.placeException(Sketch.java:1543)
   at processing.app.debug.Runner.findException(Runner.java:582)
   at processing.app.debug.Runner.reportException(Runner.java:558)
   at processing.app.debug.Runner.exception(Runner.java:498)
   at processing.app.debug.EventThread.exceptionEvent(EventThread.java:367)
   at processing.app.debug.EventThread.handleEvent(EventThread.java:255)
   at processing.app.debug.EventThread.run(EventThread.java:89)
Exception in thread "Animation Thread" java.lang.ArrayIndexOutOfBoundsException: Coordinate out of bounds!
   at sun.awt.image.IntegerInterleavedRaster.setDataElements(IntegerInterleavedRaster.java:404)
   at processing.core.PGraphicsJava2D$ImageCache.update(Unknown Source)
   at processing.core.PGraphicsJava2D.imageImpl(Unknown Source)
   at processing.core.PGraphics.image(Unknown Source)
   at processing.core.PApplet.image(Unknown Source)
   at sketch_apr05a.draw(sketch_apr05a.java:52)
   at processing.core.PApplet.handleDraw(Unknown Source)
   at processing.core.PApplet.run(Unknown Source)
   at java.lang.Thread.run(Thread.java:619)

The following code is printed above the error, I dont understand why this is printed but the top line is the command variable:

ø???ø?
x x<ð?ø x
ð?? x ??x

Please help with this, it is starting to get more confusing.
Logged

0
Offline Offline
Shannon Member
****
Karma: 117
Posts: 10113
:(){:|:&};: TOX id: fcb8e918bef08581e23f6ddf9d4dba77697c25b217bf372736ed959a95fde36df5b8c5b90fbb
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

there are 2 errors:
1.
myPort = new Serial(this, Serial.list()[1], 9600);
the Serial array start from
  • , but in many system 0 is the real serial. with [1] you are trying to access the fake serial, that is USB. Because your arduino  USB was unplugged, there is NO fake serial, and [1] doesn't exist (that is wath array out of bounds means: you are trying to access an array cell that doesn't exist). Syply test code with usb plugged smiley

2.
you have to understand why command is command = ø???ø? while should be 3600A9C9F8. This is because you say to arduino to communicate at 2400bps
Code:
Serial.begin(2400); // RFID reader SOUT pin connected to Serial RX pin at 2400bps
while you are saying to processing to communicate at 9600bps
Quote
myPort = new Serial(this, Serial.list()[1], 9600);

ps. absolute doesn't mean use a static name, but is referred to path.
an absolute path is: c:\windows\file.txt; a relative path is just file.txt or .\file.txt etc...
the relative path can give some problem when using the IDE because you don't know what is the default folder in witch the program will look, but once you find it out it follow always the same logic. So first you have to try with absolute path, then relative, then you can test with dynamic file name

and when you get an error don't worry, if your program run fine at the first try there is something very wrong that will show up later  smiley-mr-green
you have to read the error, try to find out what does it means looking at the code that generate it (as you can see in the error you can see the line that generate it.)
Logged

my Arduino code: https://github.com/lestofante/arduinoSketch
sei nuovo? non sai da dove partire? leggi qui: http://playground.arduino.cc/Italiano/Newbie

Offline Offline
Jr. Member
**
Karma: 0
Posts: 62
2b/!2b
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you so much for getting back to me, I didn't see the baudrate was different, I will change it to 2400 asap.

Quote
  println(Serial.list());
  myPort = new Serial(this, Serial.list()[0], 9600);

This was the original code that I used, when the serial list was printed said COM3[0] COM4[1] and since i was using com4 I thought [1] was the correct number for that, if i change to 0 it will be looking for communication through COM3 which has nothing in it.

Quote
myMovie = new Movie(this,  "C:\Users\Rich\Documents\Processing\sketch_apr05a\3600A9C9F8.mov");
Does not work as an absolute path, it comes back with the error "unexpected char:  'U'" and if i delete the quotation marks it returns the error "unexpected char: '\'"

My arduino is always connected during testing, to port COM4.

Thank you for your advice, i'm learning to debug processing for the first time, your help is brilliant.

Logged

0
Offline Offline
Shannon Member
****
Karma: 117
Posts: 10113
:(){:|:&};: TOX id: fcb8e918bef08581e23f6ddf9d4dba77697c25b217bf372736ed959a95fde36df5b8c5b90fbb
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

yes because \ is a special caracter, (infact it means: the next charater is not to print but a command, n means new line, 0 means end of line, t means print a tab, etc..)
In your case you want print "\", so you have to write: \\ (\ is readed as special caracter, the seconds \ means: "just print a \" smiley )
Logged

my Arduino code: https://github.com/lestofante/arduinoSketch
sei nuovo? non sai da dove partire? leggi qui: http://playground.arduino.cc/Italiano/Newbie

Offline Offline
Jr. Member
**
Karma: 0
Posts: 62
2b/!2b
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

UPDATE

The baudrate was a massive success, the correct number is being outputted by the println(command); line which has brightened my day!

The error message now is an ArrayOutOfBoundsException: Coordinate out of bounds! and highlights the line:

  if (myMovie != null){
      image(myMovie, 0, 0);                <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  }
 
The numbers after the movie parameter are the X and Y axis for the position of the movie? Therefore 0 and 0 are correct?

I am recieving the same message whether i use absolute or relevant path.

I understand what you said about the errors, if I recieve an error I know there is something to work on but without a message it would be much harder.

Thank you for your assistance.
« Last Edit: April 07, 2011, 12:41:52 pm by 4kingrich » Logged

0
Offline Offline
Shannon Member
****
Karma: 117
Posts: 10113
:(){:|:&};: TOX id: fcb8e918bef08581e23f6ddf9d4dba77697c25b217bf372736ed959a95fde36df5b8c5b90fbb
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

googling: http://www.google.com.my/search?q=processing+movie+ArrayOutOfBoundsException%3A+Coordinate+out+of+bounds!
the first link: http://processing.org/discourse/yabb2/YaBB.pl?board=Video;action=display;num=1232118515
the last post:
Quote
This is several months later, but I'm still having this problem.  The fix for me came in defining the size--I had to specify P2D.

so use this: size(600,400,P2D); instead of size(600,400);

Hope that helps someone

smiley-grin
Logged

my Arduino code: https://github.com/lestofante/arduinoSketch
sei nuovo? non sai da dove partire? leggi qui: http://playground.arduino.cc/Italiano/Newbie

Offline Offline
Jr. Member
**
Karma: 0
Posts: 62
2b/!2b
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Lesto, that was a really good try but now its throwing another error that is worse, it is a PApplet$RendererChangeException

I have googled this and apprently there is a fix waiting for it?

Quote
+1 on this; it makes it difficult to use 0152 + OpenGL with JRuby. But, I understand we're in the midst of change. I can be patient.

Without the P2D it throws an out of bounds exception.

Seems like one thing after another, I'm so glad the number is printing correctly.

We're on the verge of a breakthrough I feel.

You have been very helpful and I hope we can get this to work.

THank you.
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 62
2b/!2b
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Researching the error exception:

Quote
public static class PApplet.RendererChangeException
extends java.lang.RuntimeException

Exception thrown when size() is called the first time.

This is used internally so that setup() is forced to run twice when the renderer is changed. This is the only way for us to handle invoking the new renderer while also in the midst of rendering.

Found on: http://processing.googlecode.com/svn/trunk/processing/build/javadoc/core/processing/core/PApplet.RendererChangeException.html
Logged

0
Offline Offline
Shannon Member
****
Karma: 117
Posts: 10113
:(){:|:&};: TOX id: fcb8e918bef08581e23f6ddf9d4dba77697c25b217bf372736ed959a95fde36df5b8c5b90fbb
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

sorry, can't understand the solution you post, maybe because i'm drunk, maybe because i can't understand his context, maybe because I'm not good in English smiley-grin

another work-around in the discussion i posted is using an external libraries that seems better(for performance and stability), jmcvideo http://www.mat.ucsb.edu/~a.forbes/PROCESSING/jmcvideo/jmcvideo.html
Logged

my Arduino code: https://github.com/lestofante/arduinoSketch
sei nuovo? non sai da dove partire? leggi qui: http://playground.arduino.cc/Italiano/Newbie

Offline Offline
Jr. Member
**
Karma: 0
Posts: 62
2b/!2b
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey,

The solution could worsen the problem, I follow instructions and still have a missing library, maybe because I use Windows, maybe it is not good, maybe I should have purchased a mac.

External libraries sounds good, I believe it could work, on the other hand problems are all I seem to be having.

Thank you for the idea!

Unfortunately the creator of jmcvideo left this comment over a year ago :

Quote
Hi all, sorry about the Windows bug that I haven't had a chance to fix. I just completed my Masters, so I will have time to work on it soon. I read that there are rumors that JMC will be officially included with Java 7 sometime next year, which would make it much easier to develop/troubleshoot. And also JavaFX 1.3 is due to ship sometime soon (a preview was shown at Devoxx apparently) so hopefully that includes some fixes for JMC. In the meantime it is still true that jmcvideo is broken on Windows  Undecided  I'll post here when the issue is resolved. Thanks, Angus
« Last Edit: April 07, 2011, 09:54:01 pm by 4kingrich » Logged

Pages: 1 2 [3] 4 5 ... 7   Go Up
Jump to: