Why doesn't my URDF joints appear for tweaking wihtin RViz

Firstly, i’d like to say that the code runs fine, but the robot does not do what it’s supposed to do. But thats not my question.

The question is: Why are the pitch_joint and yaw_joint joints in my joint_state_publisher missing in Rviz? This is my current code:

<?xml version="1.0"?>
<link name = "roll_link">
    <origin rpy="0 0 0" xyz="0 0 0"/>
    <geometry>
        <cylinder radius="0.002" length="0.001"/>
    </geometry>
</link>

<joint name="roll_joint" type="revolute">
    <parent link = "base"/>
    <child link = "roll_link"/>       
    <origin rpy="0 0 0" xyz="0 0 0"/>
    <limit lower="-0.2" upper="0.2" effort="0.1" velocity="0.005"/>
    <axis xyz = "1 0 0"/>
</joint>

<link name = "pitch_link">
    <origin rpy="0 0 0" xyz="0 0 0"/>
    <geometry>
        <cylinder radius="0.002" length="0.001"/>
    </geometry>
</link>

<joint name="pitch_joint" type="revolute">
    <parent link = "roll_link"/>
    <child link = "pitch_link"/>       
    <origin rpy="0 0 0" xyz="0 0 0"/>
    <limit lower="0.2" upper="0.2" effort="0.1" velocity="0.005"/>
    <axis xyz = "0 1 0"/>
</joint>


<link name = "yaw_link">
    <origin rpy="0 0 0" xyz="0 0 0"/>
    <geometry>
        <cylinder radius="0.002" length="0.001" />
    </geometry>
</link>

<joint name="yaw_joint" type="revolute">
    <parent link = "pitch_link"/>
    <child link = "yaw_link"/>       
    <origin rpy="0 0 0" xyz="0 0 0"/>
    <limit lower="0.2" upper="0.2" effort="0.1" velocity="0.005"/>
    <axis xyz = "0 0 1"/>
</joint>    

<link name= "head">
    <visual>
        <origin rpy="0 0 0" xyz="0 0 0"/>
        <geometry>
            <sphere radius="0.06"/>
        </geometry>
    </visual>
</link>

<joint name="head_joint" type="revolute">
    <parent link="yaw_link"/>
    <child link="head"/>
    <origin xyz="0 0 0.06" rpy="0 0 0"/>
    <limit lower="-0.2" upper="0.2" effort="0.1" velocity="0.005"/>
    <axis xyz="1 0 0"/>
</joint>

<link name="left_eye">
    <visual>
        <origin xyz="0 0 0" rpy="0 0 0"/>
        <geometry>
            <cylinder length="0.005" radius="0.005"/>
        </geometry>
    </visual>
</link>

<link name="right_eye">
    <visual>
        <origin xyz="0 0 0" rpy="0 0 0"/>
        <geometry>
            <cylinder length="0.005" radius="0.005"/>
        </geometry>
    </visual>
</link>

<joint name="l_eye_joint" type="fixed">
    <parent link="head"/>
    <child link="left_eye"/>
    <origin xyz = "0.06 0.01 0" rpy="0 1.5707 0"/>
</joint>

<joint name="r_eye_joint" type="fixed">
    <parent link="head"/>
    <child link="right_eye"/>
    <origin xyz = "0.06 -0.01 0" rpy="0 1.5707 0"/>
</joint>

And this is what i see in RViz:

Only the roll_joint and head_joint are displayed in Rviz even though i explicitly defined the other joints within my URDF code. Pls help, thanks!

Ok anyway i solved it. It was a really silly mistake that cost me hours trying to figure out. I realised it was because i was careless and forgot to put a negative sign in the “limit lower” field inside the “yaw_joint” and “head_joint” causing it not to appear in the RViz

Glad that you solved it! Also thanks for sharing the solution here so that it can help other users that face the same issue.