got the infiray p2 pro thermal camera.
connected to PC it works like a webcam.
it recalibrates every 10s with an audible click, so i needed a way to turn it off when not in use.
i used uhubctl from https://github.com/m...raspberry-pi-4b
off:
sudo uhubctl -l 1-1 -a off sudo uhubctl -l 2 -a offall 4 usb are switched together, turning off the usb microphone meant restarting the vigibot client every time.
fortunately the 4B allows usb host on the "power in" type c, to which i connected the microphone to keep it powered. `otg_mode=1`
https://forums.raspb...ic.php?t=246348
wrote a script `vim thermal_power_manager.sh`:
#!/bin/bash                              
# Function to handle cleanup on SIGTERM
cleanup() {
    echo "Stopping FFmpeg process..."
    kill $ffmpeg_pid
    wait $ffmpeg_pid 2>/dev/null
    echo "Disabling power to USB hub and thermal camera..."
    uhubctl -l 1-1 -a 0 > /dev/null
    uhubctl -l 2 -a 0 > /dev/null
    exit 0
}
# Enable power to USB hub and thermal camera
echo "Enabling power to USB hub and thermal camera..."
uhubctl -l 1-1 -a 1 > /dev/null
uhubctl -l 2 -a 1 > /dev/null
# Start FFmpeg stream
sleep 2
echo "Starting FFmpeg stream..."
ffmpeg -loglevel warning -i /dev/video1 -c:v h264_omx -profile:v baseline -b:v 1500000 -flags:v +global_header -bsf:v dump_extra -f rawvideo -vf 'scale=640x480' tcp://127.0.0.1:8043 &
ffmpeg_pid=$!
# Trap SIGTERM signal and execute the cleanup function
trap cleanup SIGTERM SIGINT
# Wait for the FFmpeg process to finish
wait $ffmpeg_pid
# Disable USB hub power for thermal camera after ffmpeg exits
uhubctl -l 1-1 -a 0 > /dev/null
uhubctl -l 2 -a 0 > /dev/null
echo "Stream stopped and USB power disabled."
exit 0
compiled it `shc -f thermal_power_manager.sh`, `chmod +x thermal_power_manager.sh.x`and added to CMDDIFFUSION in /boot/robot.json
 1729602622182_firened_CakeOnIce.mp4   1,14 Mo
  50 téléchargement(s)
					
					
			
			
			
				







	
					

