RomanLut / hx-esp32-cam-fpv

esp32 cam digital low latency fpv
MIT License
56 stars 9 forks source link

Cannot compile ground station #2

Closed geofrancis closed 3 months ago

geofrancis commented 5 months ago

when trying to build the ground station it always errors at imgui, no such file or directory. I tried the original jeanlemotan ground station and it runs so its something with your version.

what version of raspi OS are you using?

Successfully installed Cython-0.29.37 PySDL2-0.9.16 cocos2d-0.6.10 glfw-2.7.0 imgui-2.0.0 pyglet-1.5.28 pi@ESP32FPV:/esp32-cam-fpv/gs $ make -j4 g++ -MT .o/src/main.o -MD -MP -MF .d/src/main.Td -std=c++17 sdl2-config --cflags -O3 -DNDEBUG -ffast-math -funroll-loops -Wall -Isrc -Isrc/utils -I../components/common -I/usr/include/ -I/usr/include/freetype2 -Isrc/imgui/ -Isrc/imgui//backends -DIMGUI_IMPL_OPENGL_ES2 -c -o .o/src/main.o src/main.cpp g++ -MT .o/src/HUD.o -MD -MP -MF .d/src/HUD.Td -std=c++17 sdl2-config --cflags -O3 -DNDEBUG -ffast-math -funroll-loops -Wall -Isrc -Isrc/utils -I../components/common -I/usr/include/ -I/usr/include/freetype2 -Isrc/imgui/ -Isrc/imgui//backends -DIMGUI_IMPL_OPENGL_ES2 -c -o .o/src/HUD.o src/HUD.cpp g++ -MT .o/src/PI_HAL.o -MD -MP -MF .d/src/PI_HAL.Td -std=c++17 sdl2-config --cflags -O3 -DNDEBUG -ffast-math -funroll-loops -Wall -Isrc -Isrc/utils -I../components/common -I/usr/include/ -I/usr/include/freetype2 -Isrc/imgui/ -Isrc/imgui//backends -DIMGUI_IMPL_OPENGL_ES2 -c -o .o/src/PI_HAL.o src/PI_HAL.cpp g++ -MT .o/src/Comms.o -MD -MP -MF .d/src/Comms.Td -std=c++17 sdl2-config --cflags -O3 -DNDEBUG -ffast-math -funroll-loops -Wall -Isrc -Isrc/utils -I../components/common -I/usr/include/ -I/usr/include/freetype2 -Isrc/imgui/ -Isrc/imgui//backends -DIMGUI_IMPL_OPENGL_ES2 -c -o .o/src/Comms.o src/Comms.cpp In file included from src/PI_HAL.h:3, from src/PI_HAL.cpp:1: src/IHAL.h:3:10: fatal error: imgui.h: No such file or directory 3 | #include "imgui.h" | ^~~~~ compilation terminated. make: [Makefile:131: .o/src/PI_HAL.o] Error 1 make: Waiting for unfinished jobs.... In file included from src/HUD.cpp:2: src/IHAL.h:3:10: fatal error: imgui.h: No such file or directory 3 | #include "imgui.h" | ^~~~~ compilation terminated. make: [Makefile:131: .o/src/HUD.o] Error 1 In file included from src/main.cpp:14: src/IHAL.h:3:10: fatal error: imgui.h: No such file or directory 3 | #include "imgui.h" | ^~~~~ compilation terminated. make: [Makefile:131: .o/src/main.o] Error 1 src/Comms.cpp: In member function ‘void Comms::process_rx_packets()’: src/Comms.cpp:1103:14: warning: unused variable ‘coding_n’ [-Wunused-variable] 1103 | uint32_t coding_n = m_rx_descriptor.coding_n; | ^~~~ src/Comms.cpp: At global scope: src/Comms.cpp:34:16: warning: ‘IEEE_HEADER’ defined but not used [-Wunused-variable] 34 | static uint8_t IEEE_HEADER[] = | ^~~ mv -f .d/src/Comms.Td .d/src/Comms.d pi@ESP32FPV:~/esp32-cam-fpv/gs $

RomanLut commented 5 months ago

I am using 5.10.103-v7+ but this error is not related to os version:

src/IHAL.h:3:10: fatal error: imgui.h: No such file or directory

You have to fetch dependent mgui repository:

git submodule update --init --recursive git pull

geofrancis commented 5 months ago

that got me this

