Welcome, Guest. Please Login.
Surveyor Corporation Surveyor SRV-1
Home Help Search Login

Surveyor Robotics Forum

Welcome to the user support forum for Surveyor SRV-1 robots, SRV-1 robot controllers and SVS stereo vision systems. To register for this forum, please send an email to support@surveyor.com which includes your desired forum user name, your registration email address, and a brief explanation of why you wish to join, and we will create a forum account for you.

Please note that there is a Search button in the forum toolbar for forum topics. Another effective search method for the entire surveyor.com site is to use Google, e.g. "xyz site://www.surveyor.com" where "xyz" is the search topic.



Pages: 1 
Send Topic Print
modifying the java console (Read 17735 times)
dlb04001
YaBB Newbies
*




Posts: 10
modifying the java console
03/28/08 at 12:21pm
 
I am trying to add a button to the existing java console for the SRV-1 that would send a command to get RSSI information from a node.  
 
I downloaded the java file but I am a little lost within the code. I have experience with coding in C++ and some experience with Java.  
 
I would first like to figure out how to add a button, compile the new code, and run it. Then I would like to try to figure out how to send out the command for RSSI information.  
 
Could someone point me in the right direction please?  
 
Thanks
Back to top
 
 
  IP Logged
admin
YaBB Administrator
*****




Posts: 3606
Re: modifying the java console
Reply #1 - 03/28/08 at 12:34pm
 
The buttons for SRV1Console are defined in srv.config, with the button graphics stored in buttons/ .  It's easy enough to add a button and the corresponding hex code that is sent to the robot, but I don't know an easy way to extract the return message and display it in the console.  You would probably have better luck doing this from the Python-based pySRV1Console
Back to top
 
 

SRV-1 Development Team
Surveyor Corporation
Email WWW   IP Logged
atl03001
YaBB Newbies
*




Posts: 26
Re: modifying the java console
Reply #2 - 04/15/08 at 9:55pm
 
Hey guys,  
 
I am trying to revise the console using Eclipse as my java compiler.  
 
I copied and pasted the code from site into a java file named SRV1Console.java
 
Additionally, put that file in the following dir: "C:\com\surveyor\" because I figured that's the only way the compiler would make sense of the "import com.surveyor.wstreamd.*;" line in the code.  
 
I also included the ImageButton.class, RXTXcomm.jar, wstreamd_embed.jar, and the SRV1Console.java in that folder as well.  
 
I figured I could do that instead of running "javac -classpath .:ImageButton:RXTXcomm.jar:wstreamd_embed.jar: SRV1Console.java" from the command prompt.  
 
This unfortunately does not work... the compiler can not find the gnu.io package nor can it find the com.surveyor.wmstreamd package (it gives me errors at those two lines plus others because of those at run-time).  
 
The lines of code I am referring to are:  
 
     import gnu.io.*;
 
     import com.surveyor.wstreamd.*;
 
Can someone help me please! I am getting very frustrated... I am running this on WinXP with the newest JDK installed. Another note, I decided to just extract the SRV1Console.zip contents into the same folder with my java file so that I could cover all bases.  
 
Thanks in advance.
Back to top
 
 
  IP Logged
admin
YaBB Administrator
*****




Posts: 3606
Re: modifying the java console
Reply #3 - 04/15/08 at 11:50pm
 
Rather than copying files into another directory, just run javac in the directory that has all of the SRV1Console files.
Back to top
 
 

SRV-1 Development Team
Surveyor Corporation
Email WWW   IP Logged
atl03001
YaBB Newbies
*




Posts: 26
Re: modifying the java console
Reply #4 - 04/16/08 at 8:47am
 
Thanks.  
 
I actually tried that too with no luck. I get approximately 26 errors at run-time.  
 
I'm asking this question out of confusion... but why would I need to run javac instead? How does that differ from what I'm trying to do?  
 
Thanks again.
Back to top
 
 
  IP Logged
