Command Handling
Command handshake
A changed cmd_seq identifies every new command. Changing payload data or
cmd_id alone does not create a request.
- Write all payload fields.
- Write
cmd_id. - Increment
cmd_seqonce. Wrap-around from65535to0is valid. - Wait for
ack_seq == cmd_seq. - Wait for
last_req_seq == cmd_seq. - Evaluate
last_req_status.
Interpret the result using last_req_status Values.
The PLC need not observe every intermediate status: a command can finish
before the next PLC scan. After reading the final result, the PLC may write
cmd_id = NONE without incrementing cmd_seq.
Keep one request outstanding at a time and hold its command and payload
unchanged until the matching final result. After connecting or restarting the
PLC program, read ack_seq before choosing the next sequence; a reused
sequence does not start a new request. On a timeout or connection loss, check
the Robot and result state before deciding whether to send a new request.
Do not automatically repeat a motion command.
DONE reports completion of the command handler. A started Flow or movement
may still be active; use the published state and feedback to follow it.
SET_BRAKES example
- Write
robco_core_out.flags.brakes_closed. - Write
SET_BRAKEStorobco_core_out.command.cmd_id, using the value in cmd_id Values. - Increment
robco_core_out.command.cmd_seq. - Apply the command handshake above.
All commands use this mechanism.