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和多转一圈

相关推荐
@insist12312 小时前
信息系统管理工程师-数字化转型成熟度模型核心考点解析
大数据·人工智能·软考·软件水平考试·信息系统管理工程师·软考信管
海兰12 小时前
【高速缓存】RedisVL 高级查询(全文搜索、混合搜索和 多向量搜索)
数据库·人工智能·redis·缓存
Damon小智13 小时前
眼见不一定为实:WAIC 2026 探展合合信息,实测 AI 去反光 + AI 跨模态鉴伪两项黑科技
人工智能·ocr
guanchabao13 小时前
大模型智能电话机器人比传统规则机器人强在哪?2026按规则/LLM混合架构拆解
机器人
AvatarAI_Walker13 小时前
2026年7月安徽健康 IP 孵化:四家机构服务特点与场景关注方向梳理
大数据·人工智能·tcp/ip·精选
栋***t13 小时前
从“纸质试卷”到“AI智能组卷”,麦塔在线考试系统如何重构出题逻辑?
java·大数据·人工智能·算法·重构
不爱记笔记13 小时前
音视频转笔记工具横评2026,通义听悟、Ai好记、NotebookLM 实测对比
人工智能·笔记·ai·音视频·飞书·obsidian
Highcharts.js13 小时前
如何下载使用Highcharts Grid 开发web可编辑表格
前端·人工智能·grid 表格·web 表格·在线编辑表格·highcharts表格安装·表格开发工具
服装 AI 增长黑客13 小时前
AI落地服装店:从流量焦虑到经营闭环,哪些能力真实可用?
人工智能
weiwin12313 小时前
MAF 入门(7):在 MAF 中使用 RAG
人工智能