stephendade / Rpanion-server

Web-based configurator for companion computers of MAVLink vehicles
https://www.docs.rpanion.com/software/rpanion-server
GNU General Public License v3.0
143 stars 62 forks source link

Video: Camera didn't show on WebGUI sometimes #233

Closed lida2003 closed 4 months ago

lida2003 commented 4 months ago

Can't find the camera, but it's there!!!

From https://github.com/stephendade/Rpanion-server/issues/223#issuecomment-2153745873

1. Can't find the camera, but it's there!!! (branch - I420Pi)

图片

2. two boot logs (VPN: Better Zerotier online detection, 2cf0809432db19cb88f4291b570195ac4add902d )

daniel@rpanion:~/Rpanion-server $ cat logs/app.log
2024-06-07 09:34:46 info [server/index.js]: NTRIP stopped
2024-06-07 09:34:46 info [server/index.js]: Express server is running on localhost:3000
2024-06-07 09:34:47 info [server/index.js]: Opening Link /dev/ttyUSB0 @ 921600, MAV v2
2024-06-07 09:34:47 info [server/index.js]: Opened Router
2024-06-07 09:34:47 info [mavlink/mavManager.js]: Vehicle is S/C: 1/1
2024-06-07 09:34:47 info [mavlink/mavManager.js]: 4.5.2-official
2024-06-07 09:39:23 info [server/index.js]: [{"value": "/base/soc/i2c0mux/i2c@1/ov5647@36", "label": "CSI Port Camera (ov5647)", "caps": [{"value": "1920x1080xx-raw", "label": "1920x1080", "height": 1080, "width": 1920, "format": "video/x-raw", "fpsmax": "30", "fps": []}, {"value": "1640x922xx-raw", "label": "1640x922", "height": 922, "width": 1640, "format": "video/x-raw", "fpsmax": "40", "fps": []}, {"value": "1280x720xx-raw", "label": "1280x720", "height": 720, "width": 1280, "format": "video/x-raw", "fpsmax": "60", "fps": []}, {"value": "640x480xx-raw", "label": "640x480", "height": 480, "width": 640, "format": "video/x-raw", "fpsmax": "90", "fps": []}]}, {"value": "testsrc", "label": "Test Source", "caps": [{"value": "1920x1080xx-raw", "label": "1920x1080", "height": 1080, "width": 1920, "format": "video/x-raw", "fpsmax": "30", "fps": []}, {"value": "1280x720xx-raw", "label": "1280x720", "height": 720, "width": 1280, "format": "video/x-raw", "fpsmax": "30", "fps": []}, {"value": "640x480xx-raw", "label": "640x480", "height": 480, "width": 640, "format": "video/x-raw", "fpsmax": "30", "fps": []}]}]

2024-06-07 09:39:23 info [server/index.js]: [object Object],[object Object]
2024-06-07 09:39:17 info [server/index.js]: NTRIP stopped
2024-06-07 09:39:17 info [server/index.js]: Express server is running on localhost:3000
2024-06-07 09:39:17 info [server/index.js]: Opening Link /dev/ttyUSB0 @ 921600, MAV v2
2024-06-07 09:39:17 info [server/index.js]: Opened Router
2024-06-07 09:39:18 info [mavlink/mavManager.js]: Vehicle is S/C: 1/1
2024-06-07 09:39:19 info [mavlink/mavManager.js]: 4.5.2-official
2024-06-07 09:59:02 info [server/index.js]: Trying to reconnect FC...
2024-06-07 09:59:02 info [server/index.js]: Trying to close router
2024-06-07 09:59:02 info [server/index.js]: Opening Link /dev/ttyUSB0 @ 921600, MAV v2
2024-06-07 09:59:02 info [server/index.js]: Opened Router
2024-06-07 09:59:02 info [server/index.js]: Closed Router
2024-06-07 09:59:03 info [mavlink/mavManager.js]: Vehicle is S/C: 1/1
2024-06-07 09:59:03 info [mavlink/mavManager.js]: 4.5.2-official
2024-06-07 10:00:21 info [server/index.js]: [{"value": "testsrc", "label": "Test Source", "caps": [{"value": "1920x1080xx-raw", "label": "1920x1080", "height": 1080, "width": 1920, "format": "video/x-raw", "fpsmax": "30", "fps": []}, {"value": "1280x720xx-raw", "label": "1280x720", "height": 720, "width": 1280, "format": "video/x-raw", "fpsmax": "30", "fps": []}, {"value": "640x480xx-raw", "label": "640x480", "height": 480, "width": 640, "format": "video/x-raw", "fpsmax": "30", "fps": []}]}]

2024-06-07 10:00:21 info [server/index.js]: [object Object]
daniel@rpanion:~/Rpanion-server $ libcamera-hello --list-camera
Available cameras
-----------------
0 : ov5647 [2592x1944] (/base/soc/i2c0mux/i2c@1/ov5647@36)
    Modes: 'SGBRG10_CSI2P' : 640x480 [58.92 fps - (16, 0)/2560x1920 crop]
                             1296x972 [43.25 fps - (0, 0)/2592x1944 crop]
                             1920x1080 [30.62 fps - (348, 434)/1928x1080 crop]
                             2592x1944 [15.63 fps - (0, 0)/2592x1944 crop]

