Skip to content

Constant userdata passing (or constant remapping) #89

Description

@jk-ethz

Is it possible to define transitions between states with constant userdata?

I want the input variable var1 of FOO to be set to test every time after executing BAR, without modifying the internals of BAR.
Something along the lines of:

smach.StateMachine.add('BAR', Bar(), 
                       transitions={'outcome1':'FOO'},
                       remapping={'bar_counter_in':'sm_counter'},
                       constants={'var1':'test'})

Or even making the remappings aware that if some key does not exist as an input or output of BAR, it should be treated as a constant:

smach.StateMachine.add('BAR', Bar(), 
                       transitions={'outcome1':'FOO'},
                       remapping={'bar_counter_in':'sm_counter', 'test': 'var1'})

Or even:

smach.StateMachine.add('BAR', Bar(), 
                       transitions={'outcome1':['FOO',{'var1': 'test'}]},
                       remapping={'bar_counter_in':'sm_counter'})

This would be VERY useful to me, as I have different instances of the same state pointing to another state, but depending on which instance I am coming from, I want different data to be passed in a constant manner.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions