Skip to content

Is it possible to have the machine call all required transitions to achieve desired state #679

Closed Answered by aleneum
Whytey asked this question in Q&A
Discussion options

You must be logged in to vote

I just checked the pydot documentation and found a way to process the dotstring directly:

import networkx as nx
import graphviz
import pydot
from transitions.extensions import GraphMachine


print(f"Graphviz: {graphviz.__version__}")  # >> Graphviz: 0.20.3
print(f"PyDot: {pydot.__version__}")  # >> PyDot: 2.0.0


states = ["STANDBY", "MOWING", "PAUSED"]


transitions = [
    {"trigger": "StartMowing", "source": "STANDBY", "dest": "MOWING"},
    {"trigger": "PauseWork", "source": "MOWING", "dest": "PAUSED"},
    {"trigger": "ContinueWork", "source": "PAUSED", "dest": "MOWING"},
    {"trigger": "CancelWork", "source": "PAUSED", "dest": "STANDBY"},
]


class NetworkXMachine(GraphMachine):
    

Replies: 4 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@aleneum
Comment options

Answer selected by Whytey
@aleneum
Comment options

@Whytey
Comment options

@aleneum
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants