Skip to content

Commit

Permalink
IMPROVEMENT: Automated file renames after inserting the 11_dnss2.para…
Browse files Browse the repository at this point in the history
…m file
  • Loading branch information
amilcarlucas committed May 22, 2024
1 parent f1c71d8 commit 9082aad
Show file tree
Hide file tree
Showing 203 changed files with 228 additions and 228 deletions.
82 changes: 41 additions & 41 deletions BLOG-discuss1.md

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions BLOG-discuss2.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ After it is set, do another flight and [check that the windspeed and direction a

Follow [ArduCopter's baro compensation Wiki](https://ardupilot.org/copter/docs/airspeed-estimation.html#barometer-position-error-compensation) and/or use the [Lua script provided by Yuri in the forum](https://discuss.ardupilot.org/t/scripting-copter-wind-estimation-baro-compensation-tuning/98470/).

Use *ArduPilot Methodic Configurator* to edit and upload the `41_barometer_compensation.param` file to the FC.
Use *ArduPilot Methodic Configurator* to edit and upload the `42_barometer_compensation.param` file to the FC.

Now do the flight to collect the data and analyze the logs to see if the barometer is correctly compensated and insensitive to wind.

Expand All @@ -30,25 +30,25 @@ Documentation is available on [Fabian Bredemeier's Identification of a multicopt

## Roll rate mathematical model

Use *ArduPilot Methodic Configurator* to edit and upload the `42_system_id_roll.param` file to the FC.
Use *ArduPilot Methodic Configurator* to edit and upload the `43_system_id_roll.param` file to the FC.

Now do the flight to collect the data for the roll rate system identification.

## Pitch rate mathematical model

Use *ArduPilot Methodic Configurator* to edit and upload the `43_system_id_pitch.param` file to the FC.
Use *ArduPilot Methodic Configurator* to edit and upload the `44_system_id_pitch.param` file to the FC.

Now do the flight to collect the data for the pitch rate system identification.

## Yaw rate mathematical model

Use *ArduPilot Methodic Configurator* to edit and upload the `44_system_id_yaw.param` file to the FC.
Use *ArduPilot Methodic Configurator* to edit and upload the `45_system_id_yaw.param` file to the FC.

Now do the flight to collect the data for the yaw rate system identification.

## Thrust mathematical model

Use *ArduPilot Methodic Configurator* to edit and upload the `45_system_id_thrust.param` file to the FC.
Use *ArduPilot Methodic Configurator* to edit and upload the `46_system_id_thrust.param` file to the FC.

Now do the flight to collect the data for the thrust system identification.

Expand All @@ -58,31 +58,31 @@ This describes how to use IAV's multi-objective optimization to achieve even bet

One other approach is described by Bill Geyer in his Blog post: [Predicting Closed Loop Response For Faster Autotune](https://discuss.ardupilot.org/t/predicting-closed-loop-response-for-faster-autotune/75096).

Use *ArduPilot Methodic Configurator* to edit and upload the `46_analytical_pid_optimization.param` file to the FC.
Use *ArduPilot Methodic Configurator* to edit and upload the `47_analytical_pid_optimization.param` file to the FC.

# 14. Productive configuration

Some changes should be made for everyday productive operation.

Use *ArduPilot Methodic Configurator* to edit and upload the `47_everyday_use.param` file to the FC.
Use *ArduPilot Methodic Configurator* to edit and upload the `48_everyday_use.param` file to the FC.

# 15. Position controller

The most inner *angle rate* and *angle* control loops have been tuned. Now let's tune the position controller.

Use *ArduPilot Methodic Configurator* to edit and upload the `48_position_controller.param` file to the FC.
Use *ArduPilot Methodic Configurator* to edit and upload the `49_position_controller.param` file to the FC.

# 16. Precision land

These are **optional**, and only make sense if you have extra hardware on your vehicle to support it.

Use *ArduPilot Methodic Configurator* to edit and upload the `49_precision_land.param` file to the FC.
Use *ArduPilot Methodic Configurator* to edit and upload the `50_precision_land.param` file to the FC.

# 17. Guided operation without RC transmitter

These are **optional**, and only make sense if you do beyond visual line-of-sight (BVLOS) autonomous flights using a companion computer.

Use *ArduPilot Methodic Configurator* to edit and upload the `50_guided_operation.param` file to the FC.
Use *ArduPilot Methodic Configurator* to edit and upload the `51_guided_operation.param` file to the FC.

# 18. Conclusion

Expand Down
88 changes: 44 additions & 44 deletions BLOG.md

Large diffs are not rendered by default.

164 changes: 82 additions & 82 deletions MethodicConfigurator/ArduCopter_configuration_steps.json

Large diffs are not rendered by default.

84 changes: 42 additions & 42 deletions MethodicConfigurator/ArduPlane_configuration_steps.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions MethodicConfigurator/annotate_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ def update_parameter_documentation(doc: Dict[str, Any], target: str = '.',
# Iterate over all the target ArduPilot parameter files
for param_file in param_files:

if os_path.basename(param_file).endswith("24_inflight_magnetometer_fit_setup.param") and "MAGH_ALT_DELTA" not in doc:
if os_path.basename(param_file).endswith("25_inflight_magnetometer_fit_setup.param") and "MAGH_ALT_DELTA" not in doc:
continue

# Read the entire file contents
Expand All @@ -559,7 +559,7 @@ def update_parameter_documentation(doc: Dict[str, Any], target: str = '.',

def update_parameter_documentation_file(doc, sort_type, param_default_dict, param_file, lines): # pylint: disable=too-many-locals
new_lines = []
if os_path.basename(param_file).endswith("16_pid_adjustment.param"):
if os_path.basename(param_file).endswith("17_pid_adjustment.param"):
new_lines.extend(lines[0:7]) # copy the first 8 lines verbatim

total_params = 0
Expand Down Expand Up @@ -641,7 +641,7 @@ def main():
xml_dir, LUA_PARAM_DEFINITION_XML_FILE)
doc_dict = create_doc_dict(xml_root, args.vehicle_type, args.max_line_length)
update_parameter_documentation(doc_dict, os_path.join(os_path.dirname(args.target),
"24_inflight_magnetometer_fit_setup.param"))
"25_inflight_magnetometer_fit_setup.param"))
except Exception as exp: # pylint: disable=W0718
logging.fatal(exp)
exit(1) # pylint: disable=R1722
Expand Down
8 changes: 4 additions & 4 deletions MethodicConfigurator/param_pid_adjustment_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ def parse_arguments():
It loads three sets of parameters from files in the DIRECTORY directory:
00_default.param - the (complete) default parameters,
optimized_param_file - the (complete) optimized parameters, and
16_pid_adjustment.param - the (intermediate) PID adjustment parameters.
17_pid_adjustment.param - the (intermediate) PID adjustment parameters.
It calculates the PID adjustment parameter values based on the ADJUSTMENT_FACTOR argument.
It updates the intermediate parameter file 16_pid_adjustment.param with parameter comments
It updates the intermediate parameter file 17_pid_adjustment.param with parameter comments
explaining how their new value relates to the default parameter value.
""")
parser.add_argument("-d", "--directory",
Expand Down Expand Up @@ -155,7 +155,7 @@ def update_pid_adjustment_params(directory: str, optimized_param_file: str, adju
"""
default_param_file_path = os.path.join(directory, "00_default.param")
optimized_param_file_path = os.path.join(directory, optimized_param_file)
pid_adjustment_file_path = os.path.join(directory, "16_pid_adjustment.param")
pid_adjustment_file_path = os.path.join(directory, "17_pid_adjustment.param")

# Load the default parameter file into a dictionary (comment source)
default_params_dict, _ = Par.load_param_file_into_dict(default_param_file_path)
Expand Down Expand Up @@ -203,7 +203,7 @@ def main():
# export the updated PID adjust parameters to a file, preserving the first eight header lines
Par.export_to_param(pid_adjustment_params_dict, pid_adjustment_file_path, content_header)
# annotate each parameter with up-to date documentation
subprocess.run(['./annotate_params.py', os.path.join(args.directory, "16_pid_adjustment.param")], check=True)
subprocess.run(['./annotate_params.py', os.path.join(args.directory, "17_pid_adjustment.param")], check=True)


if __name__ == "__main__":
Expand Down
4 changes: 2 additions & 2 deletions unittests/param_pid_adjustment_update_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def setUp(self):
os.mkdir(self.test_dir)
# Create a default, adjustment and optimized parameter file for testing
self.default_param_file = os.path.join(self.test_dir, '00_default.param')
self.adjustment_param_file = os.path.join(self.test_dir, '16_pid_adjustment.param')
self.adjustment_param_file = os.path.join(self.test_dir, '17_pid_adjustment.param')
self.optimized_param_file = os.path.join(self.test_dir, 'optimized_parameter_file.param')
with open(self.default_param_file, 'w', encoding='utf-8') as f:
f.write('PARAM1,1.0\nPARAM2,2.0\nPARAM3,3.0\n')
Expand Down Expand Up @@ -296,7 +296,7 @@ def test_empty_adjustment_file(self):
with self.assertRaises(SystemExit) as cm:
update_pid_adjustment_params(self.test_dir, os.path.basename(self.optimized_param_file), 0.5)
self.assertEqual(cm.exception.args[0],
"Failed to load PID adjustment parameters from test_directory/16_pid_adjustment.param")
"Failed to load PID adjustment parameters from test_directory/17_pid_adjustment.param")

def test_zero_default_value(self):
# Set a parameter in the default parameter file to zero
Expand Down

0 comments on commit 9082aad

Please sign in to comment.