PhotonVision / photonvision

PhotonVision is the free, fast, and easy-to-use computer vision solution for the FIRST Robotics Competition.
https://photonvision.org
GNU General Public License v3.0
264 stars 183 forks source link

Support for Orange Pi 5 Pro #1315

Closed grahamgraham closed 1 month ago

grahamgraham commented 5 months ago

Is your feature request related to a problem? Please describe. None of the current images work with the newly release Orange Pi 5 Pro. I got my hands on an OPI 5 Pro, and neither the 5 nor the 5 plus images will work (it does not boot). The linux and ubuntu images on OPI's website for the 5 Pro do boot.

Describe the solution you'd like A release of Photon Vision for the Orange Pi 5 Pro

Describe alternatives you've considered I've considered (and will attempt) using the "Other Debian-Based Co-Processor Install", but boot times with OPI's default image aren't super conducive for FIRST competitions.

srimanachanta commented 5 months ago

Take a look at this instead of the default image: https://www.armbian.com/orangepi-5/

grahamgraham commented 5 months ago

Armbian allows me to boot into it, but there's other issues (unable to detect ethernet interface).

Does that mean if Armbian works, the current release of PV for OPI 5 should work?

srimanachanta commented 5 months ago

Armbian's image is significantly faster for booting than Orange Pi's original image which would solve that issue. You would then need to install PV on that following the docs you sent. This would be temporary until a first class image could be made. Based on Armbian's build, a device-tree might be present regardless of board type in the image so we might be able to adapt our current image-gen with that in mind

grahamgraham commented 5 months ago

Ok, that makes sense. There's still ethernet issues with the Armbian images out there, but I am happy to report that the OPI 5 Pro bookworm server build that's provided on OPI's site is working well with PhotonVision.

Please let me know if you need a tester for the OPI 5 Pro's first class image.

srimanachanta commented 5 months ago

Upon further investigation, the upstream image provider actually does have an image for OPi5-Pro found here. This is the image we use for all our image builds. Run this script to actually install and setup PV but know that this hasn't been tested on the OPi5 Pro by the PV dev team.

Edited to link the server version instead of desktop.

grahamgraham commented 5 months ago

Out of curiosity, I see that that image is a desktop image. When PV releases an approved version, is the build typically CLI or desktop?

srimanachanta commented 5 months ago

Out of curiosity, I see that that image is a desktop image. When PV releases an approved version, is the build typically CLI or desktop?

Server, so command line only. Also, use this instead for the server version.

crschardt commented 5 months ago

With 24.04 you may also have to install gcc or else photonvision will crash at startup.

roberttuttle commented 4 months ago

We tried upstream 24.04 (2.0.0) server image linked above for a new Orange Pi 5 Pro we received and it failed to boot (kernel panic) ... so it doesn't appear stable yet.

