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

Addition of persistent parameter saving, loading to file and clearing #706

Merged
merged 10 commits into from
Mar 25, 2024

Conversation

gemenerik
Copy link
Member

@gemenerik gemenerik commented Mar 14, 2024

Note that this pull request depends on bitcraze/crazyflie-lib-python#443

This pull request primarily focuses on the addition of parameter file loading and saving capabilities. These new features allow users to store and retrieve persistent parameter configurations to/from file, improving usability and efficiency. Furthermore, it adds a clear

Key changes include:

  1. Parameter File Loading: The _load_param_button_clicked method has been added, which allows users to load persistent parameters from a YAML file. The method reads the file using ParamFileManager.read and sets the parameter values accordingly.

  2. Parameter File Saving: The _dump_param_button_clicked method has been added, which allows users to save the current parameters to a YAML file. The method retrieves the current parameters and their values and writes them to the file using ParamFileManager.write.

  3. Persistent Parameter Clearing: The _clear_persistent_parameter method has been added, which allows users to clear a specific persistent parameter. The method sends a clear request for the given parameter to the Crazyflie using self.cf.param.persistent_clear. It uses a callback function is_stored_cleared to handle the result of the clearing operation and an Event object wait_for_callback_event to wait for the operation to complete. If the operation is successful, a message indicating the cleared parameter is printed. If the operation fails, a failure message is printed.

  4. Parameter IO GUI: The parameter tab has been updated to include buttons for loading and saving parameter files, and for clearing the stored persistent parameters. These buttons are enabled or disabled based on the connection state.

  5. Error Handling: If setting a parameter value or storing a parameter persistently from a loaded file fails, a warning message is displayed to the user.

@gemenerik gemenerik marked this pull request as ready for review March 14, 2024 14:54
@tobbeanton
Copy link
Member

The code looks good but I have some comments on the UI:

  • Would be nice to have a "are you sure" dialog when pressing the clear button to not accidentally clear it.
  • Better feedback when dump/load would be nice as well as it is very silent now. Perhaps a pop-up window displaying the parameter:value that were dumped/loaded.

@tobbeanton tobbeanton merged commit 6897a39 into master Mar 25, 2024
1 check passed
@tobbeanton tobbeanton deleted the rik/persistentparameterfilestorage branch March 25, 2024 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants