Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEATURE: Add GNSS2 support #15

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

185 changes: 100 additions & 85 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
5 changes: 5 additions & 0 deletions MethodicConfigurator/frontend_tkinter_component_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ def update_json_data(self):
if 'Chemistry' not in self.data['Components']['Battery']['Specifications']:
self.data['Components']['Battery']['Specifications']['Chemistry'] = "Lipo"

if 'Components' not in self.data:
self.data['Components'] = {}
if 'GNSS receiver' in self.data['Components']:
self.data['Components']['GNSS receiver1'] = self.data['Components'].pop('GNSS receiver')

def set_vehicle_type_and_version(self, vehicle_type: str, version: str):
self.data['Components']['Flight Controller']['Firmware']['Type'] = vehicle_type
entry = self.entry_widgets[('Flight Controller', 'Firmware', 'Type')]
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# GNSS system configuration
# Bitmask for what GNSS system to use on the first GPS (all unchecked or zero to leave GPS as configured)
# Bitmask: 0:GPS,1:SBAS,2:Galileo,3:Beidou,4:IMES,5:QZSS,6:GLONASS
# Default: 0
GPS_GNSS_MODE2,7 # limit the constalations to ensure an update rate higher than 5Hz

# Antenna X position offset
# X position of the first GPS antenna in body frame. Positive X is forward of the origin. Use antenna phase
# centroid location if provided by the manufacturer.
# Units: m (meters)
# Range: -5 5
# Increment: 0.01
# Default: 0
GPS_POS2_X,0.056 # HX-CH7604A GNSS antenna pahse center location relative to CG

# Antenna Y position offset
# Y position of the first GPS antenna in body frame. Positive Y is to the right of the origin. Use antenna
# phase centroid location if provided by the manufacturer.
# Units: m (meters)
# Range: -5 5
# Increment: 0.01
# Default: 0
GPS_POS2_Y,0 # HX-CH7604A GNSS antenna pahse center location relative to CG

# Antenna Z position offset
# Z position of the first GPS antenna in body frame. Positive Z is down from the origin. Use antenna phase
# centroid location if provided by the manufacturer.
# Units: m (meters)
# Range: -5 5
# Increment: 0.01
# Default: 0
GPS_POS2_Z,-0.07 # HX-CH7604A GNSS antenna pahse center location relative to CG

# 1st GPS type
# GPS type of 1st GPS
# RebootRequired: True
# 0: None 15: NOVA
# 1: AUTO 16: HemisphereNMEA
# 2: uBlox 17: uBlox-MovingBaseline-Base
# 5: NMEA 18: uBlox-MovingBaseline-Rover
# 6: SiRF 19: MSP
# 7: HIL 20: AllyStar
# 8: SwiftNav 21: ExternalAHRS
# 9: DroneCAN 22: DroneCAN-MovingBaseline-Base
# 10: SBF 23: DroneCAN-MovingBaseline-Rover
# 11: GSOF 24: UnicoreNMEA
# 13: ERB 25: UnicoreMovingBaselineNMEA
# 14: MAV 26: SBF-DualAntenna
# Default: 1
GPS_TYPE2,2 # Defined in component editor

# Serial 4 (GPS) protocol selection
# Control what protocol Serial 4 (GPS) should be used for. Note that the Frsky options require external
# converter hardware. See the wiki for details.
# RebootRequired: True
# -1: None 25: LTM
# 1: MAVLink1 26: RunCam
# 2: MAVLink2 27: HottTelem
# 3: Frsky D 28: Scripting
# 4: Frsky SPort 29: Crossfire VTX
# 5: GPS 30: Generator
# 7: Alexmos Gimbal Serial 31: Winch
# 8: Gimbal 32: MSP
# 9: Rangefinder 33: DJI FPV
# 10: FrSky SPort Passthrough (OpenTX) 34: AirSpeed
# 11: Lidar360 35: ADSB
# 13: Beacon 36: AHRS
# 14: Volz servo out 37: SmartAudio
# 15: SBus servo out 38: FETtecOneWire
# 16: ESC Telemetry 39: Torqeedo
# 17: Devo Telemetry 40: AIS
# 18: OpticalFlow 41: CoDevESC
# 19: RobotisServo 42: DisplayPort
# 20: NMEA Output 43: MAVLink High Latency
# 21: WindVane 44: IRC Tramp
# 22: SLCAN 45: DDS XRCE
# 23: RCIN 46: IMUDATA
# 24: EFI Serial
# Default: 5
SERIAL4_PROTOCOL,5 # GNSS receiver is connected to serial4
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,23 @@
"Protocol": "uBlox"
},
"Notes": "A very good receiver with an excellent antenna https://docs.holybro.com/gps-and-rtk-system/gps-led-and-buzzer/status-led-changes"
},
"GNSS receiver2": {
"Product": {
"Manufacturer": "Holybro",
"Model": "H-RTK F9P Helical",
"URL": "https://holybro.com/products/h-rtk-f9p-gnss-series?variant=41466787168445",
"Version": "1"
},
"Firmware": {
"Type": "UBlox",
"Version": "1.13.2"
},
"FC Connection": {
"Type": "SERIAL4",
"Protocol": "uBlox"
},
"Notes": "A very good receiver with an excellent antenna https://docs.holybro.com/gps-and-rtk-system/gps-led-and-buzzer/status-led-changes"
}
}
}
Loading