xml创建模型组合体

XML创建模型组合体


创建步骤

模型准备

CAD 提供的原始模型如下:

该模型存在的问题:

  1. 单位问题:CAD出图的是 mm 为单位,但是 mujoco 建模这边用的是以 m 为单位的;
  2. 原点问题:CAD作图时,没有坐标原点的概念,为了能更好的控制模型的位置,需要确定模型的原点,将物体的某一个特征点移动到 (0, 0, 0)
  3. 姿态问题:暂无

模型处理

姿态:关于模型姿态问题,暂时不处理,需要在作图时保障与坐标轴平行

位置纠偏

  1. CC 里把模型打开
  2. 统一度量衡,对模型整体进行缩放,操作:CC->Edit->scale
  3. 查看模型属性,主要是 Global box center 这个参数
  4. 然后根据 Box dimension 计算需要平移的值
  5. 平移模型, 操作: CC->Edit-> Apply transformation

模型文件XML编写

复制代码
<mujoco model="air_condition_outdoor">
  <asset>
    <mesh file="./meshes/air_condition_outdoor.stl" name="base" scale="0.5 0.5 0.5"/>
  </asset>
  <worldbody>
    <body>
      <body name="object">
        <inertial pos="0 0 0" mass="0.05" diaginertia="0.002 0.002 0.002" />
        <geom pos="0. 0. 0.0" quat="1  0 0 0  " mesh="base" type="mesh" solimp="0.998 0.998 0.001" solref="0.001 1" density="100" friction="1 1 1" group="0" condim="4" rgba="0.839 0.839 0.839 1"/>
        <geom pos="-0.1001 -0.0564 0.264" size="0.002 0.005" quat="0 0 0.707 0.707" type="cylinder" rgba="1. 0. 0. 1.0" solimp="0.998 0.998 0.001" solref="0.02 1" density="100" friction="0.95 0.3 0.1" group="0" condim="4" />
        <geom pos=" 0.1001 -0.0564 0.264" size="0.002 0.005" quat="0 0 0.707 0.707" type="cylinder" rgba="1. 0. 0. 1.0" solimp="0.998 0.998 0.001" solref="0.02 1" density="100" friction="0.95 0.3 0.1" group="0" condim="4" />
        <geom pos="-0.1001 -0.0564 0.27" size="0.002 0.005" quat="0 0 0 1.0" type="cylinder" rgba="1. 0. 0. 1.0" solimp="0.998 0.998 0.001" solref="0.02 1" density="100" friction="0.95 0.3 0.1" group="0" condim="4" />
        <geom pos=" 0.1001 -0.0564 0.27" size="0.002 0.005" quat="0 0 0 1.0" type="cylinder" rgba="1. 0. 0. 1.0" solimp="0.998 0.998 0.001" solref="0.02 1" density="100" friction="0.95 0.3 0.1" group="0" condim="4" />
      </body>
      <body name="visual">
        <inertial pos="0 0 0" mass="0.05" diaginertia="0.002 0.002 0.002" />
        <geom pos="0 0 0" mesh="base" type="mesh" conaffinity="0" contype="0"  group="0" mass="0.0001" rgba="0.8 0.8 0.8 0.1"/>
      </body>
      <site rgba="0 0 0 0" size="0.005" pos="0 0 -0.004" name="bottom_site"/>
      <site rgba="0 0 0 0" size="0.005" pos="0 0 0.004" name="top_site"/>
      <site rgba="0 0 0 0" size="0.005" pos="0. 0. 0" name="horizontal_radius_site"/>
      <site rgba="0 0 0 0" size="0.005" pos="-0.1001 -0.0564 0.1295" name="hole_0_site"/>
    </body>
  </worldbody>
</mujoco>

效果

红色小柱子为模拟的该位置的螺丝孔

相关推荐
极小狐1 小时前
比 Cursor 更丝滑的 AI DevOps 编程智能体 - CodeRider-Kilo 正式发布!
运维·人工智能·devops
半臻(火白)2 小时前
Prompt-R1:重新定义AI交互的「精准沟通」范式
人工智能
菠菠萝宝2 小时前
【AI应用探索】-10- Cursor实战:小程序&APP - 下
人工智能·小程序·kotlin·notepad++·ai编程·cursor
连线Insight2 小时前
架构调整后,蚂蚁继续死磕医疗健康“硬骨头”
人工智能
小和尚同志2 小时前
十月份 AI Coding 实践!Qoder、CC、Codex 还是 iflow?
人工智能·aigc
keke.shengfengpolang2 小时前
中专旅游管理专业职业发展指南:从入门到精通的成长路径
人工智能·旅游
Danceful_YJ3 小时前
35.微调BERT
人工智能·深度学习·bert
ZPC82103 小时前
FPGA 部署ONNX
人工智能·python·算法·机器人
愿没error的x3 小时前
深度学习基础知识总结(一):深入理解卷积(Convolution)
人工智能·深度学习
河铃旅鹿3 小时前
Android开发-java版:布局
android·笔记·学习