Limits
Limits are used to configure motion and monitoring constraints of the robot such as axis velocities, axis accelerations,
TCP velocity and many more. The robot control may provide default limit sets like MACHINE and SAFETY.
Users can define additional limit sets to constrain the robot behavior for specific applications.
Note
Limits are currently only supported for robots of the Victor Robot Behavior Group.
It is expected that limit sets are preconfigured by the robot control.
Creating or modifying limit sets is currently not supported by this library.
Reading Currently Active Limits
The currently active limits can be read with get_active_limits_v(). The method returns a
LimitsVictor instance containing all currently active limit values. The values reflect the
combined effect of all active limit sets.
active_limits = robot.get_active_limits_v()
_logger.info("Active limits: %s", active_limits)
Reading Limits from a Limit Set
The limits of a specific limit set can be read with get_limits_v().
The method returns a LimitsVictor instance containing only the configured
limits of that particular limit set.
my_limits = robot.get_limits_v("MyLimitSet")
my_limit = my_limits.axes_acceleration
_logger.info("Limits for Axes acceleration: %s", my_limit)
Selecting Limit Sets
Activating and deactivating limit sets is part of the SelectLimitSetsVictorTrait.
Listing default limit sets
Use get_default_limit_sets_v() to retrieve the names of the default limit sets.
Default limit sets are always active and cannot be deactivated.
default_limit_sets = robot.get_default_limit_sets_v()
_logger.info("Default limit sets: %s", default_limit_sets)
Listing optional limit sets
Use get_optional_limit_sets_v() to retrieve user-configurable limit set names.
Default limit sets are not included in this tuple.
optional_limit_sets = robot.get_optional_limit_sets_v()
_logger.info("Optional limit sets: %s", optional_limit_sets)
Listing active limit sets
Use get_active_limit_sets_v() to retrieve the names of all currently active limit sets.
This includes the default limit sets as well as any user-activated
optional limit sets.
active_limit_sets = robot.get_active_limit_sets_v()
_logger.info("Active limit sets: %s", active_limit_sets)
Activating a limit set
A specific limit set can be activated with activate_limit_set_v().
The limit set must already exist on the robot control.
robot.activate_limit_set_v("MyLimitSet")
Deactivating a limit set
An active limit set can be deactivated with deactivate_limit_set_v(limit_set):
robot.deactivate_limit_set_v("MyLimitSet")
Default limit sets can not be deactivated.
Full Example
The following example shows a complete application working with limit sets:
Working with limits example
"""Limit set example for robots with Victor behavior."""
from logging import Logger, getLogger
from typing import Protocol, runtime_checkable
from voraus_robot_arm import (
GetLimitsVictorTrait,
SelectLimitSetsVictorTrait,
VorausIndustrialRobotArm,
configure_logging,
)
_logger: Logger = getLogger(__name__)
VORAUS_CORE_HOST = "localhost"
VORAUS_CORE_PORT = 48401
@runtime_checkable
class _RequiredRobotTraits(
GetLimitsVictorTrait,
SelectLimitSetsVictorTrait,
Protocol,
): ...
def get_active_limits_example(robot: _RequiredRobotTraits) -> None:
"""Example showing how to read currently active limits."""
active_limits = robot.get_active_limits_v()
_logger.info("Active limits: %s", active_limits)
def get_limits_from_a_limit_set_example(
robot: _RequiredRobotTraits,
) -> None:
"""Example showing how to read a limit from a limit set."""
my_limits = robot.get_limits_v("MyLimitSet")
my_limit = my_limits.axes_acceleration
_logger.info("Limits for Axes acceleration: %s", my_limit)
def select_limit_set_example(robot: _RequiredRobotTraits) -> None:
"""Example showing how to list, activate and deactivate limit sets."""
default_limit_sets = robot.get_default_limit_sets_v()
_logger.info("Default limit sets: %s", default_limit_sets)
optional_limit_sets = robot.get_optional_limit_sets_v()
_logger.info("Optional limit sets: %s", optional_limit_sets)
active_limit_sets = robot.get_active_limit_sets_v()
_logger.info("Active limit sets: %s", active_limit_sets)
# The limit set has to exist on the robot control
robot.activate_limit_set_v("MyLimitSet")
active_limit_sets = robot.get_active_limit_sets_v()
_logger.info(
"Active limit sets after activation: %s", active_limit_sets
)
robot.deactivate_limit_set_v("MyLimitSet")
active_limit_sets = robot.get_active_limit_sets_v()
_logger.info(
"Active limit sets after deactivation: %s", active_limit_sets
)
if __name__ == "__main__":
configure_logging()
robot = VorausIndustrialRobotArm()
with robot.connect(host=VORAUS_CORE_HOST, port=VORAUS_CORE_PORT):
get_active_limits_example(robot)
get_limits_from_a_limit_set_example(robot)
select_limit_set_example(robot)
Definition of the Limit Methods
The limit-related functionality for robots with Victor behavior is defined in
the GetLimitsVictorTrait and the SelectLimitSetsVictorTrait:
GetLimitsVictorTrait
- protocol GetLimitsVictorTrait
Trait to get limitations for robots with Victor behavior.
This protocol is runtime checkable.
Classes that implement this protocol must have the following methods / attributes:
- abstractmethod get_active_limits_v()
Get the currently active limits. The values reflect the combined effect of all active limit sets.
- Return type:
- Returns:
All currently active limit values.
- abstractmethod get_limits_v(limit_set)
Get the limits for a specific limit set.
- Parameters:
limit_set (
str) – The limit set name.- Return type:
- Returns:
A model with all limit of the given set.
- Raises:
RobotArmError – If the limit set does not exist on the robot control.
SelectLimitSetsVictorTrait
- protocol SelectLimitSetsVictorTrait
Trait to handle limit set selection for robots with Victor behavior.
This protocol is runtime checkable.
Classes that implement this protocol must have the following methods / attributes:
- abstractmethod get_default_limit_sets_v()
Get the names of all default limit sets. Default limit sets are always activated.
- Return type:
tuple[str,...]- Returns:
The names of the default limit sets.
- abstractmethod get_optional_limit_sets_v()
Get the names of all optional user-defined limit sets that can be activated or deactivated.
- Return type:
tuple[str,...]- Returns:
The names of the optional limit sets.
- abstractmethod get_active_limit_sets_v()
Get the names of the currently active limit sets.
- Return type:
tuple[str,...]- Returns:
The names of the currently active limit sets.
- abstractmethod activate_limit_set_v(limit_set)
Activate the given limit set.
- Parameters:
limit_set (
str) – The limit set name to activate.- Raises:
RobotArmError – If the limit set does not exist or cannot be activated.
- Return type:
None
- abstractmethod deactivate_limit_set_v(limit_set)
Deactivate the given limit set.
- Parameters:
limit_set (
str) – The limit set name to deactivate.- Raises:
RobotArmError – If the limit set does not exist or cannot be deactivated.
- Return type:
None