Robot: screws.robot¶
The Robot class: one object holding a serial chain's kinematic and inertial description.
Every method delegates to the chapter functions (so3, se3, kinematics), which remain the reference implementation.
MissingInertias ¶
Bases: Exception
Raised when a dynamics method is called on a robot without link inertias.
Source code in screws/robot.py
22 23 | |
Robot
dataclass
¶
A serial-chain robot in the product-of-exponentials description.
M: 4x4 home configuration of {b} in {s}. S: 6xn space-frame screw axes at home, one per column. joint_types: "revolute" or "prismatic" per joint. joint_limits: nx2 lower/upper bounds, or None. joint_frames_home: each joint frame T_{0i}(0), or None. link_frames: MR's M_{i-1,i}, n+1 of them, or None. link_inertias: MR's spatial inertias G_i, 6x6 each, or None. gravity: the gravity vector in {s}.
MR 4.1 (M, S), 4.1.3 (B), 8.3 (link_frames, link_inertias); notes chapter 4.
Source code in screws/robot.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 | |
from_screw_axes
classmethod
¶
from_screw_axes(
M,
axes,
*,
name="robot",
joint_types=None,
joint_names=None,
joint_limits=None,
joint_frames_home=None,
)
Build a robot from M and a sequence of space-frame screw axes, one 6-vector per joint.
The axes must be a sequence (list or tuple), not a 2-D array: a 6x6 array is ambiguous when n = 6. Joint types default to reading each axis (omega = 0 means prismatic). joint_frames_home, one 4x4 frame per joint at the home position, lets frames() and the drawings place the joints where they really are. Notes 4.1.
Source code in screws/robot.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | |
from_urdf
classmethod
¶
from_urdf(path, *, base_link=None, ee_link=None)
Build a robot from a URDF file or string; see screws.urdf.load.
Source code in screws/robot.py
138 139 140 141 142 143 | |
fk ¶
fk(theta)
T_sb(theta), the end-effector configuration, by the space form. Notes 4.1.
Source code in screws/robot.py
159 160 161 | |
frames ¶
frames(theta)
Every joint frame T_{0i}(theta), i = 1..n, followed by T_sb(theta).
Uses joint_frames_home when the robot has them. Otherwise each joint frame is a stand-in for a stick figure: origin at the point of the axis nearest {s}, q = omega x v, z along omega; a prismatic joint reuses the previous origin.
Source code in screws/robot.py
163 164 165 166 167 168 169 170 171 172 173 174 175 | |
jacobian_space ¶
jacobian_space(theta)
J_s(theta). MR 5.1.1; notes 5.1.
Source code in screws/robot.py
192 193 194 | |
jacobian_body ¶
jacobian_body(theta)
J_b(theta). MR 5.1.2; notes 5.1.
Source code in screws/robot.py
196 197 198 | |
is_planar ¶
is_planar()
True when every joint axis is along z and every v lies in the xy plane: the tool point then moves in a plane z = const, and its velocity has two components.
Source code in screws/robot.py
200 201 202 203 | |
manipulability_ellipsoid ¶
manipulability_ellipsoid(
theta, kind="linear", *, planar=False
)
The tool's manipulability ellipsoid at theta, centred at {b}'s origin, in {s} axes.
kind="linear" uses J_b's linear rows, as MR advises (they give the velocity of a point on the tool, J_s's that of the body point at {s}'s origin), turned into {s}: R_sb J_bv. kind="angular" uses J_s's angular rows (= R_sb J_bw). A planar arm's is 3D like any other, flat in z; planar=True gives the ellipse in the plane instead, from the x and y rows (the notes' 2 x n J(theta)). MR 5.4; notes 5.5.
Source code in screws/robot.py
220 221 222 223 224 225 226 227 228 229 230 | |
force_ellipsoid ¶
force_ellipsoid(theta, kind='linear', *, planar=False)
The tool's force ellipsoid at theta (moments for kind="angular"), as above.
Source code in screws/robot.py
232 233 234 235 | |
ik ¶
ik(T, theta0, *, frame='body', **tol)
Numerical inverse kinematics for the goal T from the guess theta0.
frame is "body" (default) or "space"; tol may carry tol_omega, tol_v, max_iter. MR 6.2; notes 6.2.
Source code in screws/robot.py
237 238 239 240 241 242 243 244 245 246 247 | |
within_limits ¶
within_limits(theta)
True if every joint value lies within joint_limits (always true without limits).
Source code in screws/robot.py
249 250 251 252 253 254 | |
symbolic ¶
symbolic(*, decimals=None)
This robot as a screws.symbolic.SymbolicRobot, its floats read as decimals.
robot.symbolic().fk() is T_sb as a formula in theta1 ... thetan; jacobian_space, jacobian_body and the dynamics methods follow. decimals=k rounds the floats to k places first (screws.symbolic.exact), and a robot read from a URDF usually wants it: robots.ur5().symbolic(decimals=6). Notes 4.1, 5.1, 8.3.
Source code in screws/robot.py
256 257 258 259 260 261 262 263 264 265 266 | |
inverse_dynamics ¶
inverse_dynamics(theta, dtheta, ddtheta, F_tip=None)
tau = M(theta) ddtheta + c(theta, dtheta) + g(theta) + J^T F_tip, with this robot's gravity. MR 8.3.
Source code in screws/robot.py
277 278 279 280 281 282 | |
mass_matrix ¶
mass_matrix(theta)
M(theta). MR 8.3.
Source code in screws/robot.py
284 285 286 287 | |
velocity_quadratic_forces ¶
velocity_quadratic_forces(theta, dtheta)
c(theta, dtheta). MR 8.3.
Source code in screws/robot.py
289 290 291 292 | |
gravity_forces ¶
gravity_forces(theta)
g(theta), with this robot's gravity. MR 8.3.
Source code in screws/robot.py
294 295 296 297 | |
end_effector_forces ¶
end_effector_forces(theta, F_tip)
J^T(theta) F_tip. MR 8.3.
Source code in screws/robot.py
299 300 301 302 | |
forward_dynamics ¶
forward_dynamics(theta, dtheta, tau, F_tip=None)
ddtheta from tau, with this robot's gravity. MR 8.5.
Source code in screws/robot.py
304 305 306 307 308 309 | |
with_gravity ¶
with_gravity(g)
A copy with a different gravity vector.
Source code in screws/robot.py
313 314 315 | |
with_inertias ¶
with_inertias(link_frames, link_inertias)
A copy carrying MR's M_{i-1,i} list and G_i list.
Source code in screws/robot.py
317 318 319 | |
with_limits ¶
with_limits(joint_limits)
A copy with nx2 joint limits.
Source code in screws/robot.py
321 322 323 | |