In an alternate path for the near-term, we went down the path of using the official Ubuntu 24.04 / Jammy image from the Orange Pi downloads and then ran through the PV image install steps. PV working correctly with our OV9281 cams for AprilTags at that point, BUT, object detection pipeline (RKNN) not offered as an option in the pipeline list. (We have cams for both AprilTags and Object Detection for this season's robot).

I dug into the Ubuntu/OPi5 image and found that all the required libs for RKNN were in place and working outside PV.

I then dug into the PV code and logs and found that the object detection feature being offered was dependent on the platform detection successfully parsing the model name from the device tree with "Orange Pi 5". Unfortunately, the Orange Pi 5 Pro image has a compiled device tree model name of "RK3588S Opi 5 Pro" which of course doesn't match the string comparison in the PV Java code here: https://github.com/PhotonVision/photonvision/blob/00c2a257305c421231d150587ffb7c65fb963742/photon-core/src/main/java/org/photonvision/common/hardware/Platform.java#L217

As a local fix without offering a PV code fix via PR, I was able to edit the device tree model name using the native device-tree-compiler tool with the command: sudo fdtput -t s /boot/dtb/rockchip/rk3588s-orangepi-5-pro.dtb / model "RK3588S Orange Pi 5 Pro" (followed by a reboot)

After reboot, PV correctly matched the platform and allowed object detection pipeline to show up (and work successfully with Crescendo notes out of the box).

Obviously, longer term fix is to update PV code to support whatever official Orange PI 5 Pro device tree model name is supplied for the board/images.

grahamgraham commented 4 months ago

We tried upstream 24.04 (2.0.0) server image linked above for a new Orange Pi 5 Pro we received and it failed to boot (kernel panic) ... so it doesn't appear stable yet.

Funny enough, I was able to get that server image to boot without issue. However, PV wouldn't install properly. I ended up using the OPi 5 Pro server release that's on OPi's site. For offseason it will work well enough for testing.

I'm stoked because this is a much nicer solution than our Limelight 2+, and way cheaper than the LL3G.

srimanachanta commented 4 months ago

Happy to hear that worked, you might want to try installing dietpi onto orange pi's image in order to clean it up, I'm not sure how much it will reduce boot times though.

grahamgraham commented 4 months ago

Ah, that's a great idea. I'll give that a shot!

crschardt commented 2 months ago

There is a new image available which supports the OrangePi5 Pro. Please download the correct image from https://github.com/PhotonVision/photon-image-modifier/releases/tag/Dev and let me know if it works.

grahamgraham commented 2 months ago

There is a new image available which supports the OrangePi5 Pro. Please download the correct image from https://github.com/PhotonVision/photon-image-modifier/releases/tag/Dev and let me know if it works.

Appears to be working so far. image Version is reported as v2024.3.1, which I do not see as previous version, so I assume that's the Dev version?

If that's the case, I will be working on getting this installed to the eMMC

crschardt commented 2 months ago

@grahamgraham - thank you for testing. 2024.3.1 is the current release of Photonvision, not to be confused with the development image version.

grahamgraham commented 2 months ago

@crschardt I double checked the file, redownloaded, and reflashed. I'm using the "photonvision_opi5pro.img.xz" and it is still showing 2024.3.1.

Any thoughts?

mcm001 commented 2 months ago

The fact that your pi boots at all is sufficient - the JAR is swapped out downstream of this.

grahamgraham commented 2 months ago

The fact that your pi boots at all is sufficient - the JAR is swapped out downstream of this.

Good deal. With that said, I've also installed it on the eMMC and have been running it using 2 cameras without issues. Thanks for everybody's help on this!

roberttuttle commented 1 month ago

Not sure if this issue is just with the Pro image or all OPi images, but SSH (port 22) is not open/available. Only the web app port (5800) is open. Being able to SSH into the coprocessor for lower-level debugging is sometimes necessary.

UPDATE: I do see that ssh is enabled for RPi images, so assume this is not a general PhotonVision convention for images (to disable SSH access). re: https://github.com/PhotonVision/photon-image-modifier/blob/master/install_pi.sh

crschardt commented 1 month ago

SSH works fine on the OrangePi5 image and should be enabled on the other images. I don't have a 5 Pro to test, but you could download the base image that we use: https://github.com/Joshua-Riek/ubuntu-rockchip/releases/download/v2.3.0/ubuntu-22.04-preinstalled-server-arm64-orangepi-5-pro.img.xz and check that ssh is working on that image.

roberttuttle commented 1 month ago

@crschardt ... ok, tested with the latest base image for OPi 5 Pro. SSH access working. Reflashed to the latest PV dev image again and ssh is also working this time. I think what happened the first time is that I changed the PV settings to a static IP using the web interface before I attempted SSH access and something got jacked up where the underlying Ubuntu started giving connection refused errors on both the new IP address static assigned and the first one allocated through DHCP. It was weird as the PV web interface on 5800 worked just fine but SSH connections were refused on port 22. Tried rebooting several times to reset the network on the OPi and still no go. Working now ... obviously not a core issue with the base image or the PV image modified config. Just some weird sequence it got put into that messed up SSH somehow.

crschardt commented 1 month ago

Good to hear. Since we have confirmation from a couple people that it's working, I'm going to close this. Please open a new issue if you come across any other problems.