In this section we are going to:


Step 1: Create my_robot_bringup package:

Use this command to create new package:

cd ros2_ws/src/
ros2 pkg create my_robot_bringup

Step 2: Create Launch Folder

image.png

Step 3: Install Launch Folder

To install the launch folder we must modify the CMakeLists.txt file:

image.png

Step 4: Add a New Launch File my_robot_gazebo.launch.xml

image.png

To add the file just right click on the launch folder and then choose add file

Step 5: Start the Robot State Publisher Node

The following is the code:

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

    <node pkg="robot_state_publisher" exec="robot_state_publisher">
        <param name="robot_description"
                value="$(command 'xacro $(var urdf_path)')" />
    </node>    
    
</launch>