Robot manipulator blocks
- class FKine(robot=None, args={}, **blockargs)[source]
Bases:
FunctionBlockFKINE
Robot arm forward kinematics.
- Inputs:
1
- Outputs:
1
- States:
0
Port type
Port number
Types
Description
Input
0
ndarray(N)
\(\mathit{q}\)
Output
0
SE3
\(\mathbf{T}\)
Compute the end-effector pose as an SE(3) object as a function of the input joint configuration.
See also
- class IKine(robot=None, q0=None, useprevious=True, ik=None, args={}, seed=None, **blockargs)[source]
Bases:
FunctionBlockIKINE
Robot arm inverse kinematics.
- Inputs:
1
- Outputs:
1
- States:
0
Port type
Port number
Types
Description
Input
0
SE3
\(\mathbf{T}\)
Output
0
ndarray(N)
\(\mathit{q}\)
Compute joint configuration required to achieve end-effector pose input as an SE(3) object.
- Note:
The solution may not exist and is not unique. The solution will depend on the initial joint configuration
q0.
See also
- __init__(robot=None, q0=None, useprevious=True, ik=None, args={}, seed=None, **blockargs)[source]
- Parameters:
robot (
Any) – Robot model, defaults to Noneq0 (
Any) – Initial joint angles, defaults to Noneuseprevious (
bool) – Use previous IK solution as q0, defaults to Trueik (
Any) – Specify an IK function, defaults to “LM”args (
Any) – Options passed to IK functionseed (
Any) – random seed for solutionblockargs (
Any) – common Block options
- class Jacobian(robot, frame='0', representation=None, inverse=False, pinv=False, damping=None, transpose=False, **blockargs)[source]
Bases:
FunctionBlockJACOBIAN
Robot arm Jacobian matrix.
- Inputs:
1
- Outputs:
1
- States:
0
Port type
Port number
Types
Description
Input
0
ndarray(N)
\(\mathit{q}\)
Output
0
ndarray(N,N)
\(\mathbf{J}\)
Compute the Jacobian matrix as a function of the input joint configuration. The Jacobian can be computed in the world or end-effector frame, for spatial or analytical velocity, and its inverse, damped inverse or transpose can be returned.
See also
- __init__(robot, frame='0', representation=None, inverse=False, pinv=False, damping=None, transpose=False, **blockargs)[source]
- Parameters:
robot (
Any) – Robot modelframe (
str) – Frame to compute Jacobian for, one of: “0” [default], “e”representation (
Any) – representation for analytical Jacobianinverse (
bool) – output inverse of Jacobian, defaults to Falsepinv (
bool) – output pseudo-inverse of Jacobian, defaults to Falsedamping (
Any) – damping term for inverse, defaults to Nonetranspose (
bool) – output transpose of Jacobian, defaults to Falseblockargs (
Any) – common Block options
If an inverse is requested and
dampingis not None it is added to the diagonal of the Jacobian prior to the inversion. If a scalar is provided it is added to each element of the diagonal, otherwise an N-vector is assumed.Note
Only one of
inverseorpinvcan be Trueinverseorpinvcan be used in conjunction withtransposeinverserequires that the Jacobian is squareIf
inverseis True and the Jacobian is singular a runtime error will occur.
- class ArmPlot(robot=None, q0=None, backend=None, **blockargs)[source]
Bases:
GraphicsBlockARMPLOT
Plot robot arm.
- Inputs:
1 [ndarray(N)]
- Outputs:
0
- States:
0
- Inputs:
1
- Outputs:
0
- States:
0
Port type
Port number
Types
Description
Input
0
ndarray(N)
\(\mathit{q}\), joint configuration
Create a robot animation using the robot’s
plotmethod.See also
- PLOT3D = True
- class JTraj(q0, qf, qd0=None, qdf=None, T=None, **blockargs)[source]
Bases:
SourceBlockJTRAJ
Joint-space trajectory
- Inputs:
0
- Outputs:
3
- States:
0
Port type
Port number
Types
Description
Output
0
ndarray
\(q(s)\)
Output
1
ndarray
\(\dot{q}(s)\)
Output
2
ndarray
\(\ddot{q}(s)\)
Outputs a joint space trajectory where the joint coordinates vary from
q0toqfover the course of the simulation. A quintic (5th order) polynomial is used with default zero boundary conditions for velocity and acceleration.
- class CTraj(T1, T2, T, trapezoidal=True, **blockargs)[source]
Bases:
SourceBlockCTRAJ
Task space trajectory
- Inputs:
0
- Outputs:
1
- States:
0
Port type
Port number
Types
Description
Output
0
SE3
\(\mathbf{T}(t)\)
The block outputs a pose that varies smoothly from
T1toT2over the course ofTseconds.If
Tis not given it defaults to the simulation time.If
trapezoidalis True then a trapezoidal motion profile is used along the path to provide initial acceleration and final deceleration. Otherwise, motion is at constant velocity.
- class CirclePath(radius=1, centre=(0, 0, 0), pose=None, frequency=1, unit='rps', phase=None, **blockargs)[source]
Bases:
SourceBlockCIRCLEPATH
Circular motion.
- Inputs:
0 or 1
- Outputs:
1
- States:
0
Port type
Port number
Types
Description
Output
0
ndarray(3) or SE3
\(\mathit{p}(t)\) or \(\mathbf{T}(t)\)
The block outputs the coordinates of a point moving in a circle of radius
rcentred atcentreand parallel to the xy-plane.By default the output is a 3-vector \((x, y, z)\) but if
poseis anSE3instance the output is a copy of that pose with its translation set to the coordinate of the moving point. This is the motion of a frame with fixed orientation following a circular path.- __init__(radius=1, centre=(0, 0, 0), pose=None, frequency=1, unit='rps', phase=None, **blockargs)[source]
- Parameters:
radius (
float) – radius of circle, defaults to 1centre (
Any) – center of circle, defaults to [0,0,0]pose (
Any) – SE3 pose of output, defaults to Nonefrequency (
float) – rotational frequency, defaults to 1unit (
str) – unit for frequency, one of: ‘rps’ [default], ‘rad’blockargs (
Any) – common Block options
- class Trapezoidal(q0, qf, V=None, T=None, **blockargs)[source]
Bases:
SourceBlockTrapezoidal
Trapezoidal scalar trajectory
- Inputs:
0
- Outputs:
3
- States:
0
Port type
Port number
Types
Description
Output
0
float
\(q(t)\)
Output
1
float
\(\dot{q}(t)\)
Output
2
float
\(\ddot{q}(t)\)
Scalar trapezoidal trajectory that varies from
q0toqfover the simulation period.Changed in version 1.5.0: The outputs are scalars, as the table says. They were arrays with one element, because
trapezoidal_funcreturned arrays for a scalar time.See also
ctraj,xplot,jtraj()- __init__(q0, qf, V=None, T=None, **blockargs)[source]
Compute a joint-space trajectory
- Parameters:
q0 (
Any) – initial joint coordinateqf (
Any) – final joint coordinateT (
Any) – maximum time, defaults to Noneblockargs (
Any) – common Block options
If
Tis given the valueqfis reached at this time. This can be less or greater than the simulation time.
- class Traj(y0=0, yf=1, T=None, time=False, traj='trapezoidal', **blockargs)[source]
Bases:
FunctionBlockTRAJ
Vector trajectory
- Inputs:
0 or 1
- Outputs:
3
- States:
0
Port type
Port number
Types
Description
Input
0
float
\(s \in [0, 1]\) distance along trajectory.
Output
0
ndarray
\(y(s)\)
Output
1
ndarray
\(\dot{y}(s)\)
Output
2
ndarray
\(\ddot{y}(s)\)
Generates a vector trajectory using a trapezoidal or quintic polynomial profile that varies from
y0toyfThe distance along the trajectory is either:
a linear function from 0 to
Tor maximum simulation time iftimeis True, orthe value [0, 1] given on inport port if
timeis False
Changed in version 1.5.0: An unknown
trajraisesValueErrorwhen the block is created. It previously failed with anUnboundLocalErrorwhen the simulation started. The outputs are unchanged.See also
spatialmath.base.mtraj()- __init__(y0=0, yf=1, T=None, time=False, traj='trapezoidal', **blockargs)[source]
- Parameters:
y0 (
ndarray|Sequence[float] |float) – initial value, defaults to 0yf (
ndarray|Sequence[float] |float) – final value, defaults to 1T (
Any) – maximum time, defaults to Nonetime (
bool) – ifTruetrajectory is based on simulation time, else based on input 0. Defaults to Falsetraj (
str) – trajectory type, one of: ‘trapezoidal’ [default], ‘quintic’blockargs (
Any) – common Block options
- class IDyn(robot, gravity=None, **blockargs)[source]
Bases:
FunctionBlockIDYN
Robot arm inverse dynamics model.
- Inputs:
3
- Outputs:
1
- States:
0
Port type
Port number
Types
Description
Input
0
ndarray(N)
\(\mathit{q}\), joint configuration
Input
1
ndarray(N)
\(\dot{\mathit{q}}\), joint velocity
Input
2
ndarray(N)
\(\ddot{\mathit{q}}\), joint acceleration
Output
0
ndarray(N)
\(\mathit{Q}\), generalized joint force
Compute the generalized joint torques required to achieve the input joint configuration, velocity and acceleration. This uses the recursive Newton-Euler (RNE) algorithm.
See also
- class Gravload(robot, gravity=None, **blockargs)[source]
Bases:
FunctionBlockGRAVLOAD
Robot arm gravity load.
- Inputs:
1
- Outputs:
1
- States:
0
Port type
Port number
Types
Description
Input
0
ndarray(N)
\(\mathit{q}\), joint configuration
Output
0
ndarray(N)
\(\mathit{g}\), generalized joint force
Compute generalized joint forces due to gravity for the input joint configuration.
See also
- class Gravload_X(robot, representation='rpy/xyz', gravity=None, **blockargs)[source]
Bases:
FunctionBlockGRAVLOAD_X
Task-space robot arm gravity wrench.
- Inputs:
1
- Outputs:
1
- States:
0
Port type
Port number
Types
Description
Input
0
ndarray(6)
\(\mathit{x}\), end-effector pose
Output
0
ndarray(6)
\(\mathit{g}_x\), generalized joint force
Compute end-effector wrench due to gravity for the input end-effector pose.
See also
- __init__(robot, representation='rpy/xyz', gravity=None, **blockargs)[source]
- Parameters:
robot (
Any) – Robot modelrepresentation (
str) – task-space representation, defaults to “rpy/xyz”gravity (
Any) – gravitational acceleration in the world frame, downwards gravitational force is equivalent to robot base acceleration upwards (positive)blockargs (
Any) – common Block options
- class Inertia(robot, **blockargs)[source]
Bases:
FunctionBlockINERTIA
Robot arm inertia matrix.
- Inputs:
1 [ndarray(N)]
- Outputs:
3 [ndarray(N,N)]
- States:
0
- Inputs:
1
- Outputs:
1
- States:
0
Port type
Port number
Types
Description
Input
0
ndarray
\(\mathit{q}\), joint configuration
Output
0
ndarray(N,N)
\(\mathbf{M}\), mass matrix
Joint-space inertia matrix (mass matrix) as a function of joint configuration.
See also
- __init__(robot, **blockargs)[source]
- Parameters:
robot (
Any) – Robot modelblockargs (
Any) – common Block options
- class Inertia_X(robot, representation='rpy/xyz', pinv=False, **blockargs)[source]
Bases:
FunctionBlockINERTIA_X
Task-space robot arm inertia matrix.
- Inputs:
1
- Outputs:
1
- States:
0
Port type
Port number
Types
Description
Input
0
ndarray(6)
\(\mathit{x}\), end-effector pose
Output
0
ndarray(6,6)
\(\mathbf{M_x}\), task-space mass matrix
Task-space inertia matrix as a function of end-effector pose.
See also
- class FDyn(robot, q0=None, **blockargs)[source]
Bases:
ContinuousBlockFDYN
Robot arm forward dynamics.
- Inputs:
1
- Outputs:
3
- States:
2N
Port type
Port number
Types
Description
Input
0
ndarray(N)
\(\mathit{Q}\), generalized joint force
Output
0
ndarray(N)
\(\mathit{q}\), joint configuration
Output
1
ndarray(N)
\(\dot{\mathit{q}}\), joint velocity
Output
2
ndarray(N)
\(\ddot{\mathit{q}}\), joint acceleration
Compute the manipulator arm forward dynamics in joint space, the joint acceleration for the input configuration and applied joint forces. The acceleration is integrated to obtain joint velocity and joint configuration.
See also
- class FDyn_X(robot, q0=None, gravcomp=False, velcomp=False, representation='rpy/xyz', **blockargs)[source]
Bases:
ContinuousBlockFDYN_X
Task-space robot arm forward dynamics.
- Inputs:
1
- Outputs:
3
- States:
12
Port type
Port number
Types
Description
Input
0
ndarray(6)
\(\mathit{\tau}\), end-effector wrench
Output
0
ndarray(6)
\(\mathit{x}\), end-effector pose
Output
1
ndarray(6)
\(\dot{\mathit{x}}\), end-effector velocity
Output
2
ndarray(6)
\(\dot{\mathit{x}}`\), end-effector acceleration
Compute the manipulator arm forward dynamics in task space, the end-effector acceleration for the input end-effector pose and applied end-effector wrench. The acceleration is integrated to obtain task-space velocity and task-space pose.
See also
fdyn_x