Go to Post You dont get paid based on your IQ, or how many things you have memorized, or what you can invent on your feet. You get paid for results. - KenWittlief [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 21-08-2013, 21:11
Pault's Avatar
Pault Pault is offline
Registered User
FRC #0246 (Overclocked)
Team Role: College Student
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Boston
Posts: 618
Pault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond repute
Using multiple programming languages via DLL

My team is currently considering having labVIEW as our main programming language, and using DLL in order to allow some parts of the robot to be programmed in Java. Is there any way that this could work? We have mentors with a lot of experience in LabVIEW who think it will work, but they have never worked with the wpilib so I am not sure that it will. Also, if its possible, will it cause a lot of trouble or will it be simple to implement?
  #2   Spotlight this post!  
Unread 21-08-2013, 21:16
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,751
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Using multiple programming languages via DLL

I don't see the point in making DLLs in Java, and as far as I know you cannot get Java to create a VxWork .out file. You can get LabVIEW to call a .out file, and you can create them using C tools. So if you wish to use two languages, I'd encourage LV and C++ instead of LV and Java. On the other hand, I don't think you'll find as many limitations in LV as you may think. Feel free to post detailed questions.

Greg McKaskle
  #3   Spotlight this post!  
Unread 21-08-2013, 21:51
Pault's Avatar
Pault Pault is offline
Registered User
FRC #0246 (Overclocked)
Team Role: College Student
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Boston
Posts: 618
Pault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond repute
Re: Using multiple programming languages via DLL

Quote:
Originally Posted by Greg McKaskle View Post
I don't see the point in making DLLs in Java, and as far as I know you cannot get Java to create a VxWork .out file. You can get LabVIEW to call a .out file, and you can create them using C tools. So if you wish to use two languages, I'd encourage LV and C++ instead of LV and Java. On the other hand, I don't think you'll find as many limitations in LV as you may think. Feel free to post detailed questions.

Greg McKaskle
Would there be any other way to use both Java and labVIEW on our robot (that wouldn't require an army of the world's best programmers and a 2 billion dollar grant from the government to figure it out).

Also, I don't want to get into the specifics of why we are considering doing this, but it has nothing to do with us thinking that LabVIEW is an inferior language to Java.
  #4   Spotlight this post!  
Unread 21-08-2013, 22:06
magnets's Avatar
magnets magnets is offline
Registered User
no team
 
Join Date: Jun 2013
Rookie Year: 2012
Location: United States
Posts: 748
magnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond repute
Re: Using multiple programming languages via DLL

A java program cannot run by itself or be called from LV because it requires a JVM to run. C++ is very similar to java, and like Greg McKaskle said, it can be use with labview.

Another alternative might be to use Java on the robot, and send data back and forth to a labview program running on the driver station laptop. This year, our team programmed the robot in Java, but we wrote our image processing code in Labview. On the driver station laptop we ran a labview program that grabbed a frame from the camera, did the image processing stuff, then sent the coordinates of the target back to the robot. This program also had a bunch of status indicators, as well as a bunch of tuning options and buttons which could control the robot if we didn't have a joystick.

The opposite is also possible, where you have a labview program running on the robot and a java program/extension of smartdashboard running on the laptop.

I'm having a hard time imagining a situation where both LabVIEW and Java are required and where C++ and LabVIEW wouldn't work. If you don't mind, could you explain what you are trying to accomplish? Somebody might know a way to do it in C++ instead of Java.
  #5   Spotlight this post!  
Unread 21-08-2013, 22:18
Pault's Avatar
Pault Pault is offline
Registered User
FRC #0246 (Overclocked)
Team Role: College Student
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Boston
Posts: 618
Pault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond repute
Re: Using multiple programming languages via DLL

Quote:
Originally Posted by magnets View Post
A java program cannot run by itself or be called from LV because it requires a JVM to run. C++ is very similar to java, and like Greg McKaskle said, it can be use with labview.

Another alternative might be to use Java on the robot, and send data back and forth to a labview program running on the driver station laptop. This year, our team programmed the robot in Java, but we wrote our image processing code in Labview. On the driver station laptop we ran a labview program that grabbed a frame from the camera, did the image processing stuff, then sent the coordinates of the target back to the robot. This program also had a bunch of status indicators, as well as a bunch of tuning options and buttons which could control the robot if we didn't have a joystick.

The opposite is also possible, where you have a labview program running on the robot and a java program/extension of smartdashboard running on the laptop.

I'm having a hard time imagining a situation where both LabVIEW and Java are required and where C++ and LabVIEW wouldn't work. If you don't mind, could you explain what you are trying to accomplish? Somebody might know a way to do it in C++ instead of Java.
The reason we want to do this is basically because a lot of us already learned how to program in Java/are going to take a course on it, but there are people who also want to get our team to use labVIEW. Rather than just throw all of our Java training out the window, we figured a good compromise would be to do this. Using C++ would kind of defeat the purpose. It would also be better for college application/resume building if we could say we knew both Java and LabVIEW.
  #6   Spotlight this post!  
Unread 21-08-2013, 23:31
topgun's Avatar
topgun topgun is offline
Registered User
FRC #2846 (FireBears)
Team Role: Mentor
 
Join Date: Oct 2008
Rookie Year: 2008
Location: Minnesota
Posts: 229
topgun has a brilliant futuretopgun has a brilliant futuretopgun has a brilliant futuretopgun has a brilliant futuretopgun has a brilliant futuretopgun has a brilliant futuretopgun has a brilliant futuretopgun has a brilliant futuretopgun has a brilliant futuretopgun has a brilliant futuretopgun has a brilliant future
Re: Using multiple programming languages via DLL

Why don't you have two teams, one java and one Labview? They can see who writes the better performing code, switch off between matches, etc. Competition between the teams will motivate them to learn more. Team 1816 does this (actually they have three teams (java, labview and C++)).

- Tom
__________________
-T

  #7   Spotlight this post!  
Unread 22-08-2013, 07:29
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,751
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Using multiple programming languages via DLL

It is also pretty easy to write robot code in one language and dashboard code in another.

Like many things in FIRST, this is a situation that you will see again, in the professional world. You guys probably need to experiment and figure it out. There isn't always a technical solution to the problem and/or it doesn't make sense to use all skills you have.

Greg McKaskle
  #8   Spotlight this post!  
Unread 23-08-2013, 14:01
Pault's Avatar
Pault Pault is offline
Registered User
FRC #0246 (Overclocked)
Team Role: College Student
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Boston
Posts: 618
Pault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond repute
Re: Using multiple programming languages via DLL

I just found out that it is actually possible to do this. The key is to call a C based DLL in LabVIEW, and then inside that DLL call a JNI. (I'm not sure if that makes sense; this article has a good explanation.) =

It seems like our team would be walking in uncharted teritory if we went through with this. Is there anybody else out the who has tried this in FRC. Also, can anybody see if it is even possible within FRC, because I still am not sure if the wpilib will get in the way. Also, I am not sure if it is possible to load the DLL and JNI onto the CRIO along with the LabVIEW code.
  #9   Spotlight this post!  
Unread 23-08-2013, 19:30
wireties's Avatar
wireties wireties is offline
Principal Engineer
AKA: Keith Buchanan
FRC #1296 (Full Metal Jackets)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2004
Location: Rockwall, TX
Posts: 1,170
wireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond repute
Send a message via AIM to wireties
Re: Using multiple programming languages via DLL

There is no such thing as a dynamically linked library (DLL) in VxWorks (the operating system on the robot). DLLs are a Windows thing. VxWorks does support .so style dynamic libraries in exactly the same format as Linux. But using dynamic libraries also requires the use of real-time processes (RTPs, which look much like processes and threads in Linux) in VxWorks. Wind River has never released a board support package (BSP) for the FIRST robots with RTPs included/enabled (that I know of). FIRST robots use tasks in kernel space with no RTP support (thus no .so support).

Does anyone know if the Java-enabled kernel we get from Wind River has the JNI libraries included?

TIA
__________________
Fast, cheap or working - pick any two!
  #10   Spotlight this post!  
Unread 23-08-2013, 23:41
MrRoboSteve MrRoboSteve is offline
Mentor
AKA: Steve Peterson
FRC #3081 (Kennedy RoboEagles)
Team Role: Mentor
 
Join Date: Mar 2012
Rookie Year: 2011
Location: Bloomington, MN
Posts: 577
MrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond repute
Re: Using multiple programming languages via DLL

Speaking as someone who has felt the pain, JNI integrations can be very crash prone if not well written.
__________________
2016-17 events: 10000 Lakes Regional, Northern Lights Regional, FTC Burnsville Qualifying Tournament

2011 - present · FRC 3081 Kennedy RoboEagles mentor
2013 - present · event volunteer at 10000 Lakes Regional, Northern Lights Regional, North Star Regional, Lake Superior Regional, Minnesota State Tournament, PNW District 4 Glacier Peak, MN FTC, CMP
http://twitter.com/MrRoboSteve · www.linkedin.com/in/speterson
  #11   Spotlight this post!  
Unread 24-08-2013, 06:43
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,751
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Using multiple programming languages via DLL

I didn't say this wasn't technically possible. I don't really advise doing it though.
It is sort of like you have a gasoline car and you are deciding to add a diesel engine to it. You aren't swapping to diesel, just adding the second engine in because you have it and half the mechanics are gas experienced and half diesel experiences.

If you are set on using both, the four slot has enough memory to run both, and you can run them side-by-side and communicate using network protocols or possibly even network tables. But you need to pick which one does the WPILib FPGA control. It will not work to do it in both.

Greg McKaskle
Closed Thread


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 03:05.

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