Draft
Conversation
Fails, because we cannot re-pass the body block into next loop iterations. Error: Not enough blocks
This allows recursive calls with identical block args, i.e. loop works. However, I had to drop early evaluation of body (which is conceptually wrong, I believe). This breaks test_pr2 and test_should_replace_before_macroexpand!
This is required for using properties within the block that are only defined in the header of the calling macro (before calling insert_block). However, the old code (e.g. test_should_replace_before_macroexpand) now fails with `maximum recursion depth exceeded while calling a Python object` due to infinite recursion.
Contributor
|
This is interesting, would be a great feature! Many of the issues I've posted to this repo (back to Jan or Feb 2021) were all relating back to some unusual ways I was using xacro, the main one of which was using it to perform looping operations - particularly over arbitrarily sized lists in yaml configurations. I think in at least one of them I mentioned the desire for this, but I lack the python expertise/familiarity with this repo (and time, mainly time) to try it myself. I ended up doing some other terribleness for speedups (parallelized runs of multiple xacro calls which I stitch together at the end). If I ever have the time I'll try to look into it more. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As pointed out by @captain-yoshi in #280 (comment) xacro can be used to realize loops:
However, it would be even nicer if we could define a generic
loopmacro like this:and then just call it with an arbitrary body:
The attached commits are two (failed) attempts to achieve this. The culprit is the recursive handling of nested macros, which seems to be required to due lazy evaluation of the first generation of xacro.