Welcome to Laser Pointer Forums - discuss green laser pointers, blue laser pointers, and all types of lasers



Rubicon and Peregrine

ARG

Well-known member
Joined
Feb 27, 2011
Messages
6,894
Points
113
@Seoul_lasers

The Rubicon has multiple data stream protocols which can be adjusted in the menu :)
What the serial output looks like depends on the settings :p

@grainde

Glad it's making contact. :) I'll see if I can find a Mac on campus over the weekend and take a stab at Peregrine.
 



Seoul_lasers

Well-known member
Joined
Jul 4, 2008
Messages
2,496
Points
83
@Seoul_lasers

The Rubicon has multiple data stream protocols which can be adjusted in the menu :)
What the serial output looks like depends on the settings :p

@grainde

Glad it's making contact. :) I'll see if I can find a Mac on campus over the weekend and take a stab at Peregrine.
:crackup: What was I thinking at 6am :oops: that's what lack of sleep can do to you.
Good to hear that the Rubicon is indeed
Streaming. Now just capture the data in the arduino
Terminal and cut and paste into numbers.
Graph problem done!
It's not as convient as peregrine with its .csv
export function but it does work.

Update: today...

Well I think I have isolated our issues to specifically the Java (libraries) in Java7.
I have tried the older peregrine 1.0 application and got the same error as OSX 10.9.2 when moving to a Machine running MacOSX 10.8.5 and Java7.
Using a Mac with the previous Java 6, I was able to connect to the LPM without any problems.
So the question is how do we get Peregrine to run under a Java 7 environment?


Update: March 22/ 4:06pm

Finally got Processing to connect to my ARGMETER through processing!!

Our problem with Peregrine not connecting is the way in which the libraries are being called/ referred to . There was a significant language change from v1.x - v2.x and this has made it impossible to connect using the libraries with the older style language.

I just used the brand new RXTX example to see if I could obtain input from my LPM. I got a connection!!

It's alive... It's alive.... my ARGMETER is trying to tell me something!

I'm going to the example paste below.

Code:
/**
 * Many Serial Ports
 * 
 * Read data from the multiple Serial Ports
 */


import processing.serial.*;

Serial[] myPorts = new Serial[2];  // Create a list of objects from Serial class
int[] dataIn = new int[2];         // a list to hold data from the serial ports

void setup()  {
  size(400, 300);
  // print a list of the serial ports:
  printArray(Serial.list());
  // On my machine, the first and third ports in the list
  // were the serial ports that my microcontrollers were 
  // attached to.
  // Open whatever ports ares the ones you're using.

// get the ports' names:
  String portOne = Serial.list()[0];
  String portTwo = Serial.list()[2];
  // open the ports:
  myPorts[0] = new Serial(this, portOne, 9600);
  myPorts[1] = new Serial(this, portTwo, 9600);
}


void draw() {
  // clear the screen:
  background(0);
  // use the latest byte from port 0 for the first circle
  fill(dataIn[0]);
  ellipse(width/3, height/2, 40, 40);
    // use the latest byte from port 1 for the second circle
   fill(dataIn[1]);
  ellipse(2*width/3, height/2, 40, 40);
}

/** 
  * When SerialEvent is generated, it'll also give you
  * the port that generated it.  Check that against a list
  * of the ports you know you opened to find out where
  * the data came from
*/
void serialEvent(Serial thisPort) {
  // variable to hold the number of the port:
  int portNumber = -1;
  
  // iterate over the list of ports opened, and match the 
  // one that generated this event:
  for (int p = 0; p < myPorts.length; p++) {
    if (thisPort == myPorts[p]) {
      portNumber = p;
    }
  }
  // read a byte from the port:
  int inByte = thisPort.read();
  // put it in the list that holds the latest data from each port:
  dataIn[portNumber] = inByte;
  // tell us who sent what:
  println("Got " + inByte + " from serial port " + portNumber);
}

/*
The following Wiring/Arduino code runs on both microcontrollers that
were used to send data to this sketch:

void setup()
{
  // start serial port at 9600 bps:
  Serial.begin(9600);
}

void loop() {
  // read analog input, divide by 4 to make the range 0-255:
  int analogValue = analogRead(0)/4; 
  Serial.write(analogValue);
  // pause for 10 milliseconds:
  delay(10);                 
}


*/

Question for trevor... What is the serial debugging window? now that I have established RXTX communication between my meter and
processing, I tried searching the missing reference and the library is nowhere to be found. Am I missing something in your source documents?
 
Last edited:

Seoul_lasers

