Stop Behavior

For certain use cases, it might be necessary to configure the exact behavior of stopping a robot: how the robot decelerates when a stop is triggered, and how long it may take.

A stop can be triggered by different sources, for example a safety stop or a user stop. The stop behavior can be configured for each source independently. The available settings are the stop type and, for time-based stop types, the duration until the robot stops.

Stop Sources

The StopSource enum names the sources whose reaction can be configured:

Variant

Description

ErrorStop

Stop triggered by an error condition of the robot control.

UserStop

Stop triggered by the application: stop_motion(), pause_motion() or a jog whose keep-alive lapsed.

SS1

Safety stop (Safe Stop 1).

Stop Types

The StopType enum names the deceleration strategies:

Variant

Description

AxisStopRapid

Each axis stops as fast as possible, not synchronized.

AxisStopTimeBased

Each axis stops within the configured stop duration.

PathStopTimeBased

The robot decelerates along its current path within the configured stop duration.

Not every combination of stop source and stop type is supported: the user stop is always a path stop, so set_stop_type() rejects any other stop type for it with an InvalidArgument error. The stop duration is stored per source and only has an effect for the time-based stop types. It must lie between 0.1 s and 10 s (STOP_DURATION_RANGE); this range is validated at run time.

Configuring the Stop Behavior

The stop type of a source is set with set_stop_type(), its duration with set_stop_duration():

robot.set_stop_type(StopSource::SS1, StopType::AxisStopRapid)?;
robot.set_stop_type(StopSource::ErrorStop, StopType::AxisStopTimeBased)?;
robot.set_stop_duration(StopSource::ErrorStop, Duration::from_millis(500))?;
robot.set_stop_duration(StopSource::UserStop, Duration::from_secs(1))?;

The configuration is read back with stop_type() and stop_duration():

let stop_type = robot.stop_type(StopSource::SS1)?;
if stop_type != StopType::PathStopTimeBased {
    return Err(ExampleError::StopTypeNotSet {
        expected: StopType::PathStopTimeBased,
        actual: stop_type,
    });
}
let stop_duration = robot.stop_duration(StopSource::SS1)?;
if stop_duration != desired_stop_duration {
    return Err(ExampleError::StopDurationNotSet {
        expected: desired_stop_duration,
        actual: stop_duration,
    });
}

Stopping with the Configured Behavior

A stop then follows the configuration of its source. Here, stop_motion() during a motion is a user stop, so the robot decelerates on its path within the configured second:

robot.move_ptp(poses::home()).start()?.join()?;

robot.move_ptp(poses::vertical()).start()?;
sleep(Duration::from_millis(100));
robot.stop_motion()?;

Full Example

Trait Definitions