ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

ros2_control parser error Couldn't parse params file, Error: Error openingYAML file

asked 2022-03-14 03:52:02 -0500

Roberto Z. gravatar image

updated 2022-03-14 04:32:21 -0500

Hello,
I have been searching but I haven't been able to find any similar questions with this error message.

My goal is to get you the rrbot up and running in Gazebo 11 using ros2_control.

However when I run my launch file I get the following error message:

parser error Couldn't parse params file: '--params-file /home/user/ros2_ws/install/my_robot_bringup/share/my_robot_bringup/config/controller_manager.yaml'. Error: Error openingYAML file.

Unfortunately the referenced path and file does not exist in my system, only this part exists:

/home/user/ros2_ws/install/my_robot_bringup/share/my_robot_bringup/

and this is missing (folder and yaml file do not exist in here):

config/controller_manager.yaml

I think that it has something to do with a missing statement in my CMakeLists.txt but I'm not sure how to correct this problem.

I really appreciate any help.

Roberto

If matters:

  • I'm on ROS2 Foxy.

My URDF ros2_control and plugin snippet:

  <ros2_control name="GazeboSystem" type="system">
    <hardware>
      <plugin>gazebo_ros2_control/GazeboSystem</plugin>
    </hardware>
    <joint name="joint1">
      <command_interface name="position">
        <param name="min">-6.28</param>
        <param name="max">6.28</param>
      </command_interface>
      <state_interface name="position"/>
      <state_interface name="velocity"/>
      <state_interface name="effort"/>
    </joint>
    <joint name="joint2">
      <command_interface name="position">
        <param name="min">-6.28</param>
        <param name="max">6.28</param>
      </command_interface>
      <state_interface name="position"/>
      <state_interface name="velocity"/>
      <state_interface name="effort"/>
    </joint>
  </ros2_control>

  <gazebo>
    <plugin filename="libgazebo_ros2_control.so" name="gazebo_ros2_control">
      <robot_sim_type>gazebo_ros2_control/GazeboSystem</robot_sim_type>
      <parameters>$(find my_robot_bringup)/config/controller_manager.yaml</parameters>
    </plugin>
  </gazebo>

This is my CMakeLists.txt file:

cmake_minimum_required(VERSION 3.5)
project(my_robot_bringup)

if(NOT CMAKE_C_STANDARD)
  set(CMAKE_C_STANDARD 99)
endif()

if(NOT CMAKE_CXX_STANDARD)
  set(CMAKE_CXX_STANDARD 14)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  add_compile_options(-Wall -Wextra -Wpedantic)
endif()

find_package(ament_cmake REQUIRED)
find_package(ament_cmake_python REQUIRED)
find_package(rclcpp REQUIRED)
find_package(rclpy REQUIRED)
find_package(urdf REQUIRED)
find_package(xacro REQUIRED)
find_package(robot_state_publisher REQUIRED)


if(BUILD_TESTING)
  find_package(ament_lint_auto REQUIRED)
  ament_lint_auto_find_test_dependencies()
endif()

install( DIRECTORY launch DESTINATION share/${PROJECT_NAME}/ )

ament_python_install_package(${PROJECT_NAME})

install(PROGRAMS
  scripts/spawn_helper.py
  DESTINATION lib/${PROJECT_NAME}
)

ament_package()

And this is my controller_manager.yaml file:

controller_manager:
  ros__parameters:
    update_rate: 10  # Hz

    joint_state_broadcaster:
      type: joint_state_broadcaster/JointStateBroadcaster

    forward_position_controller:
      type: forward_command_controller/ForwardCommandController

    position_trajectory_controller:
      type: joint_trajectory_controller/JointTrajectoryController


forward_position_controller:
  ros__parameters:
    joints:
      - joint1
      - joint2
    interface_name: position


position_trajectory_controller:
  ros__parameters:
    joints:
      - joint1
      - joint2

    command_interfaces:
      - position

    state_interfaces:
      - position

    state_publish_rate: 200.0 # Defaults to 50
    action_monitor_rate: 20.0 # Defaults to 20

    allow_partial_joints_goal: false # Defaults to false
    open_loop_control: true
    allow_integration_in_goal_trajectories: true
    constraints:
      stopped_velocity_tolerance: 0.01 # Defaults to 0.01
      goal_time: 0.0 # Defaults to 0.0 (start immediately)
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2022-03-14 04:41:19 -0500

You just need to modify install( DIRECTORY launch DESTINATION share/${PROJECT_NAME}/ ) to install( DIRECTORY launch config DESTINATION share/${PROJECT_NAME}/ )

edit flag offensive delete link more

Comments

Many thanks @Serafadam, indeed that answers the problem.

Roberto Z. gravatar image Roberto Z.  ( 2022-03-14 04:50:28 -0500 )edit
0

answered 2022-03-14 04:48:26 -0500

Roberto Z. gravatar image

I guess I was right, after looking a little deeper into CMakeLists and tinkering around a bit I found that I have to use INSTALL(DIRECTORY ...) to make copies of the .yaml file to the right destination.

So this is what my final install(DIRECTORY...) rule looks like:

install(
  DIRECTORY
    launch
    config
  DESTINATION
    share/${PROJECT_NAME}/
)
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2022-03-14 03:52:02 -0500

Seen: 3,403 times

Last updated: Mar 14 '22