3. steps of the test (branch - I420Pi)

  1. remove app.log
  2. reboot the device
  3. check libcamera, cam device is there
  4. check reboot log
  5. refresh WebGUI
  6. cat log, then there is no ov5647
daniel@rpanion:~/Rpanion-server $ rm logs/app.log
daniel@rpanion:~/Rpanion-server $ sudo reboot
login as: daniel
daniel@192.168.235.73's password:
Linux rpanion 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr  3 17:24:16 BST 2023 aarch64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Fri Jun  7 11:13:38 2024 from 192.168.235.140
daniel@rpanion:~ $ libcamera-hello --list-camera
Available cameras
-----------------
0 : ov5647 [2592x1944] (/base/soc/i2c0mux/i2c@1/ov5647@36)
    Modes: 'SGBRG10_CSI2P' : 640x480 [58.92 fps - (16, 0)/2560x1920 crop]
                             1296x972 [43.25 fps - (0, 0)/2592x1944 crop]
                             1920x1080 [30.62 fps - (348, 434)/1928x1080 crop]
                             2592x1944 [15.63 fps - (0, 0)/2592x1944 crop]

daniel@rpanion:~ $ cd Rpanion-server
daniel@rpanion:~/Rpanion-server $ cat logs/app.log
2024-06-07 11:14:28 info [server/index.js]: NTRIP stopped
2024-06-07 11:14:28 info [server/index.js]: Express server is running on localhost:3000
2024-06-07 11:14:28 info [server/index.js]: Opening Link /dev/ttyUSB0 @ 921600, MAV v2
2024-06-07 11:14:28 info [server/index.js]: Opened Router
2024-06-07 11:14:29 info [mavlink/mavManager.js]: Vehicle is S/C: 1/1
2024-06-07 11:14:29 info [mavlink/mavManager.js]: 4.5.2-official
daniel@rpanion:~/Rpanion-server $ cat logs/app.log
2024-06-07 11:14:28 info [server/index.js]: NTRIP stopped
2024-06-07 11:14:28 info [server/index.js]: Express server is running on localhost:3000
2024-06-07 11:14:28 info [server/index.js]: Opening Link /dev/ttyUSB0 @ 921600, MAV v2
2024-06-07 11:14:28 info [server/index.js]: Opened Router
2024-06-07 11:14:29 info [mavlink/mavManager.js]: Vehicle is S/C: 1/1
2024-06-07 11:14:29 info [mavlink/mavManager.js]: 4.5.2-official
2024-06-07 11:19:17 info [server/index.js]: [{"value": "testsrc", "label": "Test Source", "caps": [{"value": "1920x1080xx-raw", "label": "1920x1080", "height": 1080, "width": 1920, "format": "video/x-raw", "fpsmax": "30", "fps": []}, {"value": "1280x720xx-raw", "label": "1280x720", "height": 720, "width": 1280, "format": "video/x-raw", "fpsmax": "30", "fps": []}, {"value": "640x480xx-raw", "label": "640x480", "height": 480, "width": 640, "format": "video/x-raw", "fpsmax": "30", "fps": []}]}]

2024-06-07 11:19:17 info [server/index.js]: [object Object]
lida2003 commented 4 months ago

When GUI didn't show camera device, libcamera-hello/libcamera-vid worked fine.

$ libcamera-hello --list-camera
Available cameras
-----------------
0 : ov5647 [2592x1944] (/base/soc/i2c0mux/i2c@1/ov5647@36)
    Modes: 'SGBRG10_CSI2P' : 640x480 [58.92 fps - (16, 0)/2560x1920 crop]
                             1296x972 [43.25 fps - (0, 0)/2592x1944 crop]
                             1920x1080 [30.62 fps - (348, 434)/1928x1080 crop]
                             2592x1944 [15.63 fps - (0, 0)/2592x1944 crop]
$ libcamera-vid -t 0 -n --inline -o - | gst-launch-1.0 fdsrc fd=0 ! h264parse ! rtph264pay ! udpsink host=192.168.235.166 port=5600

daniel@rpanion:~/Rpanion-server $ git log -n 1
commit daba5a36bc361e8ddc4afe8c368b665898251d01 (HEAD -> I420Pi, origin/I420Pi)
Author: Stephen Dade <stephen_dade@hotmail.com>
Date:   Thu Jun 6 20:41:51 2024 +1000

    Video: Change to I420 format for Pi cam
daniel@rpanion:~/Rpanion-server $ git branch -a
* I420Pi
  lida2003
  master
  remotes/origin/HEAD -> origin/master
  remotes/origin/I420Pi
  remotes/origin/master
  remotes/origin/rb5support
  remotes/origin/zttunnel
daniel@rpanion:~/Rpanion-server $ git status
On branch I420Pi
Your branch is up to date with 'origin/I420Pi'.

nothing to commit, working tree clean
lida2003 commented 4 months ago

Duplicate of https://github.com/stephendade/Rpanion-server/issues/234