commit 8d5b0f35f32f748455b25cbd06394806496bbf7c parent 597b07f1f936a5cf84b5e1af55d799e3819b109b Author: Ivan Gankevich <i.gankevich@spbu.ru> Date: Sat, 17 Apr 2021 22:29:16 +0300 Merge remote-tracking branch 'refs/remotes/origin/master' into master Diffstat:
25 files changed, 127 insertions(+), 0 deletions(-)
diff --git a/samples/hold-peak-import b/samples/hold-peak-import @@ -0,0 +1,13 @@ +#!/bin/sh +db=hold-peak.sqlite3 +sqlite3 $db << 'EOF' +CREATE TABLE IF NOT EXISTS hold_peak_samples (timestamp INTEGER, speed FLOAT) +EOF + +tmp=$(mktemp) +for i in hold-peak/*.dat +do + sed 's/ /|/g' "$i" +done > $tmp +sqlite3 $db ".import $tmp hold_peak_samples" +rm $tmp diff --git a/samples/hold-peak.sqlite3 b/samples/hold-peak.sqlite3 @@ -0,0 +1 @@ +../.git/annex/objects/jf/45/SHA256E-s262144--266380780f0930f0219a4099101f5c17aa7ff74ce5c34078cc0c33aa7efa071e/SHA256E-s262144--266380780f0930f0219a4099101f5c17aa7ff74ce5c34078cc0c33aa7efa071e+ \ No newline at end of file diff --git a/samples/hold-peak/1618637597.dat b/samples/hold-peak/1618637597.dat @@ -0,0 +1 @@ +../../.git/annex/objects/Jv/zk/SHA256E-s1184--0920ec20cb5b32a08ffe35a4483cb62066ec2fca7972c58175e6fed48fabba15.dat/SHA256E-s1184--0920ec20cb5b32a08ffe35a4483cb62066ec2fca7972c58175e6fed48fabba15.dat+ \ No newline at end of file diff --git a/samples/hold-peak/1618637717.dat b/samples/hold-peak/1618637717.dat @@ -0,0 +1 @@ +../../.git/annex/objects/8F/8j/SHA256E-s2672--dd1e080d9788a37330e4f76c54ad2184f146ea15b850ce6d1a406af369081dc1.dat/SHA256E-s2672--dd1e080d9788a37330e4f76c54ad2184f146ea15b850ce6d1a406af369081dc1.dat+ \ No newline at end of file diff --git a/samples/hold-peak/1618637915.dat b/samples/hold-peak/1618637915.dat @@ -0,0 +1 @@ +../../.git/annex/objects/pF/FM/SHA256E-s1600--dd997321dd7f89d2280bbcb90517fe165d3d277b03b0956efcc1f7e2c8146c29.dat/SHA256E-s1600--dd997321dd7f89d2280bbcb90517fe165d3d277b03b0956efcc1f7e2c8146c29.dat+ \ No newline at end of file diff --git a/samples/hold-peak/1618638047.dat b/samples/hold-peak/1618638047.dat @@ -0,0 +1 @@ +../../.git/annex/objects/Q6/vx/SHA256E-s1520--613ef65760f96bf631f76c2fbd71ca1831ccf14339ca6b48fc246675d9ed216f.dat/SHA256E-s1520--613ef65760f96bf631f76c2fbd71ca1831ccf14339ca6b48fc246675d9ed216f.dat+ \ No newline at end of file diff --git a/samples/hold-peak/1618638785.dat b/samples/hold-peak/1618638785.dat @@ -0,0 +1 @@ +../../.git/annex/objects/1z/0v/SHA256E-s752--2df4031f81654890c266aec2f6da4b16f5d0cfd5171a66505d055dc52f67a395.dat/SHA256E-s752--2df4031f81654890c266aec2f6da4b16f5d0cfd5171a66505d055dc52f67a395.dat+ \ No newline at end of file diff --git a/samples/hold-peak/1618638848.dat b/samples/hold-peak/1618638848.dat @@ -0,0 +1 @@ +../../.git/annex/objects/1f/8f/SHA256E-s752--d73acfb166b1e99ba0230076497a2fda51d97d3a0926b73cb7682b00deb547e7.dat/SHA256E-s752--d73acfb166b1e99ba0230076497a2fda51d97d3a0926b73cb7682b00deb547e7.dat+ \ No newline at end of file diff --git a/samples/hold-peak/1618638996.dat b/samples/hold-peak/1618638996.dat @@ -0,0 +1 @@ +../../.git/annex/objects/6z/2z/SHA256E-s1136--f373b14c3aca576f3ede21a19e4b108063f379a23d7534a31b6d5b4ebf62e65c.dat/SHA256E-s1136--f373b14c3aca576f3ede21a19e4b108063f379a23d7534a31b6d5b4ebf62e65c.dat+ \ No newline at end of file diff --git a/samples/hold-peak/1618640084.dat b/samples/hold-peak/1618640084.dat @@ -0,0 +1 @@ +../../.git/annex/objects/8f/0X/SHA256E-s352--ad680e6cd7ed0d3751c599d6c9d5311f1180a246db01b73f39e3452cf22caee1.dat/SHA256E-s352--ad680e6cd7ed0d3751c599d6c9d5311f1180a246db01b73f39e3452cf22caee1.dat+ \ No newline at end of file diff --git a/samples/hold-peak/1618640149.dat b/samples/hold-peak/1618640149.dat @@ -0,0 +1 @@ +../../.git/annex/objects/p1/1q/SHA256E-s224--8e6f20466a235559385487339d4768b0aa1b960b31fa0455a86b3becce48513f.dat/SHA256E-s224--8e6f20466a235559385487339d4768b0aa1b960b31fa0455a86b3becce48513f.dat+ \ No newline at end of file diff --git a/samples/hold-peak/1618640180.dat b/samples/hold-peak/1618640180.dat @@ -0,0 +1 @@ +../../.git/annex/objects/8x/V3/SHA256E-s1904--a5d6bce2c12795b92aca35e01f69ee1d61cf51a9b989411c0d00ad3ab2bb6081.dat/SHA256E-s1904--a5d6bce2c12795b92aca35e01f69ee1d61cf51a9b989411c0d00ad3ab2bb6081.dat+ \ No newline at end of file diff --git a/samples/hold-peak/1618640332.dat b/samples/hold-peak/1618640332.dat @@ -0,0 +1 @@ +../../.git/annex/objects/m2/gj/SHA256E-s784--48da132124725fda4c04acd8cfac3bc7839c2c7e714e926be6764aafbc07aae1.dat/SHA256E-s784--48da132124725fda4c04acd8cfac3bc7839c2c7e714e926be6764aafbc07aae1.dat+ \ No newline at end of file diff --git a/samples/hold-peak/1618640633.dat b/samples/hold-peak/1618640633.dat @@ -0,0 +1 @@ +../../.git/annex/objects/zG/4k/SHA256E-s1088--bbdb944736fb7098694c49a933bb6c5a76eb5ace10ff007da15d60057323328c.dat/SHA256E-s1088--bbdb944736fb7098694c49a933bb6c5a76eb5ace10ff007da15d60057323328c.dat+ \ No newline at end of file diff --git a/samples/hold-peak/1618641019.dat b/samples/hold-peak/1618641019.dat @@ -0,0 +1 @@ +../../.git/annex/objects/p0/7K/SHA256E-s1088--d77b316f4d9d23823fe0fb8ce4333f5333c79d90604f7920140f74940ddec853.dat/SHA256E-s1088--d77b316f4d9d23823fe0fb8ce4333f5333c79d90604f7920140f74940ddec853.dat+ \ No newline at end of file diff --git a/samples/hold-peak/1618650089.dat b/samples/hold-peak/1618650089.dat @@ -0,0 +1 @@ +../../.git/annex/objects/51/jv/SHA256E-s1440--6266a8d34344d402ff8f1e0aac86fd61c8400a643c54d856a197993b22a3fdfc.dat/SHA256E-s1440--6266a8d34344d402ff8f1e0aac86fd61c8400a643c54d856a197993b22a3fdfc.dat+ \ No newline at end of file diff --git a/samples/hold-peak/1618650181.dat b/samples/hold-peak/1618650181.dat @@ -0,0 +1 @@ +../../.git/annex/objects/qP/gp/SHA256E-s1760--ecc5403187d9a7ddd67c9c6d113dba68dc159f4439fa83d9711e13d593f6bffe.dat/SHA256E-s1760--ecc5403187d9a7ddd67c9c6d113dba68dc159f4439fa83d9711e13d593f6bffe.dat+ \ No newline at end of file diff --git a/samples/hold-peak/1618650376.dat b/samples/hold-peak/1618650376.dat @@ -0,0 +1 @@ +../../.git/annex/objects/8M/ww/SHA256E-s1456--87fdf5e30c86a4a89867e0f63c52516396df0e1d30a1a50768d4144b3f62afba.dat/SHA256E-s1456--87fdf5e30c86a4a89867e0f63c52516396df0e1d30a1a50768d4144b3f62afba.dat+ \ No newline at end of file diff --git a/samples/hold-peak/1618650721.dat b/samples/hold-peak/1618650721.dat @@ -0,0 +1 @@ +../../.git/annex/objects/9w/29/SHA256E-s1936--9395e03bc271deef0e2bc8aa2eb26a2b815b3faace122750893eafc871bb3f0a.dat/SHA256E-s1936--9395e03bc271deef0e2bc8aa2eb26a2b815b3faace122750893eafc871bb3f0a.dat+ \ No newline at end of file diff --git a/samples/hold-peak/1618650977.dat b/samples/hold-peak/1618650977.dat @@ -0,0 +1 @@ +../../.git/annex/objects/zJ/mj/SHA256E-s1040--339cc3cada8d3b5468dc6f574e9ca9539cb3ca2e080246912c1fc4e6005c70be.dat/SHA256E-s1040--339cc3cada8d3b5468dc6f574e9ca9539cb3ca2e080246912c1fc4e6005c70be.dat+ \ No newline at end of file diff --git a/samples/hold-peak/1618651288.dat b/samples/hold-peak/1618651288.dat @@ -0,0 +1 @@ +../../.git/annex/objects/1F/Q9/SHA256E-s1536--aa5e132c4646006fa9a67828d9faa803be14c8fd091075d70355c77edf21b7d2.dat/SHA256E-s1536--aa5e132c4646006fa9a67828d9faa803be14c8fd091075d70355c77edf21b7d2.dat+ \ No newline at end of file diff --git a/samples/hold-peak/1618651520.dat b/samples/hold-peak/1618651520.dat @@ -0,0 +1 @@ +../../.git/annex/objects/fK/78/SHA256E-s1168--45032385259b89eb539a47f3d202039bf2c6b30c2a2f8ea0209514d42021bbc4.dat/SHA256E-s1168--45032385259b89eb539a47f3d202039bf2c6b30c2a2f8ea0209514d42021bbc4.dat+ \ No newline at end of file diff --git a/samples/hold-peak/1618651698.dat b/samples/hold-peak/1618651698.dat @@ -0,0 +1 @@ +../../.git/annex/objects/Qp/3G/SHA256E-s1504--413c81a823d647e7031e063b3d307898e7e58ee676070f25e331e95e5d6a6d56.dat/SHA256E-s1504--413c81a823d647e7031e063b3d307898e7e58ee676070f25e331e95e5d6a6d56.dat+ \ No newline at end of file diff --git a/samples/hold-peak/extract-frames b/samples/hold-peak/extract-frames @@ -0,0 +1,50 @@ +#!/bin/sh + +cleanup() { + if ! test "$viewer_pid" = 0 + then + kill "$viewer_pid" + exit + fi +} + +filename="$1" +# https://superuser.com/questions/650291/how-to-get-video-duration-in-seconds +duration=$(ffprobe -v error -select_streams v:0 -show_entries stream=duration -of default=noprint_wrappers=1:nokey=1 "$filename") +# https://stackoverflow.com/questions/1842634/parse-date-in-bash +date=$(basename "$filename" | sed -rne 's/VID_([0-9]{4})([0-9]{2})([0-9]{2})_([0-9]{2})([0-9]{2})([0-9]{2}).*/\1-\2-\3 \4:\5:\6/p') +echo $date +timestamp=$(date --date="$date" "+%s") +echo $timestamp +tmp=$timestamp +mkdir -p $tmp +# https://stackoverflow.com/questions/50099869/ffmpeg-output-images-filename-with-time-position +for t in $(seq 0 $duration) +do + if test -f $tmp/frame-$t.png + then + continue + fi + ffmpeg -hide_banner -loglevel error -y -ss $t -i "$filename" -vframes 1 $tmp/frame-$t.png + echo "Extracting [$t/$duration]" +done +viewer=0 +viewer_pid=0 +for t in $(seq 0 $duration) +do + cp $tmp/frame-$t.png $tmp/frame.png + if test "$viewer" = 0 + then + sxiv $tmp/frame.png & + viewer_pid=$! + trap cleanup SIGINT + viewer=1 + fi + read -p "Velocity [$t/$duration]: " velocity + velocity=$(echo "$velocity" | sed -rne 's/([0-9])([0-9]{2})/\1.\2/p') + current_timestamp=$(expr $timestamp + $t) + echo "$current_timestamp $velocity" | tee -a $timestamp.dat +done +kill $viewer_pid +rm -rf --one-file-system $tmp +#ffmpeg -i ../VID_20210417_083317.mp4 -vf "select=not(mod(n\,30))" -vsync vfr img_%d.png diff --git a/samples/serial-import b/samples/serial-import @@ -0,0 +1,20 @@ +#!/bin/sh + +db=hold-peak.sqlite3 +tmp=$(mktemp) +sqlite3 $db << 'EOF' +CREATE TABLE IF NOT EXISTS load_cell_samples ( +timestamp INTEGER, t FLOAT, +x INTEGER, y INTEGER, z INTEGER, +sign_x INTEGER, sign_y INTEGER, sign_z INTEGER); +EOF +while read line +do + date=$(echo "$line" | sed -rne 's/([0-9]{2}):([0-9]{2}):([0-9]{2}).*/2021-04-17 \1:\2:\3/p') + # we swap X and Y here, since the anemometere was rotated 90 degrees CW + rest=$(echo "$line" | sed -rne 's/.*t ([^ ]+) x ([^ ]+) y ([^ ]+) z ([^ ]+) sx ([^ ]+) sy ([^ ]+) sz ([^ ]+).*/\1|\3|\2|\4|\5|\6|\7/p') + date=$(date --date="$date" "+%s") + echo "$date|$rest" +done < $1 > $tmp +sqlite3 $db ".import $tmp load_cell_samples" +rm $tmp