summaryrefslogtreecommitdiffstats
path: root/virtual-programs
diff options
context:
space:
mode:
authorOmar Rizwan <omar@omar.website>2023-09-14 05:10:28 +0000
committerOmar Rizwan <omar@omar.website>2023-09-14 05:10:28 +0000
commit795766ab15131b5de9b752501ae7bb5d4ebe58fa (patch)
tree37c555e135c9afbb409a9d445b294f8e537ef7d6 /virtual-programs
parentMerge pull request #82 from FolkComputer/ac/better-shapes-sept-2023 (diff)
downloadfolk-795766ab15131b5de9b752501ae7bb5d4ebe58fa.tar.gz
folk-795766ab15131b5de9b752501ae7bb5d4ebe58fa.zip
Faster (global var sampling, not reactive) metrics
Diffstat (limited to 'virtual-programs')
-rw-r--r--virtual-programs/apriltags.folk4
-rw-r--r--virtual-programs/archive/metrics.folk8
-rw-r--r--virtual-programs/camera.folk4
-rw-r--r--virtual-programs/display.folk7
4 files changed, 14 insertions, 9 deletions
diff --git a/virtual-programs/apriltags.folk b/virtual-programs/apriltags.folk
index ac2c4f8b..8bdd415a 100644
--- a/virtual-programs/apriltags.folk
+++ b/virtual-programs/apriltags.folk
@@ -114,6 +114,7 @@ On process {
set ::tagsCache [dict create]
# TODO: Garbage-collect this cache.
+set ::aprilTime none
When the collected matches for [list /someone/ detects tags /tags/ at /timestamp/ in time /aprilTime/] are /matches/ {
set tagsSeen [dict create]
foreach match $matches {
@@ -136,5 +137,6 @@ When the collected matches for [list /someone/ detects tags /tags/ at /timestamp
Claim tag $id has center [dict get $tag center] size [dict get $tag size]
Claim tag $id has corners [dict get $tag corners]
}
- Claim the AprilTag time is [lmap m $matches {dict get $m aprilTime}]
+ set ::aprilTime [lmap m $matches {dict get $m aprilTime}]
+ Claim the AprilTag time is $::aprilTime
}
diff --git a/virtual-programs/archive/metrics.folk b/virtual-programs/archive/metrics.folk
index fe6baebd..e5389512 100644
--- a/virtual-programs/archive/metrics.folk
+++ b/virtual-programs/archive/metrics.folk
@@ -1,13 +1,13 @@
-When $::thisNode has step count /c/ & the camera time is /cameraTime/ & the AprilTag time is /aprilTime/ {
+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: $::Display::displayTime
+camera time: $::cameraTime
+AprilTag time: $::aprilTime
+display time: $::displayTime
"]
}
diff --git a/virtual-programs/camera.folk b/virtual-programs/camera.folk
index 0a95c8f0..428c4195 100644
--- a/virtual-programs/camera.folk
+++ b/virtual-programs/camera.folk
@@ -29,6 +29,10 @@ On process {
}
}
+set ::cameraTime none
+When the camera time is /cameraTime/ {
+ set ::cameraTime $cameraTime
+}
# For backward compatibility.
When the camera frame is /grayFrame/ at /timestamp/ {
Claim the camera frame is $grayFrame
diff --git a/virtual-programs/display.folk b/virtual-programs/display.folk
index d3f6b610..75ad5cf1 100644
--- a/virtual-programs/display.folk
+++ b/virtual-programs/display.folk
@@ -35,8 +35,6 @@ namespace eval ::Display {
proc fillPolygon args {
uplevel [list Wish display runs [list Display::fillPolygon {*}$args] on layer $::Display::LAYER]
}
-
- variable displayTime none
}
On process {
@@ -87,7 +85,8 @@ On process {
Step
}
}
-# TODO: remove this compatibility hack
+
+set ::displayTime none
When the display time is /displayTime/ {
- set ::Display::displayTime $displayTime
+ set ::displayTime $displayTime
}