Skip to content

Commit

Permalink
Added different parameter options for different gains. If there are o…
Browse files Browse the repository at this point in the history
…ther options we want to change based on the gains, we can add them there as well.
  • Loading branch information
josephward committed Apr 9, 2024
1 parent f95727c commit ea4e4f4
Showing 1 changed file with 39 additions and 5 deletions.
44 changes: 39 additions & 5 deletions rosplane_tuning/src/autotune/autotune.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,45 @@ def __init__(self):
# Optimization
self.initial_gains = None # get_gains function cannot be called in __init__ since the node
# has not yet been passed to the executor
self.optimization_params = {'u1': 1e-3,
'u2': 0.5,
'sigma': 2.0,
'alpha': 0.05,
'tau': 1e-2}

# As we conduct optimizations, these parameters will be changed to be more
# efficient to optimize the specific gains, based on the design spaces.
if self.get_parameter('current_tuning_autopilot').value == 'roll':
self.optimization_params = {'u1': 1e-3,
'u2': 0.5,
'sigma': 2.0,
'alpha': 0.05,
'tau': 1e-2}
elif self.get_parameter('current_tuning_autopilot').value == 'course':
self.optimization_params = {'u1': 1e-3,
'u2': 0.5,
'sigma': 2.0,
'alpha': 0.05,
'tau': 1e-2}
elif self.get_parameter('current_tuning_autopilot').value == 'pitch':
self.optimization_params = {'u1': 1e-3,
'u2': 0.5,
'sigma': 2.0,
'alpha': 0.05,
'tau': 1e-2}
elif self.get_parameter('current_tuning_autopilot').value == 'altitude':
self.optimization_params = {'u1': 1e-3,
'u2': 0.5,
'sigma': 2.0,
'alpha': 0.05,
'tau': 1e-2}
elif self.get_parameter('current_tuning_autopilot').value == 'airspeed':
self.optimization_params = {'u1': 1e-3,
'u2': 0.5,
'sigma': 2.0,
'alpha': 0.05,
'tau': 1e-2}
else:
raise ValueError(self.get_parameter('current_tuning_autopilot').value +
' is not a valid value for current_tuning_autopilot.' +
' Please select one of the' +
' following: roll, course, pitch, altitude, airspeed.')

self.optimizer = None


Expand Down

0 comments on commit ea4e4f4

Please sign in to comment.