Open Devansh1902 opened 5 months ago
Hi @Devansh1902, you can create an idle state that waits for service requests and change to another state when a request is received. Is this what you want?
Yes lets say foo state is the start state and from foo i want to go to bar with a service call and when in bar state also the transition should happen from another service call to change the state back to foo
So, in that case, should both states have a service or do you want only one service? For the first case, a new ROS 2-based state can be created, similar to the action and service client states.
Only one service in the default state and from that default state user can do a service call to change the state and then stay in the state till another service call comes to go back to default state
You can create a node with a service that controls the switch between the states by using a variable on the blackboard. So the states should wait for the service call.
please explain this line of code std::string outcome = (*sm.get())();
StateMachine object is got from the pointer and its operator () is called which returns an outcome.
i have several states but one is default one :
auto sm = std::make_shared
You should add an outcome to your state machine:
auto sm = std::make_sharedyasmin::StateMachine(yasmin::StateMachine({"End"}));
Then, you can add a transition from your Standby state to that outcome ({"outcome6", "End"}
).
sorry i didnt got you. for what we ll use the end ?
how can user change state from foo to bar using a service call please help