Well-known member
Joined
Jul 4, 2008
Messages
2,496
Points
83
I have tried several methods now over the last few days to
get Peregrine working on MacOSX via a few transliteration programs.
So far no luck...
Our stumbling block now appears not to be
Java but the limitations of Processing and how it
Is handling libraries. Peregrine for Mac used to work before
V2 of processing now that processing has changed so has
how the libraries are called up.
The only way it seems to get peregrine to work is to move it out
of processing and into java only.
I'll post more details later on the recent errors.

Also been experimenting with translating
the windows version .exe to a .jar java executable.
.... Big unknown as to whether or not it can
Work.
 
Last edited:

Seoul_lasers

Well-known member
Joined
Jul 4, 2008
Messages
2,496
Points
83
Well I now have our error(s) exactly 100% pinpointed

Today I used the command line in terminal and launched the Peregrine application stub at the same time to see where things were going wrong.

The program executed fine, however when hitting the connect button in Peregrine 1.5.0

Look below what occurred.

This looks like a complete recoding needs to be done.
Also check the attached .pdf.

hmm.. Also under Processing I can't recompile as I am missing something in the library. I need help with this with out it we are seriously SOL! :cryyy:

Code:
Native lib Version = RXTX-2.1-7
Java lib Version   = RXTX-2.1-7
To use the serial library, first open
Applications -> Utilities -> Terminal.app
and enter the following:
sudo mkdir -p /var/lock
sudo chmod 777 /var/lock
Mar 26, 2014 12:31:11 AM controlP5.ControlBroadcaster printMethodError
SEVERE: An error occured while forwarding a Controller event, please check your code at Connect
java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at controlP5.ControlBroadcaster.invokeMethod(Unknown Source)
	at controlP5.ControlBroadcaster.callTarget(Unknown Source)
	at controlP5.ControlBroadcaster.broadcast(Unknown Source)
	at controlP5.Controller.broadcast(Unknown Source)
	at controlP5.Button.setValue(Unknown Source)
	at controlP5.Button.activate(Unknown Source)
	at controlP5.Button.mouseReleased(Unknown Source)
	at controlP5.Controller.setMousePressed(Unknown Source)
	at controlP5.ControllerGroup.setMousePressed(Unknown Source)
	at controlP5.ControlWindow.mouseReleasedEvent(Unknown Source)
	at controlP5.ControlWindow.mouseEvent(Unknown Source)
	at sun.reflect.GeneratedMethodAccessor14.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at processing.core.PApplet$RegisteredMethods.handle(PApplet.java:1084)
	at processing.core.PApplet.handleMethods(PApplet.java:1279)
	at processing.core.PApplet.handleMouseEvent(PApplet.java:2560)
	at processing.core.PApplet.dequeueEvents(PApplet.java:2463)
	at processing.core.PApplet.handleDraw(PApplet.java:2153)
	at processing.core.PGraphicsJava2D.requestDraw(PGraphicsJava2D.java:193)
	at processing.core.PApplet.run(PApplet.java:2020)
	at java.lang.Thread.run(Thread.java:695)
Caused by: java.lang.RuntimeException: Please use Tools ? Fix the Serial Library.
	at processing.serial.Serial.<init>(Unknown Source)
	at processing.serial.Serial.<init>(Unknown Source)
	at Peregrine.Connect(Peregrine.java:2602)
	... 26 more
To use the serial library, first open
Applications -> Utilities -> Terminal.app
and enter the following:
sudo mkdir -p /var/lock
sudo chmod 777 /var/lock
Mar 26, 2014 12:32:12 AM controlP5.ControlBroadcaster printMethodError
SEVERE: An error occured while forwarding a Controller event, please check your code at Connect
java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at controlP5.ControlBroadcaster.invokeMethod(Unknown Source)
	at controlP5.ControlBroadcaster.callTarget(Unknown Source)
	at controlP5.ControlBroadcaster.broadcast(Unknown Source)
	at controlP5.Controller.broadcast(Unknown Source)
	at controlP5.Button.setValue(Unknown Source)
	at controlP5.Button.activate(Unknown Source)
	at controlP5.Button.mouseReleased(Unknown Source)
	at controlP5.Controller.setMousePressed(Unknown Source)
	at controlP5.ControllerGroup.setMousePressed(Unknown Source)
	at controlP5.ControlWindow.mouseReleasedEvent(Unknown Source)
	at controlP5.ControlWindow.mouseEvent(Unknown Source)
	at sun.reflect.GeneratedMethodAccessor14.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at processing.core.PApplet$RegisteredMethods.handle(PApplet.java:1084)
	at processing.core.PApplet.handleMethods(PApplet.java:1279)
	at processing.core.PApplet.handleMouseEvent(PApplet.java:2560)
	at processing.core.PApplet.dequeueEvents(PApplet.java:2463)
	at processing.core.PApplet.handleDraw(PApplet.java:2153)
	at processing.core.PGraphicsJava2D.requestDraw(PGraphicsJava2D.java:193)
	at processing.core.PApplet.run(PApplet.java:2020)
	at java.lang.Thread.run(Thread.java:695)
