Skip to content
Merged
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
37 changes: 33 additions & 4 deletions autotune/data_selection_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,30 @@ def __init__(self, filename):
"input": "vehicle_rates_setpoint/yaw.0",
"output": "vehicle_angular_velocity/xyz[2].0",
},
"GimbalRollRate": {
"input": "motor_state/roll.effort_cmd.0",
"output": "motor_angular_rates/roll.angular_rate.0",
},
"GimbalPitchRate": {
"input": "motor_state/pitch.effort_cmd.0",
"output": "motor_angular_rates/pitch.angular_rate.0",
},
"GimbalYawRate": {
"input": "motor_state/yaw.effort_cmd.0",
"output": "motor_angular_rates/yaw.angular_rate.0",
},
"GimbalRollAtt": {
"input": "motor_control/motor_commands.roll.angular_rate_setpoint.0",
"output": "attitude_info/roll.0",
},
"GimbalPitchAtt": {
"input": "motor_control/motor_commands.pitch.angular_rate_setpoint.0",
"output": "attitude_info/pitch.0",
},
"GimbalYawAtt": {
"input": "motor_control/motor_commands.yaw.angular_rate_setpoint.0",
"output": "attitude_info/yaw.0",
},
}

self.presets = {}
Expand Down Expand Up @@ -168,10 +192,12 @@ def openFile(self):
self.combo_y.clear()
self.combo_y.addItems(list_names)

# Trigger preset selection
# Trigger preset selection. If no preset matches the available
# topics, leave the input/output combos for manual configuration.
self.fillPresets()
self.combo_preset.setCurrentIndex(0)
self.selectPreset(0)
if self.presets:
self.combo_preset.setCurrentIndex(0)
self.selectPreset(0)

def fillPresets(self):
self.combo_preset.clear()
Expand All @@ -194,7 +220,10 @@ def printRangeError(self):
msg.exec_()

def selectPreset(self, index):
preset_key = list(self.presets.keys())[index]
preset_keys = list(self.presets.keys())
if index < 0 or index >= len(preset_keys):
return
preset_key = preset_keys[index]
preset = self.presets[preset_key]
(index_u, index_y) = self.findInputOutputIndex(preset)

Expand Down
Loading