2073 JeVois Tracking Code Suite Release

It is our pleasure to share with the community our JeVois tracking code suite for FRC.

During the off season in 2017, Team 2073 experimented with the JeVois Smart camera to determine if it would be a reasonable replacement for the Raspberry Pi 3 paired with a Lifecam HD-3000 that has been used for the last couple of seasons. It was quickly found that the JeVois was a very capable and powerful camera and more than met our expectations. So, we released this Whitepaper, which is included with the suite, and now we want to share our code with the community as well. Please take the time to follow the Whitepaper before implementing our code, you will have a better experience.

Our code will work with little to no changes, but we hope you will use it as a starting point for your system. Please feel free to share it, modify it, or just learn from it.
It is written in Python, but should be sufficiently easy to read that translating it to C++ should be simple.

[EDIT] When running EagleTrackCal, you will only be presented with a binary image. Use EagleTuner.py to adjust the filtering in EagleTrackCal to provide an image that is only comprised of white pixels representing your target.[/EDIT]

This looks pretty awesome. What framerate does EagleTracker.py run at?

I think I’m going to try to adapt this to work with Shuffleboard. Would be convenient to be able to calibrate this through the driver station dashboard and avoid having to run a separate calibration script and plug the JeVois into a laptop or something.

Edit: Is this capable of shape recognition, if discerning between multiple targets is necessary?

This looks super great, I know this will help my team and so many others that have been struggling with vision in the past. I have one question though, this is basically stand alone code right? It doesn’t need to be used in conjunction with GRIP or other separate software right?

Correct, for the most part.
Grip is not needed. That said, you will want to follow the whitepaper to get comfortable with where and how to access the code on JeVois. In addition, you will need to tune, or calibrate, the code. To do that, you will need to have a PC, Mac, or Linux/Ubuntu box that can run the python script that is used for tuning the color and shape recognition portion of the code.

I have no doubt more questions about this will come up about how to tune and/or tweak our code. That is what this thread is all about.

I may need the For Dummies Version but I have not had success getting your vision code to run.

I have added the EagleTrackCal and EagleTracker to my Jevois SD card in the location that was provided in the white paper.

I then updated the videomappings and initscript files on the Jevois SD card.

How to I get get your code to run? I thought it would start at startup due to the initscript, but only the default Jevois files show up when I stream through AMCap. if I use AMCap to try to change the output size to switch codes I cannot find one that seems to run EagleTracker just the preset Jevois files.

To run EagleTrackCal, AMCap needs to be set to MJPG, 320X240, 30fps. To run EagleTracker, MJPG, 320X240, 15fps.

You can get EagleTrkNoUSB to run on power up by uncommenting the last three lines in initscript.cfg. Just remember, if you do this, you will need to be able to issue a streamoff command to be able to access the sd card again.

Thanks that gets me at least video stream on AMCap with the EagleTracker and EagleTrackCal. I am not seeing anything come over the serial port so I’m not sure if I have a target yet. I am just using an Arduino IDE serial monitor. I tried to reset the serout to USB, but haven’t seen anything come across.

How do we access the GUI to adjust the target values?

Make sure you’re looking at EagleTracker (EagleTrackCal will not stream location parameters).

You will need to tune the code by running EagleTrackCal on the JeVois while running EagleTuner.py on an attached PC/Mac/Pi etc. EagleTuner sends tuning parameters to the JeVois over TTL or USB, just make sure to set the “Com Port” in EagleTuner.py to match your link.

Once you have run the two scripts and tuned the system, a file will be created on the JeVois that contains the calibration parameters. When you run EagleTracker, it will use the calibration parameters from that file.

You may wan to to direct which serial link to send the target data out with either

setpar serout Hard, setpar serout USB, or setpar serout Both

.

EagleTuner.py is accessed by running it from a command line.
Navigate to the folder where you have the script saved, then run:

python EagleTuner.py

Of course, this assumes the PC has python installed.

I get the following error.

SyntaxError: Missing parentheses in call to ‘print’

I’m assuming this is a Py2 Py3 issues. I have Py 3.6 installed and I have seen this issue before trying to run Py2 programs.

Good question. This was developed on a laptop running Python 2.7.12.

Was this while running EagleTuner.py?
If so, edit the script to meet the Python 3 requirements and post the results, please.

Yes, I was trying to run EagleTuner.py

It might take me a bit to update to Python 3 requirements. I can get the print function errors removed, but end up with serial errors. I’ve been trying to sort them out, but I am not much of a programmer. I’ll tinker a bit more but I might just go find a computer with Py 2.

Just an FYI, both 2.7 and 3 can be installed on the same machine. You will just have to set which is the default version.

The EagleTuner seemed to work when I went to Python 2.7.

I then got to where I could see that I was targeting an image, but I still do not see any serial data on my Arduino serial monitor. I am hooked to a computer rather than trying to go through the serial repeat. I have made sure the serout was set to usb and that I can communicate with the JeVois. The streamon command seems to throw an error. Any ideas why I get not serial output of the target location.

Thanks for verifying that Python 2.7 should be used. I will update the README.md to reflect that.
BTW, nicely tuned image you got there!

As for the targeting data streaming, please take a look at my post from 9:45PM PST yesterday.
EagleTrackCal does not stream target data. It is only used to calibrate the filters.
EagleTracker.py is used to vaidate the calibration is working and also streams the target location data.

Success!!! Thank you Mr. Bill.

Now to make it talk with the rio…