Skip to content

PyBullet: only one color is handled in a body, even with multiple <visual> tags #2650

@Gregwar

Description

@Gregwar

In the following URDF example, the two boxes appear red, instead of one red and one green when rendered using PyBullet:

<?xml version="1.0" ?>
<robot name="example" xmlns:xacro="http://www.ros.org/wiki/xacro">
    <link name="main">
        <inertial>
            <origin rpy="0 0 0" xyz="0 0 0"/>
            <mass value="1"/>
            <inertia ixx="4E-06" ixy="0" ixz="0" iyy="4E-06" iyz="0" izz="4E-06"/>
        </inertial>
        <visual>
            <origin rpy="0 0 0" xyz="0 0 0"/>
            <geometry><box size="0.3 0.3 0.3" /></geometry>
            <material name="green"/>
        </visual>
        <visual>
            <origin rpy="0 0 0" xyz="1 0 0"/>
            <geometry><box size="0.3 0.3 0.3" /></geometry>
            <material name="red"/>
        </visual>
        <collision>
            <origin rpy="0 0 0" xyz="1 0 0"/>
            <geometry><box size="0.3 0.3 0.3" /></geometry>
        </collision>
    </link>

    <material name="green"><color rgba="0 1 0 1"/></material>
    <material name="red"><color rgba="1 0 0 1"/></material>
</robot>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions