Пример #1
0
def axis_angle_to_rotation(axis, angle):
    # Source:
    # https://en.wikipedia.org/wiki/Axis%E2%80%93angle_representation
    res = cs.MX.eye(3)
    res += cs.sin(angle) * cs.skew(axis)
    res += (1 - cs.cos(angle)) * cs.mtimes(cs.skew(axis), cs.skew(axis))
    return res
Пример #2
0
def spatial_force_transform(R, r):
    """Returns the spatial force transform from a 3x3 rotation matrix
    and a 3x1 displacement vector."""
    X = cs.SX.zeros(6, 6)
    X[:3, :3] = R.T
    X[3:, 3:] = R.T
    X[:3, 3:] = cs.mtimes(cs.skew(r), R.T)
    return X
Пример #3
0
def spatial_transform(R, r):
    """Returns the spatial motion transform from a 3x3 rotation matrix
    and a 3x1 displacement vector."""
    X = cs.SX.zeros(6, 6)
    X[:3, :3] = R
    X[3:, 3:] = R
    X[3:, :3] = -cs.mtimes(R, cs.skew(r))
    return X