Program the Real Arm · xArm 850 · Page 1 of 6
The Logic
Write the logic before the code. A state diagram and a sequence table show what the program does, what it checks before each move, and how it stops when something is wrong.
The logic names the start conditions, the states, the inputs and signals, the machine's actions, the timing and parameters, the decision points, the completion conditions, the fault and stop conditions, and the safe recovery1.
States
| State | Meaning | Leaves By |
|---|---|---|
READY | At home, no job running2 | START_JOB3 |
RUNNING | A job's cycle is running2 | PAUSE, STOP, a fault, or the job's end456 |
PAUSED | Motion held; the job and the vacuum kept as they are4 | RESUME or STOP4 |
FAULT | The run ended on an abnormal condition25 | Only STATUS and SHUTDOWN; a person recovers2 |
STOPPED | The operator stopped the arm24 | Only STATUS and SHUTDOWN2 |
Start Conditions
- Before a job the program reads the arm. It refuses with
NOT_READY, sending nothing, if the controller reports an error, the arm is not in position mode (Manual Mode is refused), or the tool point and payload are not the station file's 126 mm and 0.61 kg7. - With the real arm it does not even connect while a waypoint, the pick area, a stack, the floor, the workspace or a joint range is still a placeholder8.
One Cycle
- Home: a joint move to the home waypoint6.
- Room: the job's stack must have room for one more card, or the run ends in
STACK_FULL65. - Pick: above the pick pose, straight down, vacuum on; the card must be held, or
VACUUM_LOST65. - Carry: lift, then move above the variant's stack with the card still held6.
- Place: straight down onto the stack, vacuum off; the card must be released, or
RELEASE_FAILED65. - Return: straight up, home, and
CYCLE_COMPLETEwith the cycle time6.
The cycle repeats until the job's quantity is reached; then the program reports JOB_COMPLETE and returns to READY6. Before every move it checks the target against the station file's bounds and sends nothing if the target is outside them8.
The Sequence Table
| Step | Action | Checked | Agent Command |
|---|---|---|---|
home | Joint move to the home waypoint | The bounds; the controller after the move689 | MoveToNamedPose |
pick_hover | Joint move above the pick pose | The bounds; the controller689 | Pick |
descend | Straight down to the pick pose | Inside the pick area, above the floor, inside the joint ranges689 | Pick |
vacuum_on | Switch the vacuum on and wait | The controller69 | Pick |
verify_holding | Read whether the card is held | Held, or VACUUM_LOST65 | Pick |
lift | Straight up | Still held69 | Pick |
stack_hover | Joint move above the variant's stack | Still held69 | Place |
stack_place | Straight down onto the stack | The bounds; the controller689 | Place |
vacuum_off | Switch the vacuum off and wait | The controller69 | Place |
verify_released | Read whether the card is still held | Released, or RELEASE_FAILED65 | Place |
stack_retreat | Straight up above the stack | The controller69 | Place |
return_home | Joint move home; report CYCLE_COMPLETE | The controller69 | MoveToNamedPose |
Faults
| Code | How It Is Detected | The Program's Response | Recovery |
|---|---|---|---|
VACUUM_LOST | No card held after the vacuum is switched on (also how an empty corner stop shows), or the card lost while carried5 | Stops where it is and reports whether a card is on the cup10 | Wait until the arm has stopped, find the card, check the corner stop and the cup, then start again211 |
RELEASE_FAILED | The card is still held after the vacuum is switched off5 | Stops at the stack; the card stays on the cup10 | Switch the vacuum off in Studio and take the card off by hand122 |
STACK_FULL | The stack is already at its maximum5 | No move toward the card10 | Empty the stack and start the program again13 |
OUT_OF_BOUNDS | A target outside the station file's bounds5 | The move is never sent8 | Check the waypoint against the card's real position; never widen a bound to make a run pass142 |
ARM_ERROR | A controller error, the controller's own stop, a lost connection, or a move not finished in time5 | Sends nothing more, and does not clear the error or re-enable the arm10 | As in Abnormal Conditions: the error is cleared by hand and the motion re-planned15 |
NOT_READY | A controller error, Manual Mode on, or a tool point or payload unlike the station file's7 | Nothing is sent7 | Fix it in Studio as the message says, then start again2 |
With the camera extension, four more codes can occur: NO_PART, QC_REJECT, CAMERA_ERROR and VISION_ERROR5.
Pause, Stop and Safe Recovery
PAUSEholds the arm mid-move and keeps the job and the vacuum as they are;RESUMEcontinues4.STOPstops the arm and switches nothing off, so a held card stays held; the program reports whether it is4.- On any fault the program stops sending motion and reports. It never clears an error, re-enables the arm, changes a safety setting or retries a step10.
- Every run starts again from home; after a fault or a stop a person deals with the cause first102.
Warning
PAUSE and STOP are software stops that leave the arm powered. Neither is an emergency stop4.
Printed from https://www.anotherplace.com/learn/en/xarm-850/program/logic. Every line cites its source on that page.