===== Example programs =====
=== Camera slice ===
When $this has camera slice /slice/ {
Wish $this displays camera slice $slice
}
{{ notes:slice.gif?600 }}
=== Metrics ===
When $::thisNode has step count /c/ {
Wish $this is labelled [string trim "
Metrics
----
step count: $c
step time: $::stepTime
camera time: $::cameraTime
AprilTag time: $::aprilTime
display time: $::displayTime
"]
}
Wish $this is outlined skyblue
=== Points up ===
When $this points up at /target/ {
Wish $target is labelled "being pointed at"
}
=== Frame image ===
When the camera frame is /im/ {
Wish the web server handles route "/frame-image/$" with handler [list apply {{im} {
set filename "/tmp/web-image-frame.jpg"
image saveAsJpeg $im $filename
set fsize [file size $filename]
set fd [open $filename r]
fconfigure $fd -encoding binary -translation binary
set body [read $fd $fsize]
close $fd
dict create statusAndHeaders "HTTP/1.1 200 OK\nConnection: close\nContent-Type: image/jpeg\nContent-Length: $fsize\n\n" body $body
}} $im]
}