Caused by: java.lang.RuntimeException: Please use Tools ? Fix the Serial Library.
	at processing.serial.Serial.<init>(Unknown Source)
	at processing.serial.Serial.<init>(Unknown Source)
	at Peregrine.Connect(Peregrine.java:2602)
	... 26 more


Just so that everyone knows that the Linux version of Peregrine is also suffering from exactly the same problems as the
MacOSX edition is. I tried running the application under Unbuntu today.
So the only working variety is the windows edition.


bump up
 

Attachments

Last edited:

Seoul_lasers

Well-known member
Joined
Jul 4, 2008
Messages
2,496
Points
83
bump up.

Explains where Peregrine coding has errors.

We urgently need this fixed. :can:
 

Bionic-Badger

Well-known member
Joined
Oct 26, 2007
Messages
5,463
Points
83
Just to be sure, you did actually follow the instructions the error message gave:

Code:
To use the serial library, first open
Applications -> Utilities -> Terminal.app
and enter the following:
sudo mkdir -p /var/lock
sudo chmod 777 /var/lock
There's some mention of problems with OSX and all that in some of the Processing release notes.
 

Seoul_lasers

Well-known member
Joined
Jul 4, 2008
Messages
2,496
Points
83
Just to be sure, you did actually follow the instructions the error message gave:

Code:
To use the serial library, first open
Applications -> Utilities -> Terminal.app
and enter the following:
sudo mkdir -p /var/lock
sudo chmod 777 /var/lock
There's some mention of problems with OSX and all that in some of the Processing release notes.
that's for the beta version of Processing 2.0b --- that is no longer applicable
as of v2.1.
The libraries install without having to use the command line.

:thinking: :thinking:

Tried it with the current setup and still no luck.
Going to re-install Java7 and Processing.
 
Last edited:

Seoul_lasers

Well-known member
Joined
Jul 4, 2008
Messages
2,496
Points
83
Alright. We've got a break through.

I tried re-installing java7 and Processing 2.1.1.

then I ran the command line window and tired the old beta command for unlocking the libraries.

sudo mkdir -p /var/lock
sudo chmod 777 /var/lock

ah... so the libraries are locked up?
This was not supposed to be occurring on v2.1.1 !!

Peregrine is now working on MacOSX 10.9.2



We still have 2 problems. The meter menu (broken) and window size require fixing.

Graphing functions and export data are all working as they should!
 
Last edited:

Seoul_lasers

Well-known member
Joined
Jul 4, 2008
Messages
2,496
Points
83


Peregrine has been tested on 2 different LPM protocols. It is auto detecting the inputs.

Laserbee is also working now!

:can: laserbee is within ~7-8% of the Ophir sensor.
 
Last edited:

grainde

Well-known member
Joined
Jan 29, 2012
Messages
3,160
Points
113
Hey Seoul sorry it took me so long to post. Heres a screen shot with peregrine running...:crackup:



Running OS X 10.9.2. :beer:
 

Seoul_lasers

Well-known member
Joined
Jul 4, 2008
Messages
2,496
Points
83
Hey Seoul sorry it took me so long to post. Heres a screen shot with peregrine running...:crackup:



Running OS X 10.9.2. :beer:
Something sure isn't right there...:confused:
Also why do you have a web browser up instead....
What's the window behind the browser? Are you tell me that you don't even get a window?


Here's what I want you to do.

1) Install Processing 2.1.2 *
2) Install Arduino *
3) Try running Arduino program and run the Rubicon in serial monitor

If this works... good. If not you've got an i/o error. (indirectly related to your problem.. a check non the less) if you know this works then skip it.

4) next try running the basic Processing sketch below. ( this is nothing to do with Peregrine but to test to see if Java is working)
copy exactly. After then hit run. You should get a window.
There should be no issues in bringing up a window.




Code:
/**
 * Many Serial Ports
 * 
 * Read data from the multiple Serial Ports
 */


import processing.serial.*;

Serial[] myPorts = new Serial[2];  // Create a list of objects from Serial class
int[] dataIn = new int[2];         // a list to hold data from the serial ports

