AgentStateRouter
Connects the node's one position, the AgentStateCourier of each paired client, and the path follower.
| Inherits | QObject |
| Group | agent |
Declared in src/libs/libagent/agent/services/AgentStateRouter.hpp.
Detailed description
The owner ruled on 2026-10-18 that a node keeps one current position. The router applies that ruling on the Agent. It does two things:
- It copies each change of the NodePosition into the AgentStateCourier of every paired client. A client that pairs later gets the last position at once. So every Remote sees where the robot is.
- It gives the PathFollower the node's position and the courier of the controlling client. The follower reads the mode, the control flags, the target and the autonomous stanza id from that courier. AgentRuntimeService makes a new follower each time it starts, and the router takes each new one (setAgentRuntimeService()).
The controlling client
The controlling client is the client that changed a control parameter last: Mode, ControlFlags, TargetPosition or AutonomousStanzaId (AgentStateCourier::controlChanged). This is the rule that the Agent's face uses for the display flags of several Remotes: the newest write wins. So a second Remote that sets the mode to manual stops a mission that the first Remote started.
When the controlling client goes away, no client controls, and the follower goes idle with a final (0, 0). The router does not give the control to an older client, because that client's old mission would start the robot again with no new command. A client takes the control when it changes a control parameter.
The router keeps no courier alive. It observes each one with a QPointer, and drops it when it is destroyed or not in setCouriers() any more.
See also NodePosition, PathFollower, AgentStateCourier, Agent.