ros2_control: No parameter file provided. Configuration might be wrong. failed to parse input yaml file(s)

260 views Asked by At

I am trying to build a 4 wheel differential drive robot. But i am getting error when using ros2_control. I am getting the following error "No parameter file provided. Configuration might be wrong. failed to parse input yaml file(s)" in terminal. But i have made sure that the path of the yaml file is correctly set and the yaml file also seems to be correct

Version: Ros2 Foxy

Terminal Output

[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [robot_state_publisher-1]: process started with pid [5816]
[INFO] [gzserver-2]: process started with pid [5818]
[INFO] [gzclient   -3]: process started with pid [5820]
[INFO] [spawn_entity.py-4]: process started with pid [5823]
[robot_state_publisher-1] Parsing robot urdf xml string.
[robot_state_publisher-1] Link chassis had 0 children
[robot_state_publisher-1] Link left_back_wheel had 0 children
[robot_state_publisher-1] Link left_front_wheel had 0 children
[robot_state_publisher-1] Link right_back_wheel had 0 children
[robot_state_publisher-1] Link right_front_wheel had 0 children
[robot_state_publisher-1] [INFO] [1690121763.018020691] [robot_state_publisher]: got segment base_link
[robot_state_publisher-1] [INFO] [1690121763.018187407] [robot_state_publisher]: got segment chassis
[robot_state_publisher-1] [INFO] [1690121763.018208790] [robot_state_publisher]: got segment left_back_wheel
[robot_state_publisher-1] [INFO] [1690121763.018220648] [robot_state_publisher]: got segment left_front_wheel
[robot_state_publisher-1] [INFO] [1690121763.018230753] [robot_state_publisher]: got segment right_back_wheel
[robot_state_publisher-1] [INFO] [1690121763.018240701] [robot_state_publisher]: got segment right_front_wheel
[spawn_entity.py-4] [INFO] [1690121763.972101628] [spawn_entity]: Spawn Entity started
[spawn_entity.py-4] [INFO] [1690121763.973118829] [spawn_entity]: Loading entity published on topic robot_description
[spawn_entity.py-4] [INFO] [1690121763.982111498] [spawn_entity]: Waiting for entity xml on robot_description
[spawn_entity.py-4] [INFO] [1690121763.996397070] [spawn_entity]: Waiting for service /spawn_entity, timeout = 30
[spawn_entity.py-4] [INFO] [1690121763.997374877] [spawn_entity]: Waiting for service /spawn_entity
[spawn_entity.py-4] [INFO] [1690121765.521777052] [spawn_entity]: Calling service /spawn_entity
[spawn_entity.py-4] [INFO] [1690121765.852681451] [spawn_entity]: Spawn status: SpawnEntity: Successfully spawned entity [my_bot]
[gzserver-2] [INFO] [1690121765.926836611] [gazebo_ros2_control]: Loading gazebo_ros2_control plugin
[gzserver-2] [INFO] [1690121765.932302562] [gazebo_ros2_control]: Starting gazebo_ros2_control plugin in namespace: /
[gzserver-2] [INFO] [1690121765.937069973] [gazebo_ros2_control]: Starting gazebo_ros2_control plugin in ros 2 node: gazebo_ros2_control
[gzserver-2] [ERROR] [1690121765.938411307] [gazebo_ros2_control]: No parameter file provided. Configuration might be wrong
[gzserver-2] [ERROR] [1690121765.941889458] [gazebo_ros2_control]: failed to parse input yaml file(s)
[INFO] [spawn_entity.py-4]: process has finished cleanly [pid 5823]

".yaml" Config File for Ros2 Control

controller_manager:
  ros__parameters:
    update_rate: 30
    use_sim_time: true

    diff_cont:
      type: diff_drive_controller/DiffDriveController

    joint_broad:
      type: joint_state_broadcaster/JointStateBroadcaster

diff_cont:
  ros__parameters:

    publish_rate: 50.0

    base_frame_id: base_link

    left_wheel_names: ['left_front_wheel_joint', 'left_back_wheel_joint']
    right_wheel_names: ['right_front_wheel_joint', 'right_back_wheel_joint']
    wheel_separation: 0.36
    wheel_radius: 0.1

    use_stamped_vel: false

Main URDF File --> robot_core.xacro

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

    <xacro:include filename="inertial_macros.xacro"/>

    <material name="white">
        <color rgba="1 1 1 1" />
    </material>

    <material name="orange">
        <color rgba="1 0.3 0.1 1" />
    </material>

    <material name="blue">
        <color rgba="0.2 0.2 1 1" />
    </material>

    <material name="black">
        <color rgba="0 0 0 1" />
    </material>


    <!-- BASE LINK -->
    <link name="base_link">

    </link>


    <!-- CHASSI LINK -->
    <joint name="chassis_joint" type="fixed">
        <parent link="base_link"/>
        <child link="chassis"/>
        <origin xyz="-0.1 0 0"/>
    </joint>

    <link name="chassis">
        <visual>
            <!-- <origin xyz="0.15 0 0.075"/>   # This line is used to move the chasis relative to its link -->
            <geometry>
                <box size="0.5 0.3 0.05"/>
            </geometry>
            <material name="white"/>
        </visual>

        <collision>
            <!-- <origin xyz="0.3 0 0.075"/>   0.15 0 0.075 -->
            <geometry>
                <box size="0.5 0.3 0.3"/>
            </geometry>
        </collision>

        <xacro:inertial_box mass="0.5" x="0.5" y="0.3" z="0.05">
            <origin xyz="0 0 0" rpy="0 0 0"/>
        </xacro:inertial_box>
    </link>

    <gazebo reference="chassis">
        <material>Gazebo/Orange</material>
    </gazebo>

    <!-- LEFT FRONT WHEEL LINK -->
    <joint name="left_front_wheel_joint" type="continuous">
        <parent link="base_link"/>
        <child link="left_front_wheel"/>        
        <origin xyz="0.15 0.18 0" rpy="-${pi/2} 0 0"/>
        <axis xyz="0 0 1"/>
    </joint>

    <link name="left_front_wheel">
        <visual>
            <geometry>
                <cylinder radius="0.1" length="0.04"/>
            </geometry>
            <material name="blue"/>
        </visual>
        <collision>
            <geometry>
                <cylinder radius="0.1" length="0.04"/>
            </geometry>
        </collision>

        <xacro:inertial_cylinder mass="0.1" length="0.04" radius="0.1">
            <origin xyz="0 0 0" rpy="0 0 0"/>
        </xacro:inertial_cylinder>
    </link>

    <gazebo reference="left_front_wheel">
        <material>Gazebo/Blue</material>
    </gazebo>

    <!-- RIGHT FRONT WHEEL LINK -->
    <joint name="right_front_wheel_joint" type="continuous">
        <parent link="base_link"/>
        <child link="right_front_wheel"/>        
        <origin xyz="0.15 -0.18 0" rpy="${pi/2} 0 0"/>
        <axis xyz="0 0 -1"/>
    </joint>

    <link name="right_front_wheel">
        <visual>
            <geometry>
                <cylinder radius="0.1" length="0.04"/>
            </geometry>
            <material name="blue"/>
        </visual>
        <collision>
            <geometry>
                <cylinder radius="0.1" length="0.04"/>
            </geometry>
        </collision>    

        <xacro:inertial_cylinder mass="0.1" length="0.04" radius="0.1">
            <origin xyz="0 0 0" rpy="0 0 0"/>
        </xacro:inertial_cylinder>
    </link>
    
    <gazebo reference="right_front_wheel">
        <material>Gazebo/Blue</material>
    </gazebo>



    

    <!-- LEFT BACK WHEEL LINK -->
    <joint name="left_back_wheel_joint" type="continuous">
        <parent link="base_link"/>
        <child link="left_back_wheel"/>        
        <origin xyz="-0.35 0.18 0" rpy="-${pi/2} 0 0"/>
        <axis xyz="0 0 1"/>
    </joint>

    <link name="left_back_wheel">
        <visual>
            <geometry>
                <cylinder radius="0.1" length="0.04"/>
            </geometry>
            <material name="blue"/>
        </visual>
        <collision>
            <geometry>
                <cylinder radius="0.1" length="0.04"/>
            </geometry>
        </collision>

        <xacro:inertial_cylinder mass="0.1" length="0.04" radius="0.1">
            <origin xyz="0 0 0" rpy="0 0 0"/>
        </xacro:inertial_cylinder>
    </link>

    <gazebo reference="left_back_wheel">
        <material>Gazebo/Blue</material>
        <!-- To remove Friction
        <mu1 value="0.001"/>
        <mu2 value="0.001"/>
        -->
    </gazebo>

    <!-- RIGHT BACK WHEEL LINK -->
    <joint name="right_back_wheel_joint" type="continuous">
        <parent link="base_link"/>
        <child link="right_back_wheel"/>        
        <origin xyz="-0.35 -0.18 0" rpy="${pi/2} 0 0"/>
        <axis xyz="0 0 -1"/>
    </joint>

    <link name="right_back_wheel">
        <visual>
            <geometry>
                <cylinder radius="0.1" length="0.04"/>
            </geometry>
            <material name="blue"/>
        </visual>
        <collision>
            <geometry>
                <cylinder radius="0.1" length="0.04"/>
            </geometry>
        </collision>

        <xacro:inertial_cylinder mass="0.1" length="0.04" radius="0.1">
            <origin xyz="0 0 0" rpy="0 0 0"/>
        </xacro:inertial_cylinder>
    </link>

    <gazebo reference="right_back_wheel">
        <material>Gazebo/Blue</material>
        <!-- To remove Friction
        <mu1 value="0.001"/>
        <mu2 value="0.001"/>
        -->
    </gazebo>



</robot>

Ros2 Control URDF File --> ros2_control.xacro

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

    <ros2_control name="GazeboSystem" type="system">
        <hardware>
            <plugin>gazebo_ros2_control/GazeboSystem</plugin>
        </hardware>

        <joint name="left_front_wheel_joint">
            <command_interface name="velocity">
                <param name="min">-10</param>
                <param name="max">10</param>
            </command_interface>
            <state_interface name="velocity"/>
            <state_interface name="position"/>
        </joint>

        <joint name="right_front_wheel_joint">
            <command_interface name="velocity">
                <param name="min">-10</param>
                <param name="max">10</param>
            </command_interface>
            <state_interface name="velocity"/>
            <state_interface name="position"/>
        </joint>


        <!-- Adding Other wheels -->
        <joint name="left_back_wheel_joint">
            <command_interface name="velocity">
                <param name="min">-10</param>
                <param name="max">10</param>
            </command_interface>
            <state_interface name="velocity"/>
            <state_interface name="position"/>
        </joint>

        <joint name="right_back_wheel_joint">
            <command_interface name="velocity">
                <param name="min">-10</param>
                <param name="max">10</param>
            </command_interface>
            <state_interface name="velocity"/>
            <state_interface name="position"/>
        </joint>
        
    </ros2_control>

    <gazebo>
        <plugin name="gazebo_ros2_control" filename="libgazebo_ros2_control.so">
            <paramters>$(find my_bot)/config/my_controllers.yaml</paramters> 
        </plugin>
    </gazebo>
    

</robot>

Launch File --> launch_sim.launch.py

import os

from ament_index_python.packages import get_package_share_directory


from launch import LaunchDescription
from launch.actions import IncludeLaunchDescription
from launch.launch_description_sources import PythonLaunchDescriptionSource

from launch_ros.actions import Node



def generate_launch_description():


    # Include the robot_state_publisher launch file, provided by our own package. Force sim time to be enabled
    # !!! MAKE SURE YOU SET THE PACKAGE NAME CORRECTLY !!!

    package_name='my_bot' #<--- CHANGE ME

    rsp = IncludeLaunchDescription(
                PythonLaunchDescriptionSource([os.path.join(
                    get_package_share_directory(package_name),'launch','rsp.launch.py'
                )]), launch_arguments={'use_sim_time': 'true'}.items()
    )

    # Include the Gazebo launch file, provided by the gazebo_ros package
    gazebo = IncludeLaunchDescription(
                PythonLaunchDescriptionSource([os.path.join(
                    get_package_share_directory('gazebo_ros'), 'launch', 'gazebo.launch.py')]),
             )


    # Run the spawner node from the gazebo_ros package. The entity name doesn't really matter if you only have a single robot.
    spawn_entity = Node(package='gazebo_ros', executable='spawn_entity.py',
                        arguments=['-topic', 'robot_description',
                                   '-entity', 'my_bot'],
                        output='screen')



    # Launch them all!
    return LaunchDescription([
        rsp,
        gazebo,
        spawn_entity,
    ])

Thanks.

0

There are 0 answers