void setup()  {
  size(400, 300);
  // print a list of the serial ports:
  printArray(Serial.list());
  // On my machine, the first and third ports in the list
  // were the serial ports that my microcontrollers were 
  // attached to.
  // Open whatever ports ares the ones you're using.

// get the ports' names:
  String portOne = Serial.list()[0];
  String portTwo = Serial.list()[2];
  // open the ports:
  myPorts[0] = new Serial(this, portOne, 9600);
  myPorts[1] = new Serial(this, portTwo, 9600);
}


void draw() {
  // clear the screen:
  background(0);
  // use the latest byte from port 0 for the first circle
  fill(dataIn[0]);
  ellipse(width/3, height/2, 40, 40);
    // use the latest byte from port 1 for the second circle
   fill(dataIn[1]);
  ellipse(2*width/3, height/2, 40, 40);
}

/** 
  * When SerialEvent is generated, it'll also give you
  * the port that generated it.  Check that against a list
  * of the ports you know you opened to find out where
  * the data came from
*/
void serialEvent(Serial thisPort) {
  // variable to hold the number of the port:
  int portNumber = -1;
  
  // iterate over the list of ports opened, and match the 
  // one that generated this event:
  for (int p = 0; p < myPorts.length; p++) {
    if (thisPort == myPorts[p]) {
      portNumber = p;
    }
  }
  // read a byte from the port:
  int inByte = thisPort.read();
  // put it in the list that holds the latest data from each port:
  dataIn[portNumber] = inByte;
  // tell us who sent what:
  println("Got " + inByte + " from serial port " + portNumber);
}

/*
The following Wiring/Arduino code runs on both microcontrollers that
were used to send data to this sketch:

void setup()
{
  // start serial port at 9600 bps:
  Serial.begin(9600);
}

void loop() {
  // read analog input, divide by 4 to make the range 0-255:
  int analogValue = analogRead(0)/4; 
  Serial.write(analogValue);
  // pause for 10 milliseconds:
  delay(10);                 
}


*/

If you get a window up then there is no reason for Peregrine not to work.
Have you disabled Privacy and security settings to allow apps to run from anywhere in your System prefs?

Last but not least,

Try running Peregrine on a new user account. Make a new user under Users & Groups and try running Peregrine from that account.
It is possible that there could be a localized corruption with your home account in MacOSX.

Report back after fully reading this post.

Hope all goes well!
 
Last edited:

Trevor

Well-known member
Joined
Jul 17, 2009
Messages
4,515
Points
113
Thanks for the help, S_l.

My semester is going to wrap up pretty soon. I have updated to the newest MacOS version and just update Java. I can still compile and run Peregrine without issue from Processing 2.0b7.

grainde, this issue may stem from you having a newer version of Java than the compiled version of Peregrine was intended for. I may have asked you this before, but have you tried opening the code in Processing and compiling it at runtime to maybe see if you're getting errors?

Controlp5, the library used to build the Peregrine interface, may also be causing problems.

We may need to switch to some sort of real datalogging app for Mac, as it seems that Java is more trouble than it is worth.

I really apologize for being so absent.

Trevor
 

Seoul_lasers

Well-known member
Joined
Jul 4, 2008
Messages
2,496
Points
83
Thanks for the help, S_l.

My semester is going to wrap up pretty soon. I have updated to the newest MacOS version and just update Java. I can still compile and run Peregrine without issue from Processing 2.0b7.

grainde, this issue may stem from you having a newer version of Java than the compiled version of Peregrine was intended for. I may have asked you this before, but have you tried opening the code in Processing and compiling it at runtime to maybe see if you're getting errors?

Controlp5, the library used to build the Peregrine interface, may also be causing problems.

We may need to switch to some sort of real datalogging app for Mac, as it seems that Java is more trouble than it is worth.

I really apologize for being so absent.

Trevor
Yes, I have tried this and I still get the occasional stability errors within Processing 2.1.2.
This morning I had Control p5 crash with over 30 errors and then run without any errors within 2-3 minutes apart of each other... odd
update, this morning I gave it another shot and have been able to run the Peregrine components inside the newest edition of Java 7 rev 58. I'll keep you posted as to what is going on. Apparently the new Version of processing runs
Control p5 v2.0.4 which is a little more stable.

Edit. I have successfully edited Peregrine for Mac and updated it with changes to the GUI. I've added more buffer around the text and given the window more room by increasing the window dimensions.
look below. I've also got the Control P5 running smoothly.
 

Attachments

Last edited:







Top