Pinocchio导入URDF关节为continuous的问题及详细解释

视频讲解:

Pinocchio导入URDF关节为continuous的问题及详细解释

仓库地址:GitHub - LitchiCheng/mujoco-learning

问题背景:打算测试将之前的panda的urdf换成so-arm100的urdf,发现pinocchio的代码不能用,很奇怪,按照道理都是参数,应该可以直接复用,通过排查,发现时model.nq数量发生了变化,pyroboplan的代码在进行ik时直接越界了

复制代码
   <joint
    name="Shoulder_Rotation"
    type="continuous">
    <origin
      xyz="0 -0.0452 0.0181"
      rpy="1.5708 0 1.5708" />
    <parent
      link="Base" />
    <child
      link="Shoulder_Rotation_Pitch" />
    <axis
      xyz="0 1 0" />
  </joint>

进一步排查:

1.打印panda的model.nq发现和urdf中的关节数量一致,其type为revolute

2.打印so-arm100的model.nq发现比urdf中的joint多了一倍,其type为continuous

通过查看pinocchio的issues,发现如下两个解释:

Continuous joint in URDF adds 2 elements to the configuration space · Issue #794 · stack-of-tasks/pinocchio · GitHub

lowerPositionLimit and upperPositionLimit in pinocchio::Model have unexpected dimensions for unbounded joints - how to read them correctly? · Issue #777 · stack-of-tasks/pinocchio · GitHub

但实际上还没没有讲得很清楚为什么continous类型的joint的nq为2,这里进行探究:

URDF的continuous joint:本质也是一种无旋转角度限制的旋转关节(unbounded revolute joint),理论上应使用单个角度参数θ描述其状态就够了,但是为什么需要用两个,这就要反过来思考了,首先1个配置空间的维度能不能用来描述continuous类型关节对应物理位置,肯定是够了,但会出现一种情况,如关节在θ时和θ+2Π实际上物理位置一致,有无数个数值对应同样的物理位置,对于优化、求解问题来说时冗余的

所以用从如下两个角度可以理解cosθ, sinθ的好处:

1.一个数值对对应了一个物理状态,避免求解的冗余问题

2.cosθ和sinθ避免2Π到0的跳跃

下面用python代码来做一个验证

复制代码
import math
# 定义角度
angles = [170, -190, 180, -180, 180, 540]

# 遍历角度列表
for theta in angles:
    # 将角度转换为弧度
    theta_rad = math.radians(theta)
    # 计算 cos 和 sin 值
    cos_theta = math.cos(theta_rad)
    sin_theta = math.sin(theta_rad)
    # 输出结果
    print(f"当 theta = {theta} 度时:")
    print(f"cos(theta) = {cos_theta}")
    print(f"sin(theta) = {sin_theta}")
    print()

可以看到三种情况下数值对均一致

1.170和反方向

2.180°和反向180

3.180和多转一圈

相关推荐
小刘快学习10 分钟前
一把钥匙开所有门:企业AI网关的统一身份与权限治理
大数据·人工智能
熊猫钓鱼>_>15 分钟前
MiniMax 深度观察:不是又一个大模型,是AI生产效率的范式革新
人工智能·ai·自然语言处理·媒体·benchmark·minimax·行业
TechWayfarer18 分钟前
Cloudflare 9·15新政倒计时:用IP风险画像识别AI爬虫,防止误伤Googlebot
网络·人工智能·爬虫·python·tcp/ip·网络安全
Anhty27 分钟前
2026九月最新变声器测评:iOS安卓双端适配,低延迟运行更稳定
android·人工智能·功能测试·ios·智能手机
DisonTangor42 分钟前
【腾讯混元雪耻归来】 Hy4 preview:770B 参数 MoE 旗舰模型,1M 上下文全面开源
人工智能·算法·开源·aigc·腾讯云·腾讯云ai代码助手
luckystar513~1 小时前
Hermes 实战 :系列收官/生产化——安全审计与运维
运维·人工智能·安全·agent·智能体开发·hermes实战·智能体网关
Mickey Q1 小时前
【深度学习】数值稳定性和模型初始化
人工智能·深度学习
冬奇Lab1 小时前
Code Agent 解剖(20):从零扩展——给 agent 加一个新工具
人工智能·开源
论文复现现场1 小时前
RTX 4090 24GB 能跑 Qwen3.8-27B 吗?单卡显存计算与云端部署指南
人工智能·python·云计算·llama·gpu算力
七牛云行业应用1 小时前
Harness Engineering 是什么:从“写提示词“到“设计 Agent 边界“的工程方法论
人工智能·agent·ai编程