Remote robot state and commands - best patterns, practices?
I have a use case where I'm able to remotely control a robot via a SPA frontend and dotnet API + robot API. The UI can dispatch actions like undock, dock, power off, sit, stand, move, rotate (with joysticks). But commands require state and state transitions to occur before they're valid. The UI should be aware of these state transitions so buttons can be disabled, the user can be notified that something is happening, etc. I can access the robot state by polling an API or I can embed C# code on the robot that runs every tick and pushes updates to our API when things change.
I was considering putting a singleton class which holds the current state and owns state transitions using state pattern on the robot C# payload. Then all our API calls would go through that class, which would then broadcast events back to our API when things changed. But I have almost no experience in this domain. Is there some framework or design pattern that's standard for this pattern? Just some things to Google is fine if anyone knows!
0 Replies