From 235209dd6dda24ecd9b281e454cb4225c335efea Mon Sep 17 00:00:00 2001 From: abiosbug <90327530+abiosbug@users.noreply.github.com> Date: Wed, 8 Sep 2021 21:01:20 +0200 Subject: [PATCH 01/14] Add Approach foldere --- Scripts/Approach/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 Scripts/Approach/README.md diff --git a/Scripts/Approach/README.md b/Scripts/Approach/README.md new file mode 100644 index 0000000..f39c25a --- /dev/null +++ b/Scripts/Approach/README.md @@ -0,0 +1,3 @@ +# Approach +_Automated approach script using RangeFinder_ + From e1db970510d13991c44543588f0bf3e9575cbbb3 Mon Sep 17 00:00:00 2001 From: abiosbug <90327530+abiosbug@users.noreply.github.com> Date: Wed, 8 Sep 2021 21:04:30 +0200 Subject: [PATCH 02/14] Add background info --- Scripts/Approach/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Scripts/Approach/README.md b/Scripts/Approach/README.md index f39c25a..edb7231 100644 --- a/Scripts/Approach/README.md +++ b/Scripts/Approach/README.md @@ -1,3 +1,5 @@ # Approach -_Automated approach script using RangeFinder_ +_Automated approach script using RangeFinder and PID loop_ + +This script is assembled from this reddit thread, piecing together the info from various comments and adjusting it to work with the Jilted. From 99603145019b58d9f2f0607d6f51b400ea131db9 Mon Sep 17 00:00:00 2001 From: abiosbug <90327530+abiosbug@users.noreply.github.com> Date: Wed, 8 Sep 2021 21:05:29 +0200 Subject: [PATCH 03/14] Add PID controlled approach script --- Scripts/Approach/approach.yolol | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Scripts/Approach/approach.yolol diff --git a/Scripts/Approach/approach.yolol b/Scripts/Approach/approach.yolol new file mode 100644 index 0000000..4143610 --- /dev/null +++ b/Scripts/Approach/approach.yolol @@ -0,0 +1,20 @@ +sp=19 Kp=0.3 Ki=0 Kd=0.5 le=0 int=0 d=:Distance +IF :Approach THEN :Cruise=0 :Mi=1 GOTO3 ELSE GOTO1 END +IF :RFC AND :RFC999 OR e<10 THEN :Approach=0 GOTO8 END +IF o>0 THEN :FWD=o ELSE :FWD=0 END +IF o<0 THEN :BCK=-o ELSE :BCK=0 END +IF :Approach THEN GOTO3 ELSE :FWD=0 :BCK=0 :HeadLight=1 END GOTO1 +GOTO1 + + + + + + + + + + +// Approach script using pid loop, adjusted for Jilted From 6f122df4d49f558ffe889345b22c0c4d9e261cd4 Mon Sep 17 00:00:00 2001 From: abiosbug <90327530+abiosbug@users.noreply.github.com> Date: Wed, 8 Sep 2021 23:56:47 +0200 Subject: [PATCH 04/14] Attempt to write first test --- Scripts/Approach/test.yaml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Scripts/Approach/test.yaml diff --git a/Scripts/Approach/test.yaml b/Scripts/Approach/test.yaml new file mode 100644 index 0000000..3fd9259 --- /dev/null +++ b/Scripts/Approach/test.yaml @@ -0,0 +1,22 @@ +# required: list of scripts to run in parallel. Can be as many as you like +scripts: + - approach.yolol +# optional: stop execution once one of the listed global variables has the given value. +# this is checked after every executed line, which means the line which sets the done-variable is executed completely before stopping the VM +# default is "done: 1" +# optional: if true, ignore runtime-errors during script-execution. Default: false +# ignoreerrs: true +# optional: Stop execution after running set amount of lines (per script) +# default value is 2000. Set to -1 for unlimited +# maxlines: 12 +# required: list of testcases +cases: + - name: TestFWD + # optional: global variables to set before running. ':' can be omitted + inputs: + Distance: 500 + FWD: 100 + # optional: expected value for global variables after running + # it he values after execution the scipts do not match the values here, the test fails + outputs: + FWD: 0 From 4aae607a1332be5a81fee2b63a34cd42ae22c0ef Mon Sep 17 00:00:00 2001 From: abiosbug <90327530+abiosbug@users.noreply.github.com> Date: Thu, 9 Sep 2021 00:12:39 +0200 Subject: [PATCH 05/14] Added field expectations and HW setup --- Scripts/Approach/README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Scripts/Approach/README.md b/Scripts/Approach/README.md index edb7231..16f9142 100644 --- a/Scripts/Approach/README.md +++ b/Scripts/Approach/README.md @@ -2,4 +2,12 @@ _Automated approach script using RangeFinder and PID loop_ This script is assembled from this reddit thread, piecing together the info from various comments and adjusting it to work with the Jilted. +Setup assumes a single RangeFinder for the Distance calculation and a number of RangeFinders to assist it. +*Field names*: +``` + :Approach bool enable approach + :Cruise int LeverBindSpeed FCUForward + :Distance float RangeFinderDistance + :RFC float RangeFinderDistance of optional extra RangeFinders +``` From 12a08692fdc3505baff8bc51d65ca310c9048a28 Mon Sep 17 00:00:00 2001 From: abiosbug <90327530+abiosbug@users.noreply.github.com> Date: Thu, 9 Sep 2021 00:14:11 +0200 Subject: [PATCH 06/14] Added link to Reddit post --- Scripts/Approach/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Scripts/Approach/README.md b/Scripts/Approach/README.md index 16f9142..e2e9678 100644 --- a/Scripts/Approach/README.md +++ b/Scripts/Approach/README.md @@ -1,7 +1,7 @@ # Approach _Automated approach script using RangeFinder and PID loop_ -This script is assembled from this reddit thread, piecing together the info from various comments and adjusting it to work with the Jilted. +This script is assembled from [this reddit thread][1], piecing together the info from various comments and adjusting it to work with the Jilted. Setup assumes a single RangeFinder for the Distance calculation and a number of RangeFinders to assist it. *Field names*: @@ -11,3 +11,5 @@ Setup assumes a single RangeFinder for the Distance calculation and a number of :Distance float RangeFinderDistance :RFC float RangeFinderDistance of optional extra RangeFinders ``` + +[1]: https://www.reddit.com/r/starbase/comments/p5mifp/safely_approach_asteroids_with_a_pid_controller/ From 16963f063004442d9220d6d1dd02882d4bef97d7 Mon Sep 17 00:00:00 2001 From: abiosbug <90327530+abiosbug@users.noreply.github.com> Date: Thu, 9 Sep 2021 00:16:52 +0200 Subject: [PATCH 07/14] Default FCU key bindings and remove :Headlight --- Scripts/Approach/approach.yolol | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Scripts/Approach/approach.yolol b/Scripts/Approach/approach.yolol index 4143610..e345238 100644 --- a/Scripts/Approach/approach.yolol +++ b/Scripts/Approach/approach.yolol @@ -3,10 +3,9 @@ IF :Approach THEN :Cruise=0 :Mi=1 GOTO3 ELSE GOTO1 END IF :RFC AND :RFC999 OR e<10 THEN :Approach=0 GOTO8 END -IF o>0 THEN :FWD=o ELSE :FWD=0 END -IF o<0 THEN :BCK=-o ELSE :BCK=0 END -IF :Approach THEN GOTO3 ELSE :FWD=0 :BCK=0 :HeadLight=1 END GOTO1 -GOTO1 +IF o>0 THEN :FCUForward=o ELSE :FCUForward=0 END +IF o<0 THEN :FCUBackward=-o ELSE :FCUBackward=0 END +IF :Approach THEN GOTO3 ELSE :FCUForward=0 :FCUBackward=0 END GOTO1 @@ -17,4 +16,5 @@ GOTO1 -// Approach script using pid loop, adjusted for Jilted + +// Approach script using pid loop, adjusted for the #JiltedOP From 75417e9b40844df5d38b35f74dd1b6c0f0cc16ea Mon Sep 17 00:00:00 2001 From: abiosbug <90327530+abiosbug@users.noreply.github.com> Date: Thu, 9 Sep 2021 00:17:51 +0200 Subject: [PATCH 08/14] Added Cruise values just in case --- Scripts/Approach/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Scripts/Approach/README.md b/Scripts/Approach/README.md index e2e9678..c5bdd35 100644 --- a/Scripts/Approach/README.md +++ b/Scripts/Approach/README.md @@ -7,7 +7,7 @@ Setup assumes a single RangeFinder for the Distance calculation and a number of *Field names*: ``` :Approach bool enable approach - :Cruise int LeverBindSpeed FCUForward + :Cruise int LeverBindSpeed FCUForward On: 0 - Off: 100 :Distance float RangeFinderDistance :RFC float RangeFinderDistance of optional extra RangeFinders ``` From 642c6a4b747875f06778d939e15efd1344dea82c Mon Sep 17 00:00:00 2001 From: abiosbug <90327530+abiosbug@users.noreply.github.com> Date: Thu, 9 Sep 2021 10:43:35 +0200 Subject: [PATCH 09/14] Move up line 20 for ci --- Scripts/Approach/approach.yolol | 1 - 1 file changed, 1 deletion(-) diff --git a/Scripts/Approach/approach.yolol b/Scripts/Approach/approach.yolol index e345238..f0883d4 100644 --- a/Scripts/Approach/approach.yolol +++ b/Scripts/Approach/approach.yolol @@ -16,5 +16,4 @@ IF :Approach THEN GOTO3 ELSE :FCUForward=0 :FCUBackward=0 END GOTO1 - // Approach script using pid loop, adjusted for the #JiltedOP From ea067590ee5da95b96e07a0fdc16a45346cc025e Mon Sep 17 00:00:00 2001 From: abiosbug <90327530+abiosbug@users.noreply.github.com> Date: Thu, 9 Sep 2021 10:48:19 +0200 Subject: [PATCH 10/14] Removed last comment --- Scripts/Approach/approach.yolol | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/Scripts/Approach/approach.yolol b/Scripts/Approach/approach.yolol index f0883d4..20520b7 100644 --- a/Scripts/Approach/approach.yolol +++ b/Scripts/Approach/approach.yolol @@ -5,15 +5,4 @@ e=d-sp de=e-le int=int+e o=Kp*e+(Ki*int)+(Kd*de) le=e IF d>999 OR e<10 THEN :Approach=0 GOTO8 END IF o>0 THEN :FCUForward=o ELSE :FCUForward=0 END IF o<0 THEN :FCUBackward=-o ELSE :FCUBackward=0 END -IF :Approach THEN GOTO3 ELSE :FCUForward=0 :FCUBackward=0 END GOTO1 - - - - - - - - - - -// Approach script using pid loop, adjusted for the #JiltedOP +IF :Approach THEN GOTO3 ELSE :FCUForward=0 :FCUBackward=0 END From 12cf46e5b5bead6a70bbc5180fe323edcd629de6 Mon Sep 17 00:00:00 2001 From: abiosbug <90327530+abiosbug@users.noreply.github.com> Date: Thu, 9 Sep 2021 18:38:22 +0200 Subject: [PATCH 11/14] Remove :Cruise toggle, add test info --- Scripts/Approach/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Scripts/Approach/README.md b/Scripts/Approach/README.md index c5bdd35..f5ff736 100644 --- a/Scripts/Approach/README.md +++ b/Scripts/Approach/README.md @@ -7,9 +7,10 @@ Setup assumes a single RangeFinder for the Distance calculation and a number of *Field names*: ``` :Approach bool enable approach - :Cruise int LeverBindSpeed FCUForward On: 0 - Off: 100 :Distance float RangeFinderDistance :RFC float RangeFinderDistance of optional extra RangeFinders ``` +Testing the actual approach PID loop is not possible without having an environment in the test runner that responds to eg. FCU* commands. + [1]: https://www.reddit.com/r/starbase/comments/p5mifp/safely_approach_asteroids_with_a_pid_controller/ From 995dc610a2389f86f517df8722907bdc02cea83c Mon Sep 17 00:00:00 2001 From: abiosbug <90327530+abiosbug@users.noreply.github.com> Date: Thu, 9 Sep 2021 18:42:42 +0200 Subject: [PATCH 12/14] Fixed loop logic to include :Distance --- Scripts/Approach/approach.yolol | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Scripts/Approach/approach.yolol b/Scripts/Approach/approach.yolol index 20520b7..c9783c5 100644 --- a/Scripts/Approach/approach.yolol +++ b/Scripts/Approach/approach.yolol @@ -1,6 +1,6 @@ -sp=19 Kp=0.3 Ki=0 Kd=0.5 le=0 int=0 d=:Distance -IF :Approach THEN :Cruise=0 :Mi=1 GOTO3 ELSE GOTO1 END -IF :RFC AND :RFC999 OR e<10 THEN :Approach=0 GOTO8 END IF o>0 THEN :FCUForward=o ELSE :FCUForward=0 END From 19636ee4e392c9474150fefb992381cfa68491e3 Mon Sep 17 00:00:00 2001 From: abiosbug <90327530+abiosbug@users.noreply.github.com> Date: Thu, 9 Sep 2021 18:45:50 +0200 Subject: [PATCH 13/14] Untestable feature Without Rangefinders reporting actual distances as a result of FCUForward input, this feature cannot be tested. Testing the PID loop logic seems doable though, feel free to add if possible --- Scripts/Approach/test.yaml | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 Scripts/Approach/test.yaml diff --git a/Scripts/Approach/test.yaml b/Scripts/Approach/test.yaml deleted file mode 100644 index 3fd9259..0000000 --- a/Scripts/Approach/test.yaml +++ /dev/null @@ -1,22 +0,0 @@ -# required: list of scripts to run in parallel. Can be as many as you like -scripts: - - approach.yolol -# optional: stop execution once one of the listed global variables has the given value. -# this is checked after every executed line, which means the line which sets the done-variable is executed completely before stopping the VM -# default is "done: 1" -# optional: if true, ignore runtime-errors during script-execution. Default: false -# ignoreerrs: true -# optional: Stop execution after running set amount of lines (per script) -# default value is 2000. Set to -1 for unlimited -# maxlines: 12 -# required: list of testcases -cases: - - name: TestFWD - # optional: global variables to set before running. ':' can be omitted - inputs: - Distance: 500 - FWD: 100 - # optional: expected value for global variables after running - # it he values after execution the scipts do not match the values here, the test fails - outputs: - FWD: 0 From 72cba48b74b330e4c9d3a30ffebcdb6f0e079b45 Mon Sep 17 00:00:00 2001 From: abiosbug <90327530+abiosbug@users.noreply.github.com> Date: Thu, 9 Sep 2021 18:46:40 +0200 Subject: [PATCH 14/14] Minor cleanup --- Scripts/Approach/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Scripts/Approach/README.md b/Scripts/Approach/README.md index f5ff736..741a133 100644 --- a/Scripts/Approach/README.md +++ b/Scripts/Approach/README.md @@ -1,5 +1,5 @@ # Approach -_Automated approach script using RangeFinder and PID loop_ +_Automated approach script using RangeFinders and a PID loop_ This script is assembled from [this reddit thread][1], piecing together the info from various comments and adjusting it to work with the Jilted. Setup assumes a single RangeFinder for the Distance calculation and a number of RangeFinders to assist it.