Robotics
LeRobot
English
lelab
so-100
imitation-learning
education
act
diffusion-policy
smolvla
gr00t
van-i's picture
Imitation learning test stand write-up
c68846b verified
Raw History Blame Contribute Delete
984 Bytes
#!/usr/bin/env bash
# Re-apply camera settings for the stand (they reset when a camera is replugged).
# Cameras are found by USB port, so this works even if /dev/videoN numbers shift.
set -euo pipefail
declare -A PORTS=( [left]=3-12 [right]=3-11 [grip]=3-13.1 )
find_dev() { # print the /dev/videoN capture node for a USB port
for d in /sys/class/video4linux/video*; do
[[ "$(basename "$(readlink -f "$d/device")")" == "$1:1.0" ]] || continue
[[ "$(cat "$d/index")" == 0 ]] && { echo "/dev/$(basename "$d")"; return; }
done
}
for name in left grip right; do
dev=$(find_dev "${PORTS[$name]}")
[[ -n "$dev" ]] || { echo "$name: not found on USB ${PORTS[$name]}" >&2; continue; }
v4l2-ctl -d "$dev" -c power_line_frequency=2 # 60 Hz mains
if [[ $name == grip ]]; then
v4l2-ctl -d "$dev" -c brightness=-16 -c backlight_compensation=0 # stop jaws blowing out
fi
echo "$name -> $dev ($(cat /sys/class/video4linux/$(basename "$dev")/name))"
done