admin
YaBB Administrator
*****




Posts: 3606
Re: modifying the java console
Reply #5 - 04/16/08 at 8:49am
 
I've only compiled directly with javac, and haven't used Ant or Eclipse, so I don't know what the issues there might be.  However, I've run javac from the 1.5 SDK on Windows, Linux and OS/X without problem.
 
Back to top
 
 

SRV-1 Development Team
Surveyor Corporation
Email WWW   IP Logged
atl03001
YaBB Newbies
*




Posts: 26
Re: modifying the java console
Reply #6 - 04/16/08 at 4:56pm
 
I tried compiling directly with javac again and it's still giving me trouble. I extracted all of the files from the console zip file and added the SRV1Console.java file into the same folder. I ran javac from the same directory with all of my files still with no luck.  
 
I have no clue what I could be doing that is wrong.  
 
I still get the same errors that I got before and even when I tried my own method, which was copying the files in my own directory with the SRV1Console.java file and trying to compile the java file through a Windows-based compiler e.g. Eclipse.  
 
I get 26 errors at run-time.  
 
I'm having trouble with the gnu.io package and the com.surveyor.wstreamd package. I'm almost 90% positive that this is where the problem is.  
 
Any ideas? Anything that I should try? Or anything that I'm missing?
Back to top
 
 
  IP Logged
admin
YaBB Administrator
*****




Posts: 3606
Re: modifying the java console
Reply #7 - 04/16/08 at 5:20pm
 
What version of the Java SDK are you running ?  Maybe it's a version problem.
Back to top
 
 

SRV-1 Development Team
Surveyor Corporation
Email WWW   IP Logged
atl03001
YaBB Newbies
*




Posts: 26
Re: modifying the java console
Reply #8 - 04/16/08 at 5:38pm
 
jdk1.6
Back to top
 
 
  IP Logged
admin
YaBB Administrator
*****




Posts: 3606
Re: modifying the java console
Reply #9 - 04/16/08 at 6:02pm
 
That might be the issue - I've only used 1.4 or 1.5.  There should be a way in javac to compile to an earlier version, though I don't recall the syntax.
 
Back to top
 
« Last Edit: 04/16/08 at 6:03pm by admin »  

SRV-1 Development Team
Surveyor Corporation
Email WWW   IP Logged
atl03001
YaBB Newbies
*




Posts: 26
Re: modifying the java console
Reply #10 - 04/18/08 at 10:28am
 
Okay,  
 
So I actually got it to compile finally. Thanks for all of your help. I'm still using the newest version of JDK... it's 1.6. What I did to get it to compile was converted the ImageButton.class file to a jar file instead and added it my project path... this was all for compiling it on an XP machine through Eclipse as my compiler.  
 
How do I get it to open up in a window? because so far all it does is compiles and tells me that it's trying to connect to the serial port or whatnot in the compilers console. I was hoping it would compile and run it as an app (more or less).  
 
Additionally, I want to modify the console in a way where I can have one half of the window display what is being captured by the camera and the other half I want to have a display showing the nodes wireless signal strength and a display (graphical display) of how far the node actually is from the base (the PC). This display can track the node as well so it will displaying it's position in real-time.  
 
Any ideas or suggestions? Any code already written that is similar to this?  
 
Thanks so much.
Back to top
 
 
  IP Logged
admin
YaBB Administrator
*****




Posts: 3606
Re: modifying the java console
Reply #11 - 04/18/08 at 11:39am
 
It should compile as an app which is launched as follows -
 
    java -cp .:ImageButton:RXTXcomm.jar:wstreamd_embed.jar: SRV1Console
 
If running windows, change the colons to semicolons
 
Also, check what comm port is defined in srv.config - it may be trying to connect to the wrong port.
 
There's some code to use the 'vs' scan() function to overlay a graphic on the display window - you might use that as a starting point.
Back to top
 
« Last Edit: 04/18/08 at 11:40am by admin »  

SRV-1 Development Team
Surveyor Corporation
Email WWW   IP Logged
atl03001
YaBB Newbies
*




Posts: 26
Re: modifying the java console
Reply #12 - 04/18/08 at 1:10pm
 
Okay... now what about doing it through the compiler though?
Back to top
 
 
  IP Logged
admin
YaBB Administrator
*****




Posts: 3606
Re: modifying the java console
Reply #13 - 04/18/08 at 2:33pm
 
I don't think I understand the issue.  It only compiles as an app.  For some reason, from your description, the app starts to load and then freezes.  Honestly, I'll go back to installing a 1.5 SDK, because I don't know what is causing these problems.
Back to top
 
 

SRV-1 Development Team
Surveyor Corporation
Email WWW   IP Logged
atl03001
YaBB Newbies
*




Posts: 26
Re: modifying the java console
Reply #14 - 04/25/08 at 10:57am
 
It's just been giving me some problems. I couldn't get the Console to display once it was compiled. But, I recently got it to work though.  
 
The other problem that I ran into now though was it that I couldn't get the console to load fully.  
 
The last time that I tried it, the buttons were not put up on the console; so it just looked like the console with no buttons below the video output window.  
 
I am not sure if there something not working in the method that reads the "srv.config" file or the getButtonPanel method.  
 
Any ideas?
Back to top
 
 
  IP Logged
admin
YaBB Administrator
*****




Posts: 3606
Re: modifying the java console
Reply #15 - 04/25/08 at 12:03pm
 
Could you list the contents of your srv.config for the comm setup at the end of the file ?  They should look something like this -  
 
comport=COM4
button.columns=6
wcs.server=localhost
wcs.port=8888
wcs.pass=srv
wcs.camID=1.jpeg
Back to top
 
 

SRV-1 Development Team
Surveyor Corporation
Email WWW   IP Logged
atl03001
YaBB Newbies
*




Posts: 26
Re: modifying the java console
Reply #16 - 04/25/08 at 1:02pm
 
When I don't include the srv.config file in my directory I get the console to show up without the buttons on the console.  
 
But, when I add the srv.config file to the workspace I get the following errors:  
 
Exception in thread "main" java.lang.NoClassDefFoundError: ImageButton$ImageButtonMouseListener
     at ImageButton.<init>(ImageButton.java:26)
     at SRV1Console.getButtonPanel(SRV1Console.java:522)
     at SRV1Console.init(SRV1Console.java:298)
     at SRV1Console.main(SRV1Console.java:143)
 
So I guess that when it tries to read the srv.config file it tries to create the buttons but since from the start, I've been having issues with the ImageButton class files.  
 
If I can get those files in a text format so that I can add them myself I think that might fix my problem.
Back to top
 
 
  IP Logged
atl03001
YaBB Newbies
*




Posts: 26
Re: modifying the java console
Reply #17 - 04/25/08 at 1:05pm
 
comport=COM1
button.columns=6
wcs.server=localhost
wcs.port=8888
wcs.pass=srv
wcs.camID=1.jpeg
network.srv.host=192.168.0.15
network.srv.port=10001
 
So it's  pretty similar.  
 
I just can't get the buttons to load. And I haven't included my config file yet. I'm still just trying all the packaged files first just to see if I can get it to run, but no luck.
Back to top
 
 
  IP Logged
admin
YaBB Administrator
*****




Posts: 3606
Re: modifying the java console
Reply #18 - 04/25/08 at 1:15pm
 
COM1 is probably the wrong port.  I'm not near a Windows system at the moment, but you should be able to use the control panel to find out which comm port is the right one - if you can view the system setup and look at the hardware manager for USB devices.  That could be causing the problem you describe.
 
Also, make certain when you unzipped SRV1Console.zip that all of the subdirectories were created (applet, buttons, archives and htdocs)
 
Back to top
 
 

