Moving a Robot on a Linear Path
A linear motion is a movement where the robot travels to a target position along a straight-line path in Cartesian space. Unlike point-to-point (PTP) motion, which follows the shortest path in joint space, a linear motion ensures a predictable trajectory in Cartesian coordinates. However, depending on the robot’s kinematics, this type of movement may not always be the fastest.
This chapter specifically explains linear movements. For detailed information on how to use these methods synchronously or asynchronously, see the asynchronous instructions chapter.
Performing a Linear Movement
Performing a linear movement can be done using the method move_linear(),
which requires a target pose of either type JointPose or CartesianPose.
Perform a Linear Movement using a CartesianPose
To perform a linear movement to a target defined in Cartesian space, use a CartesianPose as an input target argument:
cartesian_pose = CartesianPose().from_list(
[0.1382, 0.550, 0.296, 3.14159, 0.0, 0.0]
)
robot.move_linear(cartesian_pose, velocity_mps=1.0).result()
The velocity_mps argument defines the maximum translational velocity for the tool center point in meter per second.
Giving no argument results in a speed of 1 m/s.
Since a Cartesian pose is ambiguous for a six axis robot, the resulting joint configuration at the target can differ
depending on the starting pose of the robot.
Note
The CartesianPose is interpreted in the world coordinate system. No specific tool is assumed. The behavior depends on the specific robot in use.
A CartesianPose itself can be ambiguous in regards to the exact joint configuration of the robot. It is at the discretion of the underlying robot control to choose a convenient joint configuration to reach the given pose. This means, that the robot configuration reached depends on the starting position.
Perform a Linear Movement using a JointPose
To perform a linear movement to a target defined in joint space, use a JointPose as an input target argument:
joints_in_deg = [90, -90, 90, -90, -90, 0]
joints_in_rad = [radians(joint) for joint in joints_in_deg]
joint_pose = JointPose().from_list(joints_in_rad)
robot.move_linear(joint_pose, velocity_mps=1.0).result()
Perform a Relative Linear Movement
For moving linear relative to its current pose, use the move_linear_relative() method.
Other than that, the method accepts the same arguments as move_linear().
cartesian_pose: CartesianPose = z(0.1)
robot.move_linear_relative(cartesian_pose, velocity_mps=1.0).result()
In this example, the robot moves relative in the positive z-direction from its current pose. The z input argument is a
CartesianPose, where every argument is zero except the value of z.
Perform a Linear Movement with Blending
Linear movements can use blending by supplying a Factor or Percent input to the blending argument. The higher the
blending factor, the more and earlier the blended path will deviate from the original path that would reach the target
pose. In most cases this allows the robot to maintain a higher path velocity and complete the overall path faster.
Blending only works, if the instructions used for blending are known to robot control in advance. As such, it is not
possible to blend two instructions, which are synced to the Python interpreter.
# Pose BLENDING_1 and BLENDING_2 will be blended
robot.move_linear(BLENDING_1, blending=Percent(50))
robot.move_linear(BLENDING_2, blending=Factor(0.5))
# Pose BLENDING_3 will be reached
robot.move_linear(BLENDING_3).result()
Note how the .result(), which syncs the instruction to the Python interpreter, is only used for the last movement
command which itself does not contain a blending argument.
Note
The exact behavior and interpretation of the blending parameter as well as implicit limitations are highly dependent on the specific robot used. For more details on how to use and how not to use the blending functionality, please refer to the asynchronous instructions chapter.
Amending blending parameters
If your robot supports sending delayed blending parameters, it is possible to amend a blending parameter after sending
the motion instruction using the amend_blending_parameters() method.
robot.move_linear(BLENDING_1)
robot.amend_blending_parameter(blending=Percent(50))
robot.move_linear(BLENDING_2)
robot.amend_blending_parameter(blending=Factor(0.5))
robot.move_linear(BLENDING_3).result()
In this example the robot will blend the poses BLENDING_1 and BLENDING_2 just like in the previous example, but
the blending parameters are supplied after sending the motion instruction.
Note that amending the parameter too late - i.e. such that the robot already reached the previous target pose - may result in a drop of the blend request by the robot control.
Full Example of Performing Linear Movements
The following example shows a simple application in which the move_linear() method is being used:
Using move_linear() example
"""An example on how to perform linear movements."""
from math import radians
from typing import Protocol, runtime_checkable
from voraus_robot_arm import (
AmendBlendingParametersTrait,
CartesianPose,
Factor,
JointPose,
MoveLinearTrait,
MovePTPTrait,
Percent,
VorausIndustrialRobotArm,
configure_logging,
x,
y,
z,
)
VORAUS_CORE_HOST = "localhost"
VORAUS_CORE_PORT = 48401
HOME = JointPose().from_list(
[radians(d) for d in [0, -90, 90, -90, -90, 0]]
)
HOME_C = CartesianPose().from_list(
[0.550, -0.1382, 0.4743, -3.14, -0, 1.57]
)
BLENDING_1 = HOME_C - z(0.2)
BLENDING_2 = BLENDING_1 + y(0.2)
BLENDING_3 = BLENDING_2 - x(0.2)
@runtime_checkable
class _RequiredRobotTraits(MoveLinearTrait, MovePTPTrait, Protocol): ...
@runtime_checkable
class _AmendBlendingTraits(
MoveLinearTrait,
AmendBlendingParametersTrait,
MovePTPTrait,
Protocol,
): ...
def run_linear_movement_using_a_joint_pose(
robot: _RequiredRobotTraits,
) -> None:
"""Simple linear movement using a JointPose."""
robot.move_ptp(HOME).result()
joints_in_deg = [90, -90, 90, -90, -90, 0]
joints_in_rad = [radians(joint) for joint in joints_in_deg]
joint_pose = JointPose().from_list(joints_in_rad)
robot.move_linear(joint_pose, velocity_mps=1.0).result()
def run_linear_movement_using_a_cartesian_pose(
robot: _RequiredRobotTraits,
) -> None:
"""Simple absolute linear movement using a CartesianPose."""
robot.move_ptp(HOME).result()
cartesian_pose = CartesianPose().from_list(
[0.1382, 0.550, 0.296, 3.14159, 0.0, 0.0]
)
robot.move_linear(cartesian_pose, velocity_mps=1.0).result()
def run_relative_linear_movement(
robot: _RequiredRobotTraits,
) -> None:
"""Simple relative linear movement using a CartesianPose."""
robot.move_ptp(HOME).result()
cartesian_pose: CartesianPose = z(0.1)
robot.move_linear_relative(cartesian_pose, velocity_mps=1.0).result()
def run_linear_movement_with_blending(
robot: _RequiredRobotTraits,
) -> None:
"""Simple linear instruction block with blending."""
# Pose BLENDING_1 and BLENDING_2 will be blended
robot.move_linear(BLENDING_1, blending=Percent(50))
robot.move_linear(BLENDING_2, blending=Factor(0.5))
# Pose BLENDING_3 will be reached
robot.move_linear(BLENDING_3).result()
def run_amend_blending_parameters_example(
robot: _AmendBlendingTraits,
) -> None:
"""Example of amending blending parameters to a motion instruction."""
robot.move_ptp(HOME).result()
robot.move_linear(BLENDING_1)
robot.amend_blending_parameter(blending=Percent(50))
robot.move_linear(BLENDING_2)
robot.amend_blending_parameter(blending=Factor(0.5))
robot.move_linear(BLENDING_3).result()
if __name__ == "__main__":
configure_logging()
robot = VorausIndustrialRobotArm()
with robot.connect(host=VORAUS_CORE_HOST, port=VORAUS_CORE_PORT):
robot.enable()
run_linear_movement_using_a_joint_pose(robot)
run_linear_movement_using_a_cartesian_pose(robot)
run_relative_linear_movement(robot)
run_linear_movement_with_blending(robot)
run_amend_blending_parameters_example(robot)
Definition of the Move Linear Method
The move linear method is defined in the MoveLinearTrait:
MoveLinearTrait
- protocol MoveLinearTrait
Trait to perform a linear movement of a robot arm.
This protocol is runtime checkable.
Classes that implement this protocol must have the following methods / attributes:
- abstractmethod move_linear(target, *, velocity_mps=1.0, blending=None)
Instruction that moves the robot end effector in a straight translational path in the Cartesian workspace.
The CartesianPose is interpreted in the world coordinate system. No specific tool is assumed. The behavior depends on the specific robot in use.
A CartesianPose itself can be ambiguous in regards to the exact joint configuration of the robot. It is at the discretion of the underlying robot control to choose a convenient joint configuration to reach the given pose. This means, that the robot configuration reached depends on the starting position. With this generic interface it is not possible to force a specific robot configuration in Cartesian space. Please use a robot specific trait for this purpose.
The velocity_mps argument defines the maximum translational velocity for the tool center point in m/s. Giving no argument results in a velocity of 1 m/s.
If blending is activated, the given target pose will not be reached exactly. The higher the blending factor, the more and earlier the blended path will deviate from the original path that would reach the target pose. In most cases this allows the robot to maintain a higher path velocity and complete the overall path faster.
The exact behavior and interpretation of the blending parameter as well as implicit limitations are highly dependent on the specific robot used.
Blending only works, if this instruction is not synchronized to the Python interpreter and the next instruction is received prior to the execution of this instruction. Otherwise, the robot will hold at the starting point of this instruction. If in that case the instruction leading to the starting point of this instruction also contained a blending parameter, the blending parameter of the previous instruction will be ignored. As a result, the previous instruction will not be blended.
- Parameters:
target (
JointPose|CartesianPose) – The target pose of the desired motion.velocity_mps (
float) – Maximum translational velocity for the tool center point in m/s. Defaults to 1 m/s.blending (
Factor|Percent|None) – Blending with next instruction in percent or as factor. Only works if this instruction is not synchronized to the Python interpreter.
- Return type:
- Returns:
A Future to track the state of this operation.
- abstractmethod move_linear_relative(target, *, velocity_mps=1.0, blending=None)
Instruction that moves the robot end effector in a straight translational path in the Cartesian workspace.
Please see
move_linearfor a detailed description of parameter options.- Return type:
- Returns:
A Future to track the state of this operation.
The methods to amend blending parameters are defined in the AmendBlendingParametersTrait:
AmendBlendingParametersTrait
- protocol AmendBlendingParametersTrait
Trait to amend blending parameters retroactively.
This protocol is runtime checkable.
Classes that implement this protocol must have the following methods / attributes:
- abstractmethod amend_blending_parameter(blending)
Amend blending parameters retroactively to the previous movement instruction.
Calling this without a movement instruction does nothing. It is not possible to amend blending parameters to an instruction that already specified blending parameters. Amending the parameter too late - i.e. such that the robot already reached the previous end position - may result in a drop of the blend request by the robot control.