geo@ESP32FPV:~/esp32-cam-fpv/gs $ git submodule update --init --recursive Submodule 'components/esp32-camera' (https://github.com/RomanLut/esp32-camera.git) registered for path '../components/esp32-camera' Submodule 'gs/src/imgui' (https://github.com/ocornut/imgui.git) registered for path 'src/imgui' Cloning into '/home/geo/esp32-cam-fpv/components/esp32-camera'... Cloning into '/home/geo/esp32-cam-fpv/gs/src/imgui'... fatal: remote error: upload-pack: not our ref 9a808e5a935bac8ef6e8ab4d3241ea6d176c06f4 Fetched in submodule path '../components/esp32-camera', but it did not contain 9a808e5a935bac8ef6e8ab4d3241ea6d176c06f4. Direct fetching of that commit failed.

geo@ESP32FPV:~/esp32-cam-fpv/gs $ git pull hint: Pulling without specifying how to reconcile divergent branches is hint: discouraged. You can squelch this message by running one of the following hint: commands sometime before your next pull: hint: hint: git config pull.rebase false # merge (the default strategy) hint: git config pull.rebase true # rebase hint: git config pull.ff only # fast-forward only hint: hint: You can replace "git config" with "git config --global" to set a default hint: preference for all repositories. You can also pass --rebase, --no-rebase, hint: or --ff-only on the command line to override the configured default per hint: invocation. Already up to date.

and im still getting the same errors.

RomanLut commented 5 months ago

Fixed repo references, please try again.

geofrancis commented 5 months ago

its compiled but its not starting, I have 3 adapters, the onboard as wlan0 and 2x ar9271 adapters as specified in the original instructions set as wlan1 and wlan2, I assume you have changed the card setup for a pi without onboard wifi?

geo@ESP32FPV:~/esp32-cam-fpv/gs $ sudo -E DISPLAY=:0 ./gs width:1280 height:720 (I) src/Comms.cpp: 722: Radiocap header size: 11, IEEE header size: 24 (I) src/Comms.cpp: 582: Opening interface wlan0mon in monitor mode (E) src/Comms.cpp: 627: Error in pcap_activate: That device doesn't support monitor mode

RomanLut commented 5 months ago

1) With built-in wifi/nexmon drivers and 2db dipole, I have range ~20m

2) On the field I am using single rtl8812au card with wfb-ng drivers https://github.com/svpcom/rtl8812au

3) I am starting it like this:

cd /home/pi/esp32-cam-fpv
cd gs
sudo airmon-ng check kill
sudo ip link set wlan1 down
sudo iw dev wlan1 set type monitor
sudo ip link set wlan1 up
sudo ./gs -fullscreen 1 -sm 1 -rx wlan1 -tx wlan1
geofrancis commented 5 months ago

Its working! im running into the issue here: https://github.com/jeanlemotan/esp32-cam-fpv/issues/40#issuecomment-1578830862

but im right next to an access point so I will test outside to see if it improves.

Screenshot 2024-04-05 165154

geofrancis commented 5 months ago

is there an easy way of getting it to run on startup? having to connect a keyboard and mouse when out testing isnt ideal.

RomanLut commented 5 months ago

1) I am using bluetooth mouse 2) Create .sh script with lines above and add it to autostart: https://learn.sparkfun.com/tutorials/how-to-run-a-raspberry-pi-program-on-startup/method-2-autostart

geofrancis commented 5 months ago

does dual adapter diversity work? I have ordered the same adapter you are using for the ground station so i can replicate your setup.

Does this have an OSD? could the one from wifibroadcast be used if we have a mavlink telemetry connection?

geofrancis commented 4 months ago

this is the install instructions im using. sudo apt-get update sudo apt-get upgrade sudo apt install libdrm-dev libgbm-dev libgles2-mesa-dev libpcap-dev libturbojpeg0-dev libts-dev libsdl2-dev libfreetype6-dev git clone https://github.com/RomanLut/esp32-cam-fpv.git cd ./esp32-cam-fpv/gs git submodule update --init --recursive git pull make -j4

sudo nano /home/pi/fpv.sh

add

!/bin/bash

echo "ESP32-FPV STARTUP" cd /home/pi/esp32-cam-fpv cd gs sudo airmon-ng check kill sudo ip link set wlan1 down sudo iw dev wlan1 set type monitor sudo ip link set wlan1 up sudo ./gs -fullscreen 1 -sm 1 -rx wlan1 -tx wlan1

I cant get the REALTEK drivers to install, the instructions on svpcom aren't very clear. how did you install them ?

RomanLut commented 4 months ago

Currently I do not remember how I installed it, I checked my old notes and found: "svpcom driver does not work, https://github.com/morrownr/8812au-20210629 works"

geofrancis commented 4 months ago

managed to get it installed with this

sudo apt update && sudo apt upgrade sudo apt install -y raspberrypi-kernel-headers build-essential bc dkms git mkdir -p ~/src cd ~/src git clone https://github.com/morrownr/8812au-20210629.git cd ~/src/8812au-20210629 sudo ./install-driver.sh

