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:
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.
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.
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.
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.
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.
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.
Note that this pull request depends on https://github.com/bitcraze/crazyflie-lib-python/pull/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:
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 usingParamFileManager.read
and sets the parameter values accordingly.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 usingParamFileManager.write
.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 usingself.cf.param.persistent_clear
. It uses a callback functionis_stored_cleared
to handle the result of the clearing operation and anEvent
objectwait_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.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.
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.