Go to Post You will find we are more talkative in about 5 1/2 weeks. ;) - mrnoble [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rating: Thread Rating: 4 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 11-01-2012, 21:19
Ginto8's Avatar
Ginto8 Ginto8 is offline
Programming Lead
AKA: Joe Doyle
FRC #2729 (Storm)
Team Role: Programmer
 
Join Date: Oct 2010
Rookie Year: 2010
Location: Marlton, NJ
Posts: 174
Ginto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of light
Question C++/Java code embedding?

I was wondering if it's possible to write some C++ code for the robot, and then interface with it through Java. I'd like to know because it seems to me that WPILibJ's NIVision class is pitifully lacking (no edge detection, no convex hull, etc.) and I'd like to be able to use some of its functionality in custom code. Even if interacting with NIVision through the C++ code would be impractical or impossible, it would be equally good if I could write my own custom algorithms that would be either extremely clunky to write in Java (2 words: no pointers), or would be too slow running in a VM. I know NIVision uses JNA to bind the IMAQ functions; would it be possible to use JNA to bind my own functions as well? If so, how?
Reply With Quote
  #2   Spotlight this post!  
Unread 12-01-2012, 08:38
derekwhite's Avatar
derekwhite derekwhite is offline
Java Virtual Machine Hacker
no team (FIRST@Oracle)
Team Role: Programmer
 
Join Date: May 2009
Rookie Year: 2009
Location: Burlington, MA
Posts: 127
derekwhite is on a distinguished road
Re: C++/Java code embedding?

It should be possible to add new C code and call it from Java. You'd have to use workbench to create a new kernel module, made sure that the module had C bindings (if you're using C++), install the module, get it loaded at startup, and call it from Java using JNA, just like the WPILibJ code does.

That's a fine and interesting project, but if your goal is to call image processing functions like IMAQ provides, it would be simpler to add the JNA code to call the IMAQ function you need.
Reply With Quote
  #3   Spotlight this post!  
Unread 12-01-2012, 22:46
shoffing's Avatar
shoffing shoffing is offline
WINriver C++
AKA: Steve Hoffing
FRC #1647
Team Role: Programmer
 
Join Date: Feb 2009
Rookie Year: 2008
Location: Shamong, New Jersey, America
Posts: 10
shoffing is an unknown quantity at this point
Re: C++/Java code embedding?

Quote:
Originally Posted by derekwhite View Post
...it would be simpler to add the JNA code to call the IMAQ function you need.
Can you go into more detail, please? How is this done?
__________________
---
Team 1647's Software "thing" for 2011
Death-Spin autonomous mode is my favorite.
Reply With Quote
  #4   Spotlight this post!  
Unread 15-01-2012, 03:31
Ziv Ziv is offline
Has code to be writing...
FRC #0125 (Nutrons)
Team Role: Alumni
 
Join Date: Mar 2010
Rookie Year: 2009
Location: Boston
Posts: 39
Ziv is a glorious beacon of lightZiv is a glorious beacon of lightZiv is a glorious beacon of lightZiv is a glorious beacon of lightZiv is a glorious beacon of light
Re: C++/Java code embedding?

I'm in the same boat. After some searching I found this class, which is relevant for Java users. (Thanks to Team 1203 for hosting the Javadoc online.) I haven't had much time to look through it yet, but it looks like a bunch of useful analysis can be done with the MeasureParticle method; check out all the options in the MeasurementType class. I don't know if the whole NIVision library is wrapped, but there's far more material than there was last year.

This class should probably be mentioned more prominently somewhere in the documentation... or maybe I'm just bad at looking for things .

EDIT: This is more of a response to the previous post than to the OP. Basically, it looks like a bunch of useful vision processing functions are easily accessible with Java; it's only if you want to provide your own C code that you need to mess around with JNA.

Last edited by Ziv : 15-01-2012 at 03:37.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 22:22.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi