Resetting Errors
The process of resetting errors varies depending on the type of robot arm in use.
Warning
As this is a safety-critical task, there may be certain restrictions that apply. Be very careful with the programmatic resetting of errors.
Additionally, the error state and its reset procedure can be influenced by the overall system, of which the robot arm is a component.
In some cases, the robot control may not have the capability or authorization to reset an error. For example, in the case of the voraus.core, where the error state is shared across multiple subsystems, the robot control cannot directly reset the error. Instead, the error must be cleared by following the specific reset procedure for the voraus.core, which involves invoking a dedicated error handler.
Resetting Errors on the voraus.core
Although the communication with the voraus error handler falls outside the scope of this library, this functionality is nonetheless provided for convenience.
In order to reset an error when working with a voraus.core instance, communication to the
voraus error handler is necessary.
This library provides a ready-to-use class for this purpose, the VorausErrorHandler.
This class provides a connect() method that expects the host (e.g. IP address or hostname)
of the voraus error handler OPC UA server and its port.
It should be used as a context manager in order ensure that the connection is properly closed upon shutdown:
error_handler = VorausErrorHandler()
with (
robot.connect(VORAUS_CORE_HOST, VORAUS_ROBOT_CONTROL_PORT),
error_handler.connect(VORAUS_CORE_HOST, VORAUS_ERROR_HANDLER_PORT),
):
After that, the connection is established and the reset_error() method can be called.
This method blocks until the error is reset, otherwise an exception is raised.
The timeout for how long to wait can be provided as an argument.
In order to be able to check whether the error was actually reset, the relevant robot instance must be passed as an argument.
As a result, it is guaranteed that the error is reset after reset_error() returned:
assert robot.get_lifecycle_state() == LifecycleState.ERROR
error_handler.reset_error(robot)
assert robot.get_lifecycle_state() == LifecycleState.CONNECTED
The following is an example how it can be used to reset an error.
VorausErrorHandler Example
"""This is an example for the usage of the VorausErrorHandler class."""
import logging
from typing import Protocol
from voraus_robot_arm import (
CartesianPose,
LifecycleState,
LifecycleTrait,
MovePTPTrait,
RobotArmError,
VorausErrorHandler,
VorausIndustrialRobotArm,
configure_logging,
)
_logger = logging.getLogger()
VORAUS_CORE_HOST = "localhost"
VORAUS_ROBOT_CONTROL_PORT = 48401
VORAUS_ERROR_HANDLER_PORT = 48404
class _RequiredRobotTraits(LifecycleTrait, MovePTPTrait, Protocol): ...
def run_my_application(robot: _RequiredRobotTraits) -> None:
"""Example to demonstrate the usage of the VorausErrorHandler."""
error_handler = VorausErrorHandler()
with (
robot.connect(VORAUS_CORE_HOST, VORAUS_ROBOT_CONTROL_PORT),
error_handler.connect(VORAUS_CORE_HOST, VORAUS_ERROR_HANDLER_PORT),
):
robot.enable()
assert robot.get_lifecycle_state() == LifecycleState.ENABLED
try:
# This pose is not reachable and will cause an error
robot.move_ptp(CartesianPose(x=99)).result()
except RobotArmError as error:
_logger.exception(msg=error)
assert robot.get_lifecycle_state() == LifecycleState.ERROR
error_handler.reset_error(robot)
assert robot.get_lifecycle_state() == LifecycleState.CONNECTED
_logger.info("Reset was successful.")
if __name__ == "__main__":
configure_logging()
robot = VorausIndustrialRobotArm()
run_my_application(robot)