SRV-1 Development Team
Surveyor Corporation
Email WWW   IP Logged
atl03001
YaBB Newbies
*




Posts: 26
Re: modifying the java console
Reply #19 - 04/25/08 at 2:10pm
 
No the port is right, I just checked. I really do  not think it is that.  
 
From the errors I get, and the way I get the errors, I am pretty sure it is coming from those ImageClass files. I have all the files in my workspace, all the folders, etc.  
 
I honestly think that if I can get the imageclass files  
 
e.g:
ImageButton.class
ImageButton$ImageButtonDisableFilter.class
ImageButton$ImageButtonMouseListener.class
ImageButton$ImageButtonMouseMotionListener.class
 
if I can get them in a text format so that I can create them and include them in my workspace myself, that it might work.  
 
Because, again, if you look at the errors that I got before, they all stem from the imagebutton classes.  
 
Thanks
Back to top
 
 
  IP Logged
atl03001
YaBB Newbies
*




Posts: 26
Re: modifying the java console
Reply #20 - 04/25/08 at 2:37pm
 
Okay,  
 
Guess what?  
 
I got the ImageButton.class file sent to me as a java file. I added it to my workspace.  
 
Added my own srv.config file to the workspace.  
 
Ran it.  
 
And I have no errors, and a running/working console with my own button configurations.  
 
Thanks!
Back to top
 
 
  IP Logged
admin
YaBB Administrator
*****




Posts: 3606
Re: modifying the java console
Reply #21 - 04/25/08 at 2:55pm
 
Glad to hear that solved the problem.  I just updated http://www.surveyor.com/blackfin/SRV1Console.zip to include the ImageButton.java source file, in case anyone else needs access to it.
Back to top
 
 

SRV-1 Development Team
Surveyor Corporation
Email WWW   IP Logged
atl03001
YaBB Newbies
*




Posts: 26
Re: modifying the java console
Reply #22 - 04/26/08 at 3:01pm
 
Well now that I have that working, I am now trying to make a few modifications to the console.  
 
I added a text field to the left of the camera display - where I will output temperature from a temp sensor mounted on the node. I might also display signal strength, etc. in the field as well.  
 
What would be the easiest way to do this?  
 
Thanks
Back to top
 
 
  IP Logged
admin
YaBB Administrator
*****




Posts: 3606
Re: modifying the java console
Reply #23 - 04/27/08 at 8:04am
 
Sorry - I'm not a Java programmer.  However, from a system perspective, since you're modifying the robot firmware to support this, maybe the easiest approach would be to add the RSSI and temp information to the JPEG header, and then extract it on the java console side as you're processing the incoming video frame.
Back to top
 
 

SRV-1 Development Team
Surveyor Corporation
Email WWW   IP Logged
atl03001
YaBB Newbies
*




Posts: 26
Re: modifying the java console
Reply #24 - 04/27/08 at 1:51pm
 
Where is the data coming in from in the java code?
Back to top
 
 
  IP Logged
admin
YaBB Administrator
*****




Posts: 3606
Re: modifying the java console
Reply #25 - 04/27/08 at 2:04pm
 
There's a timer that sends out the 'I' command periodically
Back to top
 
 

SRV-1 Development Team
Surveyor Corporation
Email WWW   IP Logged
atl03001
YaBB Newbies
*




Posts: 26
Re: modifying the java console
Reply #26 - 04/27/08 at 4:36pm
 
I'm looking for the array where all the data would be stored to. Do you have any idea what it's called?  
 
How about the methods that I should look for?  
 
Thanks
Back to top
 
 
  IP Logged
admin
YaBB Administrator
*****




Posts: 3606
Re: modifying the java console
Reply #27 - 04/27/08 at 4:48pm
 
Look for readLoop().  The contents of the incoming header are compared to frameHeader[]
Back to top
 
 

SRV-1 Development Team
Surveyor Corporation
Email WWW   IP Logged
Pages: 1 
Send Topic Print