-
Notifications
You must be signed in to change notification settings - Fork 34
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
Support flat storage for single-state machines #31
base: master
Are you sure you want to change the base?
Conversation
In this common use case, where a library state-machine consists of just one ExecutionState, the regular folder structure results in a lot of duplicated information, and is nested an extra level unnecessarily. These changes these kinds of state machines to be stored in a single directory with no subdirectories. Storage code evaluates whether a state machine is of this type by noticing the absence of "root_state_storage_id" and looking for a state in the current folder in this case. Saving will adopt this format if the state machine contains exactly one state and the state is an ExecutionState
Hi @nickswalker, thank you very much for your pull request! Before considering it for merging, could you please motivate the change a bit more? Personally, I don't see the point why we should add ~35 LOC, just to save one file and one folder in the data structure for a specific (yet often occuring) kind of state machine. Do you edit a state machine often directly in the file system? Do you often browse through the file system? |
Sure! Here are what I see as the main benefits:
All in all, the savings that's achievable with minor changes seems like a good value to me 😄 |
These are indeed all very good points. I am even thinking about applying this flat structure to all state machines, independent of the type of the root state. I will discuss this with my colleague. In general, I think we will release this in a new minor version. |
I talked to @sebastian-brunner and we agreed upon to entirely remove the first file system layer, as you suggest for If this OK to you, I would like to continue implementing it. If you sign the CLA ("as external contributor, you need to sign the Contributor License Agreement (CLA), which can be found in the root directory of the repository"), I will implement the changes based on your pull request. Otherwise, I will start a new branch. The idea is to move Next week on Wednesday, we will make the last patch release of the |
Thanks for your pr @nickswalker. I like the idea of building state machines that are either composed entirely of library states, or entirely of a single execution state. To really enforce no structure in a ExecutionState you have to make sure that nobody implements (in the worst case) whole state machines in pure python code in a single ExecutionState. Probably you have guidelines for that!? On top of that I like the idea of reducing the folder nesting, which makes the storage format more compact and thus ease versioning! |
I started to continue with your change on branch Handling of existing state machines is not yet working properly! @nickswalker: Feel free to test this! |
Notes from brief testing:
|
Yes, this is a good idea.
Resaving old state machines has not been handled yet in this pull request, but is on the agenda. We are currently quite busy due to upcoming events, so I cannot tell you when this will be finished. It will be part of a new minor release, but for this release we also want to remove some old code, which also takes time. You should be able to work with this branch and later use the new minor version without problems (as long as you do not resave old state machines). |
…lop' do not create already existing transitions Closes DLR-RM#31 See merge request dev/sys/tci/rafcon!27
The previous mentioned commit (AgileRobotsAG@5b589ba) states to close this open issue. However, I couldn't identify any of the proposed changes mentioned in this pull request to be added with the previously mentioned commit. |
In our use case, we'll create a lot of library states which are stand alone
ExecutionState
s tied to our robot's capabilities. As it stands, we'd have a folder structure like this:This is pretty heavy wrapping for a single script file, so we'd greatly prefer a structure like this:
This PR has changes to support this layout. The loading code evaluates whether a state machine is of this type by looking for a state in the current folder whenever "root_state_storage_id" is absent. Saving will adopt this format if the state machine contains exactly one state and the state is an
ExecutionState
.Please do feel free to recommend alternative implementations. Just wanted to start a discussion about this as a possible convenience.
Please make sure that you can tick the following items at latest before
merging the pull request:
For reviewers: