Frcvision vscode multicameraserver errors

I’m trying to use vscode on Win 8 to develop vision for raspberry pi. I’ve copied the java-multicameraserver example from the pi to windows using scp. However I can not figure out how to import it into vscode to work on it. I have opened the folder and it shows up but all of the import statements are not found.

I was able to develop using eclipse back in 2014 and have plenty of examples to try but do not know frcvscode well enough nor am I able to find examples or even how to debug these error messages.

For example:
import edu.wpi.cscore.MjpegServer;
The import edu can not be resolved.

and
import org.opencv.core.Mat;
The import org.opencv can not be resolved.

I have frcvscode installed on Win 8 and am able to develop , build, and deploy applications for the roborio.

Has anyone written a guide to doing so for vision for the Raspberry Pi? Or do I need to scrap vscode and go back to using eclipse?

Ok so I figured out that back in 2016 I had to change the CLASSPATH variable to run java vision code on the PC, and again when running the code on the pi. According to: https://github.com/redhat-developer/vscode-java/issues/346 there is a .classpath file that needs to be pointing to the jar files needed for vision. ie opencv and networktables jar files.

That explains why on the PC we get an error as the .classpath file in the vision code for the pi probably points to the jar files on the linux / pi system and not on the PC.

Slowly we’ll figure this out again.

Well I can not find NetworkTables.jar nor opencv-version.jar in the java-multiCameraServerApplication. The .classpath file has no kind=“lib” arguments in it. And searching for the files in Win 8 or on the pi result in nada.

Looks like the files must be built on demand using gradle? Which is another application I don’t know.

So how do we learn how to use gradle to compile opencv and ntcore? (Figured out that NetworkTables is now in ntcore). And do we also need all the other compnents used by the example application such as the google code, and hal?

I’ve never written a gradle wrapper or run gradle before. So I really don’t know what I’m doing. Just muddling along.

For me the eclipse version was much much simpler and straight forward. I’ll admit compiling opencv on the pi and on Windows back then was a challenge and I suspect that gradle must make that simpler. But I don’t know that for sure yet. Maybe tomorrow.

ntcore on github is over 2 years old and has a comment stating that ntcore is now part of allwpilib.

On the pi, changing to the root directory and using the command ‘sudo find . -name allwpilib -print’ results in ./usr/src/allwpilib ! Already installed on the pi. Well almost, commands to install are on the pi. We just need to know how to run them.

In that folder there is a README.md file telling us how to run gradlew. So we changed to that folder and tried to run ./gradlew :ntcore:build to build the ntcore.jar file. And we got the following errors:

:/usr/src/allwpilib$ ./gradlew :ntcore:build

Downloading https://services.gradle.org/distributions/gradle-6.0-bin.zip
…10%…20%…30%…40%…50%…60%…70%…80%…90%…100%

Welcome to Gradle 6.0!

Here are the highlights of this release:

  • Substantial improvements in dependency management, including
    • Publishing Gradle Module Metadata in addition to pom.xml
    • Advanced control of transitive versions
    • Support for optional features and dependencies
    • Rules to tweak published metadata
  • Support for Java 13
  • Faster incremental Java and Groovy compilation
  • New Zinc compiler for Scala
  • VS2019 support
  • Support for Gradle Enterprise plugin 3.0

For more details see Gradle 6.0 Release Notes

Starting a Gradle Daemon (subsequent builds will be faster)

FAILURE: Build failed with an exception.

  • What went wrong:
    Could not create service of type ScriptPluginFactory using BuildScopeServices.createScriptPluginFactory().

Could not create service of type CrossBuildFileHashCache using BuildSessionScopeServices.createCrossBuildFileHashCache().

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 1m 18s

Enough for tonight. And we have robotics in the morning so that will be it until Sunday. Maybe we need to specify compiling for pi processor. Or maybe we must run using sudo.

If we get this to work then we get to try and publish our jar file as a maven something or other. Lucky us we’ll get to figure out what maven is next. Might even have vision in time for this years competition. (Hah).

Oh; Forgot to tell you that we need an editor to open files on the pi and I tried to install gedit (which I use all the time) but couldn’t until I set the time correctly… Didn’t remember how but luckily we already posted that. ie rw[enter], followed by 'sudo date -s “Feg 21 22:32:00”[enter]’ Then sudo apt-get update and sudo apt-get install gedit works…

It’s really recommended to build on desktop rather than on the Pi itself. If you’re building on desktop, all the necessary .jar files are bundled into the java-multiCameraServer.zip file you download from the FRCVision web server (or from the releases page on GitHub). Just running gradlew build will build it.

There is no need to build wpilib from sources on the Pi. This is already done, and the built files are in /usr/local/frc.

Thank you that will help a lot. I assumed the libraries were already there but was unable to find them.

When we build on the PC will we know where the libraries are put? Also is the build on the PC to build code that runs on the PC or the Pi? And does the PC Build also compile opencv for the PC too?

Thanks

The build on the PC is a cross build targeting the Pi (well, since it’s Java, it’s not really a cross build… but in any case the jar it builds will run on the Pi). See the readme in the example .zip for where the resulting jar is put.

It does not build OpenCV for the PC side. If you get the right native libraries for the PC you could theoretically run the result on the PC, but this hasn’t been tested, and we don’t have instructions to get all the native libraries you will need to make this work.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.