Install dependencies
cd ~/gaze_tracking
pip install -r requirements.txtCloning this into your ros2_ws/src:
git clone https://github.com/MaidReal/gaze_tracking.gitbuild this package:
colcon build --packages-select gaze_trackingsource the package:
source install/setup.bashros2 run gaze_tracking head_trackerNote
You don't have to subscribe to this node, it will automatically move the servo to the position
if the terminal displays something like: Cannot open camera lets just check that the camera is on the correct port.
[ WARN:0@1.015] global cap_v4l.cpp:914 open VIDEOIO(V4L2:/dev/video2): can't open camera by indexin home directory run:
ls /devsomething like:
acpi_thermal_rel i2c-2 loop31 ptp0 tty3 tty7 uinput
autofs i2c-3 loop32 pts tty30 tty8 urandom
block i2c-4 loop33 random tty31 tty9 userfaultfd
btrfs-control i2c-5 loop34 rfkill tty32 ttyprintk userio
bus i2c-6 loop35 rtc tty33 ttyS0 v4l
char i2c-7 loop36 rtc0 tty34 ttyS1 vcs
console i2c-8 loop4 shm tty35 ttyS10 vcs1
core i2c-9 loop5 snapshot tty36 ttyS11 vcs2
cpu initctl loop6 snd tty37 ttyS12 vcs3
cpu_dma_latency input loop7 stderr tty38 ttyS13 vcs4
cuse kmsg loop8 stdin tty39 ttyS14 vcs5
disk kvm loop9 stdout tty4 ttyS15 vcs6
dma_heap log loop-control tpm0 tty40 ttyS16 vcsa
dri loop0 mapper tpmrm0 tty41 ttyS17 vcsa1
drm_dp_aux0 loop1 mcelog tty tty42 ttyS18 vcsa2
drm_dp_aux1 loop10 media0 tty0 tty43 ttyS19 vcsa3
drm_dp_aux2 loop11 mei0 tty1 tty44 ttyS2 vcsa4
drm_dp_aux3 loop12 mem tty10 tty45 ttyS20 vcsa5
drm_dp_aux4 loop13 mqueue tty11 tty46 ttyS21 vcsa6
ecryptfs loop14 mtd tty12 tty47 ttyS22 vcsu
fb0 loop15 mtd0 tty13 tty48 ttyS23 vcsu1
fd loop16 mtd0ro tty14 tty49 ttyS24 vcsu2
full loop17 net tty15 tty5 ttyS25 vcsu3
fuse loop18 ng0n1 tty16 tty50 ttyS26 vcsu4
gpiochip0 loop19 null tty17 tty51 ttyS27 vcsu5
hidraw0 loop2 nvme0 tty18 tty52 ttyS28 vcsu6
hpet loop20 nvme0n1 tty19 tty53 ttyS29 vfio
hugepages loop21 nvme0n1p1 tty2 tty54 ttyS3 vga_arbiter
hwrng loop22 nvme0n1p2 tty20 tty55 ttyS30 vhci
i2c-0 loop23 nvme0n1p3 tty21 tty56 ttyS31 vhost-net
i2c-1 loop24 nvme0n1p4 tty22 tty57 ttyS4 vhost-vsock
i2c-10 loop25 nvme0n1p6 tty23 tty58 ttyS5 video0
i2c-11 loop26 nvme0n1p7 tty24 tty59 ttyS6 video1
i2c-12 loop27 nvram tty25 tty6 ttyS7 zero
i2c-13 loop28 port tty26 tty60 ttyS8 zfs
i2c-14 loop29 ppp tty27 tty61 ttyS9
i2c-15 loop3 psaux tty28 tty62 udmabuf
i2c-16 loop30 ptmx tty29 tty63 uhidWhat's important is video0,video1. If webcam is connected video2,video3 should show up.
in head_tracker.py go to line 21 or search for self.cap = cv2.VideoCapture(, depending on which video you want to use do 0 or 2
Just ensure that no other task is using the serial as well
https://github.com/JEOresearch/EyeTracker https://github.com/david-wb/gaze-estimation