30 lines
888 B
Bash
30 lines
888 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
initial_gain=0
|
||
|
initial_exposure_time=0
|
||
|
|
||
|
while true; do sleep 0.5;
|
||
|
# Read center camera controls
|
||
|
echo `v4l2-ctl -d /dev/video1 --get-ctrl=gain --get-ctrl=exposure` > controls
|
||
|
awk '{print $2}' controls > get_control
|
||
|
actual_gain=`cat get_control`
|
||
|
awk '{print $4}' controls > get_control
|
||
|
actual_exposure_time=`cat get_control`
|
||
|
|
||
|
# Print controls
|
||
|
#echo -e "\n**Center Camera Controls**"
|
||
|
#cat controls
|
||
|
# Remove temp files
|
||
|
rm controls get_control
|
||
|
# Set R/L camera controls manually
|
||
|
if [ $actual_gain -ne $initial_gain ]; then
|
||
|
v4l2-ctl -d /dev/video0 --set-ctrl=gain=$actual_gain
|
||
|
fi
|
||
|
if [ $actual_exposure_time -ne $initial_exposure_time ]; then
|
||
|
v4l2-ctl -d /dev/video0 --set-ctrl=exposure=$actual_exposure_time
|
||
|
fi
|
||
|
# Define new initial value
|
||
|
initial_gain=$actual_gain
|
||
|
initial_exposure_time=$actual_exposure_time
|
||
|
done
|