0

Forgive my English, which is not very good. I want to pile up objects and see where they collapse. The height is obviously wrong when trying to verify. So, I loaded a simple plate and found that a gap of 1 mm was created between the top and bottom of the object. I see a small gap... Is this a problem with the URDF or with the simulation setup?

Below is the URDF code.

<?xml version="1.0"?>
<robot name="test_pallet">
    <link name="base_link">
        <visual>
            <origin rpy="0 0 0" xyz="-0.1 -0.1 -0.001"/>
            <geometry>
                <mesh filename="test_pallet.obj" scale="0.001 0.001 0.001"/>
            </geometry>
            <material name="blue">
                <color rgba="0 0 1 1"/>
            </material>
        </visual>
        <collision>
            <origin rpy="0 0 0" xyz="-0.1 -0.1 -0.001"/>
            <geometry>
                <mesh filename="test_pallet_vhacd.obj" scale="0.001 0.001 0.001"/>
            </geometry>
        </collision>
        <inertial>
            <origin rpy="0 0 0" xyz="0 0 0"/>
            <mass value="0.05"/>
            <inertia ixx="0" ixy="0" ixz="0" iyy="0" iyz="0" izz="0"/>
        </inertial>
    </link>
</robot>

Below is the code for the simulation.

import pybullet as p
import pybullet_data as pd
import time
import math


def main() -> None:
    physics_client = p.connect(p.GUI)
    p.setAdditionalSearchPath(pd.getDataPath())

    # 重力設定(地面方向にg=0.98[m/s^2])
    p.setGravity(0, 0, -9.8)

    p.resetDebugVisualizerCamera(
        cameraDistance=2,
        cameraYaw=45,
        cameraPitch=-45,
        cameraTargetPosition=[0, 0, 0],
    )

    # 床を設置
    plane_id = p.loadURDF("plane.urdf")

    # ガイドを設置
    # bou_id = p.loadURDF("bou.urdf", basePosition=[0.100, 0.050, 0.300])
    # bou_id = p.loadURDF("bou.urdf", basePosition=[-0.130, 0.050, 0.300])
    # bou_id = p.loadURDF("bou.urdf", basePosition=[0.000, 0.160, 0.300])

    # ワークをN個積み上げる
    N = 10
    work_id_list = []
    for i in range(N):
        work_id = p.loadURDF(
            "test_pallet.urdf",
            basePosition=[0, 0, 0.05 + 0.06 * i],
            baseOrientation=[0, 0, 0, math.sqrt(2)],
        )
        work_id_list.append(work_id)

    t = 1
    while True:
        p.stepSimulation()
        time.sleep(0.001)
        if(t % 500 == 0):
            print("-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-")    
            for i in range(N):       
                work_position, work_orientation= p.getBasePositionAndOrientation(work_id_list[i])

                x = work_position[0]
                y = work_position[1]
                z = work_position[2]
                rx = work_orientation[0] 
                ry = work_orientation[1]
                rz = work_orientation[2]

                print(
                        f"{i+1:02}\t",
                        f"{x:.3f}\t",
                        f"{y:.3f}\t",
                        f"{z:.3f}\t",
                        f"{rx:.3f}\t",
                        f"{ry:.3f}\t",
                        f"{rz:.3f}\t",
                    )
    
        t += 1


if __name__ == "__main__":
    main()

It attempted to treat the object as a small gap by loading it at 1000x. However, when stacking complex shapes, gaps are a concern, so if this is a problem with the setup in the first place, I would like to solve it. Thanks for taking a look. Best regards.

Sasami
  • 1
  • 2

0 Answers0