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

Draft: Tobi Dance Branch #48

Draft
wants to merge 116 commits into
base: master
Choose a base branch
from
Draft

Draft: Tobi Dance Branch #48

wants to merge 116 commits into from

Conversation

frehe
Copy link
Member

@frehe frehe commented Dec 14, 2022

This branch implements

  • A new cost function type for CartPole, to which one can specify a trajectory path to follow along the MPC horizon
  • Dynamic updates of optimization attributes. While the simulator GUI is running, one can now edit the configuration files. Once saved, it updates the changed values.

marcinpaluch1994 and others added 28 commits November 24, 2022 16:17
made target position slider window less tall.
added hint to turn off TF JIT for getting going
…mass M to m_cart and cart pole mass m to m_pole

added comments about meaning of "stage" in MPPI
renamed TargetPositionGenerator to TargetTrajectoryGenerator, since we target a complete trajectory, not just cart position.
renamed my_logger() to get_logger()
say which compiler we are using
add check for existing terminate_experiment field
add docstring
…istency with other config files.

added more docstrings for undocumented methods and constructors.
added updated_attributes to barebones controller.
improved formatting of logging output
added dictdiffer to requirements.txt
renamed target_position cost function to cartpole_trajectory_cost.py.
replaced some load_config with the load_or_reload_config_if_modified, so that the configs are cached for change checking.
added logger to Compile.py
…g and the cartpole is at least balancing itself and swinging up from down position. Big changes all over!

Now anytime any of the config files is modified during runtime, the using class has its tf.variable assigned the new value.
To get this work, the variable MUST NOT EXIST before it is set this way the first time. Otherwise the compiler just uses the field at compile time and the changes are never seen inside.
The cartpole window now does not reset the initial position and angle sliders on each start.
…hanging the cost weights during runtime! Yay, finally!

Trick was to make sure that all values are actually propagated to tf variables, e.g. numpy arrays, ints, string, not just float

Changed logging format to start with level for better readability.
added string type to computation_library.py
…nfig values in cartpole_trajectory_generator.py.

added dt to params in cartpole_trajectory_generator.step() call.
…on and equilibrium from updated attributes before they were updated in controller
…xtrapolate it, and added option for using terminal cost or entire trajectory cost in cartpole_trajectory_cost.py.

added more params to config_cost_functions.yml.
fiddled with logging colors.
changed yaml loader to one that can deal with scientific format numbers (ruamel.yaml)
@frehe frehe added the enhancement New feature or request label Dec 14, 2022
@@ -140,7 +142,7 @@ def __init__(self, initial_state=s0, path_to_experiment_recordings=None):
# region Variables controlling operation of the program - should not be modified directly
self.save_flag = False # Signalizes that the current time step should be saved
self.csv_filepath = None # Where to save the experiment history.
self.controller = None # Placeholder for the currently used controller function
self.controller:template_controller = Optional[None] # Placeholder for the currently used controller function
Copy link
Member Author

@frehe frehe Dec 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.controller:template_controller = Optional[None] # Placeholder for the currently used controller function
self.controller: "Optional[template_controller]" = None # Placeholder for the currently used controller function

tobidelbruck and others added 30 commits February 17, 2023 16:08
…n starting and freefall (during). This trajectory seems to work in simulation
corrected math of computation of cartpole pole kinetic energy (was incorrect by factor of 2)
added check to CartPoleGUI_MainWindow to check that status text is not None before setting it.
edited mp3s of cartpole_dancer but there should be no change
updated satisfaction CSV to use markers from audition and added more cartsheels
# Conflicts:
#	Control_Toolkit
#	Control_Toolkit_ASF/Cost_Functions/CartPole/cartpole_dance-satisfaction.csv
fixed import of CompileTF in optimizer_rpgd_tf.py.
other small code changes and comments
line seps in firmware changed to linux
… that it is shown in live console display instead of scrolling away.

fixed cartonly trajectory so that cartonly works with sawtooth much better.
changed PhysicalCartPoleDriver.py logger so that the handler logs with \r like other status indicators.
added another exception handler in globals_and_utils.py to handle AttributeErrors in config files.
Optimized shimmy amplitudes in satisfaction
…name in console logger for logging during control
changed cartwheels to toandfro in satisfaction dance.
fixed detection of var type to handle float and tf.Variable.
…or for compatibilty with RPGD gradient computation.

update_attributes in globals_and_utils.py supports assignment of tf.Variable and now raises exception if we try to .assign an immutable Tensor.
Balance step now uses int +1 or -1 for desired pole up or down, not 'up' or 'down'.
computation_library.py now casts variale to numpy() from tensorflow only if it is a Tensor type.
added check for unavailability of sound output in case of running in WSL2.
added paths to run from command line correctly.
added several requirements to requirements.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants