Help: Raspberry pi and GRIP

Hello reader,
I am struggling to use GRIP with the raspberry pi. I have my GRIP code downloaded. I used this tutorial to get my GRIP code running on the pi on startup: Raspberry Pi on GRIP tutorial. I was able to get the MJPG Streamer running successfully, and I can see images from the camera. The only problem is when I open Network Table Viewer, it only shows the root folder with no other subfolders. I am using a Microsoft webcam plugged in to the raspberry pi. I directly connect my raspberry pi to my computer for Ethernet and power. I am able to see the image on my computer; therefore, I know that my Ethernet connection works and that everything is receiving power. Please help!
Thanks,
Gal

Assuming you are using the NT viewer correctly (in client mode, pointed at the roboRIO) my first guess would be to change the IP of the NT server that GRIP is pointing at to be your roborio’s DNS/IP. This is in the tools tab->options menu.

If you can’t find a way to get GRIP to work on the Pi, you can try what we did. The GRIP installation instructions for the Pi weren’t figured out yet, so instead of trying to figure it out or wait for instructions, we went with OpenCv directly.

Here’s the install for Raspbian

Open CV Install (takes 4hrs to complete)

We then installed PyNetworkTables to communicate to DriverStation.

If you need to stream the image, we used mjpeg-streamer.

Our image processing code was written in Python. PyImageSearch.com has a but of help for Python & OpenCv.

PM me if you need more help.

Brian

Do you log into the pi and start up grip with ./vision/start_grip.sh? Do you see the program boot and run? In top do you see a java program running and using lots of cpu? If GRIP runs do you see it say that it connected to a server?

Hey there!
OpenCV is a better and more stable option. Since it’s already late in build season, you may not have time to write new code. You should be able to directly port your GRIP code into OpenCV. It will take some time to port but is definitely doable since OpenCV is the backbones for GRIP. Now if you want some code to sample or look at. I would recommend taking a look at Fauge7’s TowerTracker. Our team has been able to run it on a Pi. It is Java though and so you have to install the JDK and make it your default JDK in order to install the library properly. Or you can check out Team 2053’s TowerTracker C++ port, which is a direct port of Fauge7’s code but instead in the faster and more documented, C++.
If you need any help, feel free to PM :slight_smile:

Team 4678 was able to use grip on the Rpi 2. To get it working reliably, there were a few key things that needed to be done. We used the Rpi camera because it had almost no lag compared to the USB camera. mjpg-streamer was used to get the stream from the camera. The key here is to use -x 320 -y 240 in the execution of mjpg-streamer to make sure a 320 x 240 image is sent to grip. Sending a 640 x 480 image caused grip to crash and run slow. Also handy for mjpg-streamer was the -rot 90 option which allowed the image to be rotated after we mounted the pi camera at the wrong rotation. When it comes to grip, the 1.3.0 version started every time while the 1.2.0 version started most of the time but was not as reliable. We were able to just copy the 1.3.0 jar file on to the pi as grip.jar and it worked with the grip.project file that we created on the laptop using 1.2.0 and deployed to the pi. mjpg-streamer and grip are started up using systemd. We can provide more details if someone needs them for start on boot. At the competition, in order to work with the FMS, we did need to give the pi a static ip address. It did not seem to be able to use dhcp services to get an address that would allow it to talk to the roborio using network tables. Raspbian Jessie doesn’t do static IP like we were used to. It’s easiest using the gui through startx then right-click on the network icon to set a static IP. The other method is to edit /etc/dhcpcd.conf. Editing /etc/network/interfaces won’t get you to far. We used the static IP 10.46.78.15 and had no problems getting the Rpi to talk to the roborio using the host name roborio-4678-frc.local in the grip configuration.

Are you sure that I am using the roboRIO’s information? I thought that the raspberry pi doesn’t know the existence of the roboRIO and vice versa; I thought that the pi publishes to Network Tables, and the RIO picks it up.

Please correct me if I am wrong.

Network Tables works in a Client / Server architecture. The RoboRio is the server and other applications operate as clients.

I thought that as well too, but you set up the roboRIO as the server and the raspberry pi as the client. Also, I tried using roboRIO-2053-frc.local as the ip to connect to, but that didnt work that often, so I just switched to static IP’s everywhere. We had no connection issues at competition.

Hello people,
Thank you for your help.
I was trying to test my code, since the roborio is in the bag. How do you think I should test it? Do I need a router?

Do you have a spare roboRIO? If so, set that up and get basic code running. If not, then you might be able to set up the network tables viewer as a server and set your pc as the ip on the raspberry pi side. You probably need a switch for this for the connection to work. I’ve never done it this way. This is my best guess as I’ve always had a spare robot.

I don’t have a spare robo rio, so if anyone has done this without a roborio, please tell me how you did it. Thanks.

You can test Network Tables without a RoboRIO you just need a Network Tables server. Luckily, the Outline Viewer application has the option to run as a Network Tables server.

https://wpilib.screenstepslive.com/s/4485/m/13503/l/144981-2016-frc-software-component-overview#OutlineViewer

The outline viewer jar file lives in the wpilib folder in your home directory.
If you are on windows that is C:\Users<username>\wpilib