To make the URDF file my_robot_description.urdf file compatible with Xacro follow the below steps:

1st Step:

Rename the file to my_robo.urdf.xacro

image.png


2nd Step:

Add this line to the code xmlns:xacro="[<http://www.ros.org/wiki/xacro>](<http://www.ros.org/wiki/xacro>)"

<?xml version="1.0"?>
<robot name="my_robot" xmlns:xacro="<http://www.ros.org/wiki/xacro>">

    <material name="blue">
        <color rgba="0 0 0.5 1" />
    </material>
...........

3rd Step:

Change the file name in display,launch files from my_robot.urdf to my_robot.urdf.xacro

<launch>
    <let name="urdf_path" 
            value="$(find-pkg-share my_robot_description)/urdf/my_robot.urdf.xacro" />
            
            ........