transforms.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:robopy 作者: adityadua24 项目源码 文件源码
def rotx(theta, unit="rad"):
    """
    ROTX gives rotation about X axis

    :param theta: angle for rotation matrix
    :param unit: unit of input passed. 'rad' or 'deg'
    :return: rotation matrix

    rotx(THETA) is an SO(3) rotation matrix (3x3) representing a rotation
    of THETA radians about the x-axis
    rotx(THETA, "deg") as above but THETA is in degrees
    """
    check_args.unit_check(unit)
    if unit == "deg":
        theta = theta * math.pi / 180
    ct = math.cos(theta)
    st = math.sin(theta)
    mat = np.matrix([[1, 0, 0], [0, ct, -st], [0, st, ct]])
    mat = np.asmatrix(mat.round(15))
    return mat


# ---------------------------------------------------------------------------------------#
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号