|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
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
|
|||
|
|||
|
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
|
||||
|
||||
|
Re: Using multiple programming languages via DLL
Quote:
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
|
||||
|
||||
|
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
|
||||
|
||||
|
Re: Using multiple programming languages via DLL
Quote:
|
|
#6
|
||||
|
||||
|
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 |
|
#7
|
|||
|
|||
|
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
|
||||
|
||||
|
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
|
||||
|
||||
|
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 |
|
#10
|
|||
|
|||
|
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.
|
|
#11
|
|||
|
|||
|
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 |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|