Skip to main content

Stops and safety

This page covers how a client requests, reads and recovers from a stop, and what the stack does not guarantee.

Kinds of stop​

StopTriggered byWhat the robot doesRecovery
Trajectory cancelCancelling the running goalFollows the active trajectory controller's cancel behaviorNone needed. Stays in TRAJECTORY
Brake stopplem/set_mode(BRAKED) or protective_stop in plem/control_commandStarts engaging the brakes, with no deceleration phaseset_mode again
Protective StopThe stack trips it itself (causes)Cuts torque and engages the brakesManual: Recovery
Command-stale holdInternal command updates stop for more than 100 ms while the robot movesHolds the current pose with torque (not the brakes)Automatic when commands flow again

How the robot mode changes:

  • A BRAKED request skips deceleration, because the brakes are the last-resort stop that needs no other thread to cooperate.
  • Only TRAJECTORY → FREEDRIVE decelerates (STOPPING). If that does not finish within 2 s, the stack engages the brakes and drops to BRAKED instead of the requested mode.
Judge stops by state, not by results or events

Action results and rt_events can both disagree with what the robot did, and events can be dropped. Decide whether the robot is stopped, and whether a stop has cleared, only from status_broadcaster/safety_mode and status_broadcaster/robot_mode.

BRAKED does not mean stopped

robot_mode turning BRAKED means the brakes have started engaging. The fieldbus layer engages them over several cycles. Check that the robot is still from the velocities in joint_states.

There is no topic for brake state. The plem/set_joint_brake action, which opens and closes brakes per joint, returns a state, but that only says the drive finished its state change in software. It does not check the physical contact.

warning
set_joint_brake is not for normal operation

It is a direct maintenance interface and prepares neither the mode nor the controllers. Use plem/set_mode for normal operation.

  • A release goal (engage: false) is accepted only in TRAJECTORY or FREEDRIVE, because with no holding torque the joint would drop when the brake opens.
  • During a mode change (STOPPING), both release and engage goals are rejected.
  • Even when accepted, brakes move per group. On modular brake hardware, joints you did not name in the same group open or close too.

Mode change rules​

How the plem/set_mode action handles goals and cancels:

RequestResult
CancelRejected
A goal for the current modeThe goal itself is rejected
TRAJECTORY or FREEDRIVE while another change is runningRejected
BRAKED while another change is runningAccepted, and it cuts that change off
BRAKED while another controller owner holds the robotAccepted
TRAJECTORY or FREEDRIVE while the Jog lane (joint_target_stream_controller) is activeStops the Jog lane, waits until the arm is measured still, then switches. Aborts if it does not stop within 5 s

When BRAKED cuts off a running change, the cut goal aborts with "preempted by BRAKED", and BRAKED tries to deactivate the controller that goal was activating. A goal that was about to finish may end SUCCEEDED instead. BRAKED's own controller cleanup is never cut off.

A BRAKED change also tries to deactivate the motion controllers after the mode changes. The goal succeeds even if that step fails. If you need the controller state, check controller_manager/list_controllers.

release_brake and free_drive in plem/control_command bypass the action server and change only the sub-mode and brakes. They do not switch controllers for the target mode or hand over the Jog lane. To actually run trajectories or use Freedrive, use plem/set_mode. protective_stop sent in the same request as release_brake or free_drive only stops: the other commands, reset_error included, are dropped and the call returns failure.

PLEM software can neither trigger nor read the physical Emergency Stop. Its behavior and recovery follow the robot's safety manual. If the button takes a running axis out of Operation enabled, the stack sees only that result and trips a Protective Stop (causes). The interfaces are not designed for a client to tell it apart from other stops.

What happens to a running trajectory​

In BRAKED or Protective Stop, the hardware layer ignores the trajectory controller's commands and overwrites them with the measured position, so the robot stops. How the running FollowJointTrajectory goal ends is not decided by this stack:

  • An explicit BRAKED change tries to deactivate the motion controllers, and may still end in success if that fails (above).
  • An automatic Protective Stop does not go through the mode server, so the controllers stay active.
The gripper does not stop with the arm

The gripper is an action server that runs apart from the arm's mode and safety state. A running gripper goal is not cancelled when the arm goes BRAKED or into Protective Stop. Cancel the gripper goal yourself if it must stop too. The stop command is sent at the gripper server's next status poll, which runs every 50 ms or 100 ms depending on the gripper driver.

Command-stale hold​

