You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So, I have a Chevrolet Volt, which has pretty poor vision to the front.
I wanted to be able to switch camera's when I need to park.
I copied the cam_overlay folder and changed the names of the folder and bin file to some thing with rearcam and frontcam.
I made these overlays.
Frontcam overlay
Rearcam overlay
Illustration of the buttons the script makes
Bash Script
#!/bin/bash
device='/dev/input/event0'
coord_x_check='*type 3 (EV_ABS), code 0 (ABS_X), value*'
coord_y_check='*type 3 (EV_ABS), code 1 (ABS_Y), value*'
running_cam=1
echo "Rearcam activated on default"
~/rearcam_overlay/bin/rearcam.bin -d /dev/v4l/by-id/usb-ARKMICRO_USB2.0_PC_CAMERA-video-index0 &
sudo evtest "$device" | while read line; do
case $line in
($coord_x_check) x=$(echo $line | awk -F value '{ print $2 }' | tr -dc '0-9');;
($coord_y_check) y=$(echo $line | awk -F value '{ print $2 }' | tr -dc '0-9')
if (( $x>=1920 && $y<=850 && $running_cam==1 ));
then
echo Rearcam deactivated
killall -wq rearcam.bin &
echo Frontcam activated X $x Y $y
~/frontcam_overlay/bin/frontcam.bin -d /dev/v4l/by-id/usb-ARKMICRO_USB2.0_PC_CAMERA-video-index0 &
running_cam=2
sleep 1
elif (( $x>=1920 && $y<=850 && $running_cam==2 ));
then
echo Frontcam is running allready
elif (( $x<=1919 && $y<=850 && $running_cam==2 ));
then
echo Frontcam deactivated
killall -wq frontcam.bin &
echo Rearcam activated X $x Y $y
~/cam_overlay/bin/rearcam.bin -d /dev/v4l/by-id/usb-ARKMICRO_USB2.0_PC_CAMERA-video-index0 &
running_cam=1
sleep 1
elif (( $x<=1919 && $y<=850 && $running_cam==1 ));
then
echo Rearcam is running allready
elif (( $y>850 && $running_cam==1 ));
then
echo Camview deactivated X $x Y $y
killall -wq rearcam.bin
killall -wq test-2.sh
exit 1
elif (( $y>850 && $running_cam==2 ));
then
echo Camview deactivated X $x Y $y
killall frontcam.bin &
killall camview.sh #this script
exit 1
fi
;;
esac
sleep 0.1
done
You should find out using evtest what the min X & Y values and max X & Y values are. Also check where you like to have the buttons and check the values. Use them in this script.
The text was updated successfully, but these errors were encountered:
So, I have a Chevrolet Volt, which has pretty poor vision to the front.
I wanted to be able to switch camera's when I need to park.
I copied the cam_overlay folder and changed the names of the folder and bin file to some thing with rearcam and frontcam.
I made these overlays.
Frontcam overlay
Rearcam overlay
Illustration of the buttons the script makes
Bash Script
You should find out using evtest what the min X & Y values and max X & Y values are. Also check where you like to have the buttons and check the values. Use them in this script.
The text was updated successfully, but these errors were encountered: