diff --git a/Scripts/Approach/README.md b/Scripts/Approach/README.md new file mode 100644 index 0000000..741a133 --- /dev/null +++ b/Scripts/Approach/README.md @@ -0,0 +1,16 @@ +# Approach +_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. + +*Field names*: +``` + :Approach bool enable approach + :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/ diff --git a/Scripts/Approach/approach.yolol b/Scripts/Approach/approach.yolol new file mode 100644 index 0000000..c9783c5 --- /dev/null +++ b/Scripts/Approach/approach.yolol @@ -0,0 +1,8 @@ +sp=19 Kp=0.3 Ki=0 Kd=0.5 le=0 int=0 +IF NOT :Approach THEN GOTO1 END +d=:Distance IF :RFC AND :RFC999 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