If internal command updates in the control stack stop for more than 100 ms while the robot moves, the stack fixes the current pose as the target and holds it with torque, because cutting torque would let gravity pull the arm down. This is not a Protective Stop.

  • The hold covers faults inside the control stack. A dead external client does not cause it, because the hardware interface sends commands to the real-time layer every cycle and refreshes their timestamp.
  • Once on, the hold stays until new commands arrive, even if the robot has stopped.
  • It never engages in FREEDRIVE, where torque toward a fixed target would fight the operator's hand.
The robot does not stop by itself when a client disappears

To stop a running motion, cancel the goal or request BRAKED. Your application has to do this.

Protective Stop​

The stack trips a Protective Stop itself. The robot mode is forced to BRAKED and is not restored automatically.

The Robot Control screen during a Protective Stop. The status bar shows a red ■ P-STOP on ballet_1, SYSTEM shows Mode BRAKE and a red Safety P-STOP, the robot row shows a red P-STOP, the log shows [RT] PROTECTIVE_STOP severity=ERROR and [RT] BRAKE_ENGAGE severity=WARN, and the key hint line has a red R Recover.

This is how the TUI shows it. A program gets the same facts from safety_mode and rt_events.

safety_mode does not tell the causes apart. Every Protective Stop leaves a common PROTECTIVE_STOP in rt_events, plus a cause event when there is one:

CauseCause event
Joint position or velocity limit violated (per the URDF)None
Protective floor violated: the lowest point of the robot and tool collision shapes is below the configured floor height (robots with the floor on)PROTECTIVE_FLOOR_VIOLATION (joint_id = segment index, value = lowest vertex z on the detecting cycle minus a margin of a few mm [m]; none if the pose could not be evaluated)
Disturbance overload (below)DISTURBANCE_OVERLOAD
NaN or infinity in a received targetTARGET_COMMAND_INVALID
Computed torque is invalidTORQUE_OUTPUT_INVALID
EtherCAT working counter errors persistWKC_MISMATCH
Torque commands to the real-time layer go staleCOMMAND_STALE
Control cycle over budget (devices with a budget set)CONTROLLER_BUDGET_EXCEEDED
While running (brakes released), an axis leaves Operation enabled, for example on a drive faultOPERATION_ENABLED_LOST (0x61, error_code = that axis's statusword)
While running, an axis leaves its declared mode of operationMODES_OF_OPERATION_MISMATCH (0x5F)
  • With no cause event (a joint limit, or a floor check that could not evaluate the pose), only the common event shows. Comparing the current joint_states with the URDF limits can suggest a position limit; a velocity violation or evaluation failure cannot be confirmed afterwards.
  • WKC_MISMATCH also appears without a stop, because a Protective Stop trips only when the error persists. Some clear paths emit no PROTECTIVE_STOP_CLEAR.

Recovery​

During a Protective Stop only BRAKED and FREEDRIVE can be entered. set_mode(TRAJECTORY) and release_brake are rejected.

  1. Confirm the Protective Stop in safety_mode and find the cause in rt_events.
  2. Remove the cause. If the robot is caught on a limit or an obstacle, switch to FREEDRIVE and guide it by hand to a safe pose. If it stopped below the protective floor, lift it above the floor: while it is below, both a reset and the return to BRAKED trip again on the next control cycle.
  3. Clear the stop with reset_error in plem/control_command. If you used FREEDRIVE in step 2, returning to BRAKED clears it too, because the operator is taken to have confirmed a safe pose.
  4. Check that safety_mode is back to NORMAL. A successful service response does not mean recovery. If the cause remains, the stop trips again on the next control cycle.
  5. Enter an operating mode again with plem/set_mode. reset_error does not change the robot mode. If the stop has cleared but the robot is not moving, confirm it is back in BRAKED, then request the target mode again.

The Teaching Pendant recovery button sends this same reset_error. The steps on each screen are in Clearing a Protective Stop and TUI recovery. With several robots, one robot's Protective Stop does not stop the others. Your application has to stop them together if needed.

A Jog lane left after a Protective Stop

An automatic Protective Stop does not go through the mode server, so joint_target_stream_controller can stay active. Entering FREEDRIVE or TRAJECTORY through plem/set_mode stops that lane, waits until the arm is still, then deactivates it, so you do not need to do it yourself. free_drive in control_command skips this, so do not use it while the lane is still active.

Fault reset​

Every reset_error requests two things: a new drive fault reset, and a software Protective Stop clear. If the cause remains, as with a joint limit violation, the clear is refused, the Protective Stop stays, and rt_events records a Protective Stop event with error_code 1.

Per axis, SERVO_FAULT_RESET_RESULT (0x60) in rt_events tells whether the request reached the drive: written (INFO), dropped because the axis was not in fault (INFO, normal during recovery), or dropped because the statusword could not be decoded (ERROR). PLEM does not resend a dropped request; send a new one if needed. This event can be dropped too.

If an axis faults while the brakes engage or release:

ModelWhat happens
NeuromekaNo automatic reset. The sequence waits at that axis. Fix the cause, then send reset_error
Huayan ElfinRequests a reset about every 200 ms while the fault lasts, up to 25 times per fault. Each request logs SERVO_FAULT_RESET (0x58), and running out logs SERVO_FAULT_RESET_EXHAUSTED (0x59). Neither proves the drive actually reset

Drives that will not clear, and held shutdown​

If a drive stays in a state PLEM cannot move past, such as Quick stop active, that axis's brake sequence stops there. There is no command yet to clear such an axis, and no verified recovery procedure. A drive Fault is different: fix the cause and reset it with reset_error (above).

BRAKE_SEQUENCE_STALLED (0x5C) in rt_events names the axis that could not proceed: error_code is its statusword, value the step it did not reach. It does not say why.

Models that declare brake groups (currently Huayan Elfin) switch the robot to BRAKED on stack shutdown and hold the shutdown until every brake group confirms engagement. Neuromeka robots shut down without this hold.

  • While holding, they keep requesting engagement and log brake engage UNCONFIRMED — shutdown HELD with each axis's statusword.
  • A second shutdown signal (SIGINT and SIGTERM count together) makes them proceed without confirmation. When you stop with plem or ros2 launch, the SIGTERM that launch sends shortly after is that second signal, so the hold does not wait for the operator.

Treat any brake whose engagement was not confirmed as open.

Check the robot has stopped before you shut down

Whatever the model, check by eye that the robot has stopped before you shut the stack down. If a drive will not clear, support the arm first. When software could not confirm that an axis's brake engaged, its physical brake is unconfirmed too.

Brake release refused​

A brake release request (TRAJECTORY or FREEDRIVE through plem/set_mode, or release_brake) does not start at once even after the other checks pass. It starts the enable sequence only when every axis of the requested brake group meets both conditions in that cycle:

ConditionCheck
Accepted in its declared mode of operationInitialized · statusword recognized · 0x6061 == declared
The axis's EtherCAT slave is in OPThe slave state the master reports (no pending reconfiguration)

If any axis fails, the whole request is dropped, not deferred, and for each failing axis the stack tries to log an event. Requests blocked by other checks are dropped without an event.

EventWhenerror_codevalueWhat to do
SLAVE_NOT_OPERATIONAL (0x62)The slave is not in OPThe slave's AL state (0 = offline or query failed)Ring positionRight after launch the slave may still be on its way to OP: request again shortly. Otherwise check the kernel log (sudo dmesg | grep -i ethercat) for an AL status code or a rejected startup SDO
MODES_OF_OPERATION_MISMATCH (0x5F)Any other non-acceptanceThe axis's statusword0x6061 display valueAn observation, not a diagnosis of the cause
  • A refusal by itself trips no Protective Stop. Without another stop, safety_mode stays NORMAL.
  • plem/set_mode succeeds once the robot mode changes, so robot_mode can read TRAJECTORY or FREEDRIVE while the brakes are still engaged.
  • When acceptance comes back, nothing is released by itself and reset_error does not resend it. Clear any Protective Stop first (Recovery), switch to BRAKED and confirm it, then request the target mode again. Skipping BRAKED fails: a goal for the current mode is rejected.

An axis that drops out while running (Operation enabled) is handled differently: the stack requests a Protective Stop and starts or continues engaging all brakes on the next brake step, with the same BRAKED limits as above. It is logged as the same 0x5F; follow Recovery.

Disturbance overload guard​

During motion the stack estimates the external torque on each joint. If it stays over that joint's budget for 200 ms or longer, the guard trips a Protective Stop. Short spikes do not trip it.

  • The budget comes from the URDF effort and velocity limits and grows with speed, so it is strictest at standstill.
  • There is no parameter and no on/off switch.
  • It judges only with a controller that has an observer (the default, ADRC), and only in cycles where torque control actually ran: not in BRAKED, FREEDRIVE or an active Protective Stop. Under control it judges even when the arm is still.
Not a certified collaborative safety function

The guard works from current-based estimates, so friction and model error mix with real contact. It is there to protect the machine. ISO 10218-class force and power limiting is the robot safety controller's job.

Limits of plan-time checks​

PlanTrajectory checks only at planning time: joint limits and Pilz self-collision and static-object validation. There is no workspace box check, no continuous monitoring during execution, and it is not a safety-rated function. Keeping the robot physically inside a workspace is the job of the robot safety controller or an external safety PLC.

Trajectories you build yourself skip these checks entirely, and on some models success does not mean the target was reached. Both are in the client rules of ROS 2 interfaces.