diff --git a/.gitignore b/.gitignore index b912168..81ac21c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /target results/ +configurations/final diff --git a/configurations/all.toml b/configurations/all.toml deleted file mode 100644 index d82ffc3..0000000 --- a/configurations/all.toml +++ /dev/null @@ -1,47 +0,0 @@ - - - -tickrate = 6000.0 -drone_tick_rate = 600 -max_thrust = 2.6 -max_torque = 0.5 -mass = 0.350 - -# The Stack: First layer computes target speed, second layer computes motor torque -layers = [ - # { type = "Angle", max_angle = 0.78, kp = [4.0, 4.0, 4.0], ki = [0.0, 0.0, 0.0], kd = [0.1, 0.1, 0.1] }, - { type = "Rate", max_rate = 3.14, kp = [ - 0.01, - 0.1, - 0.01, - ], ki = [ - 0.0, - 0.0, - 0.0, - ], kd = [ - 0.0, - 0.0, - 0.0, - ] }, -] - -# + (map[0] * setpoint.x) // Roll -# + (map[1] * setpoint.y) // Yaw -# + (map[2] * setpoint.z); // Pitch - -# /* -# * Motor position indices -# * ^ - Front -# * | -# * | -# * 1 --- 0 -# * | | -# * | | -# * 2 --- 3 -# */ -motor_map = [ - [-1.0, 1.0, 1.0], # Front Right - [1.0, -1.0, 1.0], # Front Left - [1.0, 1.0, -1.0], # Rear Left - [-1.0, -1.0, -1.0], # Rear Right -] diff --git a/gen.py b/configurations/gen.py similarity index 54% rename from gen.py rename to configurations/gen.py index cc92430..8ed7816 100644 --- a/gen.py +++ b/configurations/gen.py @@ -1,11 +1,11 @@ import os import subprocess -subprocess.run("rm configurations/*.toml", shell=True) +subprocess.run("rm -rf final && mkdir final", shell=True) -MOT_FOLDER = "configurations/mot/" -SIM_FOLDER = "configurations/sim/" -PID_FOLDER = "configurations/pid_cont/" +MOT_FOLDER = "mot/" +SIM_FOLDER = "sim/" +PID_FOLDER = "pid_cont/" mot_files = os.listdir(MOT_FOLDER) sim_files = os.listdir(SIM_FOLDER) @@ -22,15 +22,7 @@ for case in prod: with open(PID_FOLDER + case[2], "r") as f3: settings = f1.read() + "\n" + f2.read() + "\n" + f3.read() with open( - "configurations/" - + "".join(case).replace(".toml", "_").removesuffix("_") - + ".toml", + "final/" + "".join(case).replace(".toml", "_").removesuffix("_") + ".toml", "w", ) as f: f.write(settings) - -# cont = open(PID_FOLDER + "low_1.toml").read() -# for i in range(1, 11): -# num = 0.005 * i -# with open(PID_FOLDER + f"low_{i:02d}.toml", "w") as f: -# f.write(cont.replace("0.005", str(num))) diff --git a/configurations/mot/mot_std.toml b/configurations/mot/mot_std.toml index f0c2f02..ec4e19f 100644 --- a/configurations/mot/mot_std.toml +++ b/configurations/mot/mot_std.toml @@ -3,3 +3,11 @@ max_thrust = 2.6 max_torque = 0.5 mass = 0.350 +time_constant = 0.00 + +motor_map = [ + [-1.0, 1.0, 1.0], # Front Right + [1.0, -1.0, 1.0], # Front Left + [1.0, 1.0, -1.0], # Rear Left + [-1.0, -1.0, -1.0], # Rear Right +] diff --git a/configurations/mot/mot_tc.toml b/configurations/mot/mot_tc.toml index f6b89eb..7081bc6 100644 --- a/configurations/mot/mot_tc.toml +++ b/configurations/mot/mot_tc.toml @@ -2,4 +2,11 @@ max_thrust = 2.6 max_torque = 0.5 mass = 0.350 -time_constant=0.01 +time_constant = 0.01 + +motor_map = [ + [-1.0, 1.0, 1.0], # Front Right + [1.0, -1.0, 1.0], # Front Left + [1.0, 1.0, -1.0], # Rear Left + [-1.0, -1.0, -1.0], # Rear Right +] diff --git a/configurations/pid_cont/low_01.toml b/configurations/pid_cont/low_01.toml deleted file mode 100644 index cdd123d..0000000 --- a/configurations/pid_cont/low_01.toml +++ /dev/null @@ -1,5 +0,0 @@ - -target_rate = 3.141592 -proportional_multiplier = [0.005, 0.005, 0.005] -integral_multiplier = [0.0, 0.0, 0.0] -diferential_multiplier = [0.0, 0.0, 0.0] diff --git a/configurations/pid_cont/low_02.toml b/configurations/pid_cont/low_02.toml deleted file mode 100644 index aea1033..0000000 --- a/configurations/pid_cont/low_02.toml +++ /dev/null @@ -1,5 +0,0 @@ - -target_rate = 3.141592 -proportional_multiplier = [0.01, 0.01, 0.01] -integral_multiplier = [0.0, 0.0, 0.0] -diferential_multiplier = [0.0, 0.0, 0.0] diff --git a/configurations/pid_cont/low_03.toml b/configurations/pid_cont/low_03.toml deleted file mode 100644 index a0d786f..0000000 --- a/configurations/pid_cont/low_03.toml +++ /dev/null @@ -1,5 +0,0 @@ - -target_rate = 3.141592 -proportional_multiplier = [0.015, 0.015, 0.015] -integral_multiplier = [0.0, 0.0, 0.0] -diferential_multiplier = [0.0, 0.0, 0.0] diff --git a/configurations/pid_cont/low_04.toml b/configurations/pid_cont/low_04.toml deleted file mode 100644 index 9fd81d9..0000000 --- a/configurations/pid_cont/low_04.toml +++ /dev/null @@ -1,5 +0,0 @@ - -target_rate = 3.141592 -proportional_multiplier = [0.02, 0.02, 0.02] -integral_multiplier = [0.0, 0.0, 0.0] -diferential_multiplier = [0.0, 0.0, 0.0] diff --git a/configurations/pid_cont/low_05.toml b/configurations/pid_cont/low_05.toml deleted file mode 100644 index 531f7c4..0000000 --- a/configurations/pid_cont/low_05.toml +++ /dev/null @@ -1,5 +0,0 @@ - -target_rate = 3.141592 -proportional_multiplier = [0.025, 0.025, 0.025] -integral_multiplier = [0.0, 0.0, 0.0] -diferential_multiplier = [0.0, 0.0, 0.0] diff --git a/configurations/pid_cont/low_06.toml b/configurations/pid_cont/low_06.toml deleted file mode 100644 index 0859a34..0000000 --- a/configurations/pid_cont/low_06.toml +++ /dev/null @@ -1,5 +0,0 @@ - -target_rate = 3.141592 -proportional_multiplier = [0.03, 0.03, 0.03] -integral_multiplier = [0.0, 0.0, 0.0] -diferential_multiplier = [0.0, 0.0, 0.0] diff --git a/configurations/pid_cont/low_07.toml b/configurations/pid_cont/low_07.toml deleted file mode 100644 index ed4ed69..0000000 --- a/configurations/pid_cont/low_07.toml +++ /dev/null @@ -1,5 +0,0 @@ - -target_rate = 3.141592 -proportional_multiplier = [0.035, 0.035, 0.035] -integral_multiplier = [0.0, 0.0, 0.0] -diferential_multiplier = [0.0, 0.0, 0.0] diff --git a/configurations/pid_cont/low_08.toml b/configurations/pid_cont/low_08.toml deleted file mode 100644 index 892db38..0000000 --- a/configurations/pid_cont/low_08.toml +++ /dev/null @@ -1,5 +0,0 @@ - -target_rate = 3.141592 -proportional_multiplier = [0.04, 0.04, 0.04] -integral_multiplier = [0.0, 0.0, 0.0] -diferential_multiplier = [0.0, 0.0, 0.0] diff --git a/configurations/pid_cont/low_09.toml b/configurations/pid_cont/low_09.toml deleted file mode 100644 index ab25cc4..0000000 --- a/configurations/pid_cont/low_09.toml +++ /dev/null @@ -1,5 +0,0 @@ - -target_rate = 3.141592 -proportional_multiplier = [0.045, 0.045, 0.045] -integral_multiplier = [0.0, 0.0, 0.0] -diferential_multiplier = [0.0, 0.0, 0.0] diff --git a/configurations/pid_cont/low_10.toml b/configurations/pid_cont/low_10.toml deleted file mode 100644 index 1d756a2..0000000 --- a/configurations/pid_cont/low_10.toml +++ /dev/null @@ -1,5 +0,0 @@ - -target_rate = 3.141592 -proportional_multiplier = [0.05, 0.05, 0.05] -integral_multiplier = [0.0, 0.0, 0.0] -diferential_multiplier = [0.0, 0.0, 0.0] diff --git a/configurations/pid_cont/rate_01.toml b/configurations/pid_cont/rate_01.toml new file mode 100644 index 0000000..46688bd --- /dev/null +++ b/configurations/pid_cont/rate_01.toml @@ -0,0 +1,16 @@ + +layers = [ + { type = "Rate", max_rate = 3.14, kp = [ + 0.01, + 0.1, + 0.01, + ], ki = [ + 0.0, + 0.0, + 0.0, + ], kd = [ + 0.0, + 0.0, + 0.0, + ] }, +] diff --git a/configurations/pid_cont/rate_02.toml b/configurations/pid_cont/rate_02.toml new file mode 100644 index 0000000..72b0d15 --- /dev/null +++ b/configurations/pid_cont/rate_02.toml @@ -0,0 +1,16 @@ + +layers = [ + { type = "Rate", max_rate = 3.14, kp = [ + 0.02, + 0.2, + 0.02, + ], ki = [ + 0.0, + 0.0, + 0.0, + ], kd = [ + 0.0, + 0.0, + 0.0, + ] }, +] diff --git a/configurations/pid_cont/rate_03.toml b/configurations/pid_cont/rate_03.toml new file mode 100644 index 0000000..72b0d15 --- /dev/null +++ b/configurations/pid_cont/rate_03.toml @@ -0,0 +1,16 @@ + +layers = [ + { type = "Rate", max_rate = 3.14, kp = [ + 0.02, + 0.2, + 0.02, + ], ki = [ + 0.0, + 0.0, + 0.0, + ], kd = [ + 0.0, + 0.0, + 0.0, + ] }, +] diff --git a/configurations/pitch.toml b/configurations/pitch.toml deleted file mode 100644 index 613c5cc..0000000 --- a/configurations/pitch.toml +++ /dev/null @@ -1,47 +0,0 @@ - - - -tickrate = 6000.0 -drone_tick_rate = 600 -max_thrust = 2.6 -max_torque = 0.5 -mass = 0.350 - -# The Stack: First layer computes target speed, second layer computes motor torque -layers = [ - # { type = "Angle", max_angle = 0.78, kp = [4.0, 4.0, 4.0], ki = [0.0, 0.0, 0.0], kd = [0.1, 0.1, 0.1] }, - { type = "Rate", max_rate = 3.14, kp = [ - 0.0, - 0.0, - 0.01, - ], ki = [ - 0.0, - 0.0, - 0.0, - ], kd = [ - 0.0, - 0.0, - 0.0, - ] }, -] - -# + (map[0] * setpoint.x) // Roll -# + (map[1] * setpoint.y) // Yaw -# + (map[2] * setpoint.z); // Pitch - -# /* -# * Motor position indices -# * ^ - Front -# * | -# * | -# * 1 --- 0 -# * | | -# * | | -# * 2 --- 3 -# */ -motor_map = [ - [-1.0, 1.0, 1.0], # Front Right - [1.0, -1.0, 1.0], # Front Left - [1.0, 1.0, -1.0], # Rear Left - [-1.0, -1.0, -1.0], # Rear Right -] diff --git a/configurations/roll.toml b/configurations/roll.toml deleted file mode 100644 index b2930bb..0000000 --- a/configurations/roll.toml +++ /dev/null @@ -1,47 +0,0 @@ - - - -tickrate = 6000.0 -drone_tick_rate = 600 -max_thrust = 2.6 -max_torque = 0.5 -mass = 0.350 - -# The Stack: First layer computes target speed, second layer computes motor torque -layers = [ - # { type = "Angle", max_angle = 0.78, kp = [4.0, 4.0, 4.0], ki = [0.0, 0.0, 0.0], kd = [0.1, 0.1, 0.1] }, - { type = "Rate", max_rate = 3.14, kp = [ - 0.01, - 0.0, - 0.0, - ], ki = [ - 0.0, - 0.0, - 0.0, - ], kd = [ - 0.0, - 0.0, - 0.0, - ] }, -] - -# + (map[0] * setpoint.x) // Roll -# + (map[1] * setpoint.y) // Yaw -# + (map[2] * setpoint.z); // Pitch - -# /* -# * Motor position indices -# * ^ - Front -# * | -# * | -# * 1 --- 0 -# * | | -# * | | -# * 2 --- 3 -# */ -motor_map = [ - [-1.0, 1.0, 1.0], # Front Right - [1.0, -1.0, 1.0], # Front Left - [1.0, 1.0, -1.0], # Rear Left - [-1.0, -1.0, -1.0], # Rear Right -] diff --git a/configurations/yaw.toml b/configurations/yaw.toml deleted file mode 100644 index e65454a..0000000 --- a/configurations/yaw.toml +++ /dev/null @@ -1,47 +0,0 @@ - - - -tickrate = 6000.0 -drone_tick_rate = 600 -max_thrust = 2.6 -max_torque = 2.0 -mass = 0.350 - -# The Stack: First layer computes target speed, second layer computes motor torque -layers = [ - # { type = "Angle", max_angle = 0.78, kp = [4.0, 4.0, 4.0], ki = [0.0, 0.0, 0.0], kd = [0.1, 0.1, 0.1] }, - { type = "Rate", max_rate = 3.14, kp = [ - 0.0, - 0.01, - 0.0, - ], ki = [ - 0.0, - 0.0, - 0.0, - ], kd = [ - 0.0, - 0.0, - 0.0, - ] }, -] - -# + (map[0] * setpoint.x) // Roll -# + (map[1] * setpoint.y) // Yaw -# + (map[2] * setpoint.z); // Pitch - -# /* -# * Motor position indices -# * ^ - Front -# * | -# * | -# * 1 --- 0 -# * | | -# * | | -# * 2 --- 3 -# */ -motor_map = [ - [-1.0, 1.0, 1.0], # Front Right - [1.0, -1.0, 1.0], # Front Left - [1.0, 1.0, -1.0], # Rear Left - [-1.0, -1.0, -1.0], # Rear Right -]