matlab求四元数夹角,如何求出两个四元数之间的夹角?

免责声明:我自己对四元数还很陌生,但在四元数附近做了一些工作。以下是我有限的知识加上一些谷歌搜索的结果。它看起来确实应该起作用。

所以听起来你要解决的问题可以表述如下:给出两个四元数(分别代表大腿和小腿的3D方向)。。。在

…计算两个四元数之间的三维角度差。。。在

。。。把角差表示为欧拉角

为了得到三维角度差,它本身就是一个四元数,你只需将一个四元数乘以另一个四元数的共轭量(reference)。在

然后需要从四元数转换为Euler角度(围绕X、Y、Z旋转)。据我所知,你需要用老式的方法,使用Wikipedia中的公式。在import pyquaternion as pyq

import math

# Create a hypothetical orientation of the upper leg and lower leg

# We use the (axis, degrees) notation because it's the most intuitive here

# Upper leg perfectly vertical with a slight rotation

q_upper = pyq.Quaternion(axis=[0.0, 0.0, -1.0], degrees=-5)

# Lower leg a little off-vertical, with a rotation in the other direction.

q_lower = pyq.Quaternion(axis=[0.1, -0.2, -0.975], degrees=10)

# Get the 3D difference between these two orientations

qd = q

  • 0
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值