方法一
利用loadURDF
在加载模型时将模型固定
b3RobotSimulatorClientAPI m_robotSim;
m_robotSim.setGuiHelper(m_guiHelper);
bool connected = m_robotSim.connect(mode);
m_robotSim.configureDebugVisualizer(COV_ENABLE_RGB_BUFFER_PREVIEW, 0);
m_robotSim.configureDebugVisualizer(COV_ENABLE_DEPTH_BUFFER_PREVIEW, 0);
m_robotSim.configureDebugVisualizer(COV_ENABLE_SEGMENTATION_MARK_PREVIEW, 0);
b3RobotSimulatorLoadUrdfFileArgs args;
args.m_forceOverrideFixedBase = true;
cubeIndex= m_robotSim.loadURDF("cube.urdf", args);
方法二
利用changeDynamics
将模型质量置零
b3RobotSimulatorChangeDynamicsArgs args;
args.m_mass = 0;
m_robotSim.changeDynamics(cubeIndex, -1, args);
方法三
在urdf模型中增加与世界坐标系固连的关节
<link name="world"/>
<joint name="worldJoint" type="fixed">
<parent link="world"/>
<child link="linkBase"/>
<origin rpy="0 0 0" xyz="0 0 0"/>
</joint>
方法四
修改urdf模型中的mass
属性为零
<mass value=".0"/>