bulletphysics / bullet3

Bullet Physics SDK: real-time collision detection and multi-physics simulation for VR, games, visual effects, robotics, machine learning etc.
http://bulletphysics.org
Other
12.18k stars 2.85k forks source link

Inertia value does not match the box size #4606

Open A-qingtongxiaoyou opened 2 months ago

A-qingtongxiaoyou commented 2 months ago

'pybullet_examples/inverse_dynamics.py' relates to the urdf file 'pybullet_data/TwoJointRobot_wo_fixedJoints.urdf'. In the urdf,

<link name="link_1">
    <visual>
      <geometry>
        <box size="1.0 0.1 0.05"/>
      </geometry>
      <origin rpy="0 0 0" xyz="0.5 0 0"/>
      <material name="blue"/>
    </visual>
    <collision>
      <geometry>
        <box size="1.0 0.1 0.05"/>
      </geometry>
      <origin rpy="0 0 0" xyz="0.5 0 0"/>
    </collision>
    <inertial>
      <mass value="0.5"/>
      <inertia ixx="0.00208333333333" ixy="0.0125" ixz="0.00625" iyy="0.167083333333" iyz="0.000625" izz="0.168333333333"/>
    </inertial>
According to the formula for the inertia tensor of a rectangular body: ixx=(1/12) * 0.5 * (0.1*0.1+0.05*0.05)=0.0005208, and ixz, ixy, iyz =0. Why are the results does not match with       <inertia ixx="0.00208333333333" ixy="0.0125" ixz="0.00625" iyy="0.167083333333" iyz="0.000625" izz="0.168333333333"/>