if you get the error "Your kernel header files aren't properly installed. Please consult your distro documentation or user support forums" when using a 32bit OS then you need to add " arm_64bit=0" in the /boot/config.txt and run install-driver again.

geofrancis commented 4 months ago

I had to install the aircrack tools for monitor mode to work correctly but its now working super smooth with the realtek adapter, the signal was really bad on the ar9271 I never realised til I have seen how much better the RSSI is on the realtek.

sudo apt update && sudo apt upgrade sudo apt install libdrm-dev libgbm-dev libgles2-mesa-dev libpcap-dev libturbojpeg0-dev libts-dev libsdl2-dev libfreetype6-dev sudo apt-get install -y aircrack-ng sudo apt-get install dkms sudo apt install -y raspberrypi-kernel-headers build-essential bc dkms git

mkdir -p ~/src cd ~/src git clone https://github.com/morrownr/8812au-20210629.git cd ~/src/8812au-20210629 sudo ./install-driver.sh

config = NO restart = YES

git clone https://github.com/RomanLut/esp32-cam-fpv.git cd ./esp32-cam-fpv/gs git submodule update --init --recursive make -j4

sudo nano /home/pi/fpv.sh

!/bin/bash

echo "ESP32-FPV STARTUP" cd /home/pi/esp32-cam-fpv cd gs sudo airmon-ng check kill sudo ip link set wlan1 down sudo iw dev wlan1 set type monitor sudo ip link set wlan1 up sudo ./gs -fullscreen 1 -sm 1 -rx wlan1 -tx wlan1

save

sudo chmod +x /home/pi/fpv.sh

mkdir /home/pi/.config/autostart nano /home/pi/.config/autostart/fpv.desktop

[Desktop Entry] Type=Application Name=FPV
Exec=/usr/bin/bash /home/pi/fpv.sh

save

now runs on startup

geofrancis commented 4 months ago

I have been trying to get an OSD to work but they are all made for the older gpu the pi 3 has so I haven't been able to get anything to even start on my pi 4. https://github.com/svpcom/wfb-ng-osd

now that I think about it, it already has an osd but its only displaying video information, could mavlink data be added to that? it only needs voltage, altitude, speed and mode to be useful.

RomanLut commented 4 months ago

Well I was going to implement MSP Displayport OSD, but it will take a some time, probably a month. I am not activelly working on this project currently.

geofrancis commented 4 months ago

Thats cool, ardupilot can do MSP. It will give me some time to test some hardware and get the basics tested. I have it fitted to a plane and the booster has arrived so il hopefully get some range testing done soon.

The pi ground station is really sensitive to voltage, when my usb battery bank starts getting low the picture starts to drop out.

RomanLut commented 3 months ago

what is the current process for installing the groundstation?

Please use release branch and this instruction https://github.com/RomanLut/esp32-cam-fpv/blob/master/doc/building_gs_image.md

Air unit pinout is here https://github.com/RomanLut/esp32-cam-fpv?tab=readme-ov-file#air-unit

Now it looks more like a product.

Mavlink RC and DisplayportMSP OSD do work.

There is no OSD for GPIO joystick yet, but REC keys do work and joystick left/right changes resolution.

geofrancis commented 3 months ago

im following the install process and its erroring at "cd esp32-cam-fpv" saying no folder when Adding GPIO keys support, I think the GPIO support needs to be added after the gcs has been downloaded.

RomanLut commented 3 months ago

Thanks, fixed guide.

geofrancis commented 3 months ago

the method you used to run automatically on startup doesnt work, I reused my method and it started ok

mkdir /home/pi/.config/ mkdir /home/pi/.config/autostart nano /home/pi/.config/autostart/fpv.desktop

[Desktop Entry]
Type=Application
Name=FPV
Exec=/usr/bin/bash /home/pi/esp32-cam-fpv/gs/launch.sh

save

geofrancis commented 3 months ago

im having a slight issue where it wont start when connected to my 1280x800 monitor but it starts when connected to my USB HDMI capture. I tried to change the settings using raspi-config but the resolution setting wont show up when selected it just goes back to the menu.

20240518_000951

RomanLut commented 3 months ago

I guess it fails because it can not set 1280x720 resolution. Please try adding -w 1280 -h 800 to gs command line:https://github.com/RomanLut/esp32-cam-fpv/blob/fd70638ed10efec0b8fdd9faf8e61d49eec45f03/gs/launch.sh#L12

RomanLut commented 3 months ago

Release branch updated, closes resolution is selected automatically, Closing this thread because issues are solved.