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

The 'type' param was not defined for 'forward_velocity_controller'

asked 2022-03-18 05:07:18 -0500

Roberto Z. gravatar image

updated 2022-03-18 05:17:33 -0500

Hello,

I have been googling and trying to find a solution for this without any luck.

My goal is to control the rrbot using velocity commands in Gazebo 11 using ros2_control.

I am able to control the robot using the forward_position_controller, that's working fine.

Unfortunately when I change my code (urdf + launch file) to try to use a velocity controller I run into an error saying :

[controller_manager]: The 'type' param was not defined for 'forward_velocity_controller'.

I am rather clueless where the 'type' param should be defined as I only changed my launch file from this:

robot_controller_spawner = Node(
    package="controller_manager",
    executable="spawner",
    arguments=["forward_position_controller", "-c", "/controller_manager"],
)

into this:

robot_controller_spawner = Node(
    package="controller_manager",
    executable="spawner",
    arguments=["forward_velocity_controller", "-c", "/controller_manager"],
)

And I deleted the command_interface for position from my URDF file because of this issue saying that velocity does not work when a position command interface is defined:

But I don't think that deleting the position interface is the root of the problem.

I really appreciate any help you can provide.

Roberto

If matters:

  • I'm on Ubuntu 20.04.4 LTS + ROS2 Galactic

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="velocity">
          <param name="min">-1</param>
          <param name="max">1</param>
        </command_interface>
        <command_interface name="acceleration">
          <param name="min">-1</param>
          <param name="max">1</param>
        </command_interface>
        <state_interface name="position"/>
        <state_interface name="velocity"/>
        <state_interface name="acceleration"/>
      </joint>
      <joint name="joint2">
        <command_interface name="velocity">
          <param name="min">-1</param>
          <param name="max">1</param>
        </command_interface>
        <command_interface name="acceleration">
          <param name="min">-1</param>
          <param name="max">1</param>
        </command_interface>
        <state_interface name="position"/>
        <state_interface name="velocity"/>
        <state_interface name="acceleration"/>
      </joint>
  </ros2_control>

  <!-- ros2_control plugin -->
  <gazebo>
    <plugin filename="libgazebo_ros2_control.so" name="gazebo_ros2_control">
      <robot_param>robot_description</robot_param>
      <robot_param_node>robot_state_publisher</robot_param_node>
      <parameters>$(find rrbot)/config/controller_config.yaml</parameters>
    </plugin>
  </gazebo>

This is my launch file (Gazebo + robot spawn is on a separate launch file:

import os

from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch_ros.actions import Node
from launch.actions import ExecuteProcess, IncludeLaunchDescription, RegisterEventHandler
from launch.event_handlers import OnProcessExit
from launch.launch_description_sources import PythonLaunchDescriptionSource
import xacro

def generate_launch_description():

    rrbot_description_path = os.path.join(
        get_package_share_directory('rrbot_unit1'))

    xacro_file = os.path.join(rrbot_description_path,
                              'urdf',
                              'rrbot.xacro')

    doc = xacro.parse(open(xacro_file))
    xacro.process_doc(doc)
    robot_description_config = doc.toxml()
    robot_description = {'robot_description': robot_description_config}

    node_robot_state_publisher = Node(
        package='robot_state_publisher',
        executable='robot_state_publisher',
        output='screen',
        parameters=[robot_description]
    )

    joint_state_broadcaster_spawner = Node(
        package="controller_manager",
        executable="spawner",
        arguments=["joint_state_broadcaster",
                   "--controller-manager", "/controller_manager"],
    )

    robot_controller_spawner = Node(
        package="controller_manager",
        executable="spawner",
        arguments=["forward_velocity_controller", "-c", "/controller_manager"],
    )

    nodes = [
        node_robot_state_publisher,
        joint_state_broadcaster_spawner,
        robot_controller_spawner
    ]

    return LaunchDescription(nodes)

And this is my controller_config.yaml file:

controller_manager:
  ros__parameters:
    update_rate: 100  # Hz

    forward_position_controller:
      type: position_controllers/JointGroupPositionController

    forward_velocity_controller:
      type: velocity_controllers/JointGroupVelocityController

    forward_acceleration_controller:
      type: forward_command_controller ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2023-05-31 19:25:20 -0500

Luczia gravatar image

updated 2023-05-31 19:25:46 -0500

Hi ! I think you want your type definition in controller_config.yaml to be of written like this :

forward_position_controller:
  type: forward_command_controller/ForwardCommandController
edit flag offensive delete link more

Comments

Thanks, I had a similar problem while following Articulated robot on https://www.youtube.com/watch?v=4QKsD.... I am using Ros2 Humble. As I understood now the title xxxxx: must be the same as the type: xxxxx/ ---- With this mortification of the yaml file, it worked. I am not sure if it is specific to Humble

Vishu gravatar image Vishu  ( 2023-06-12 07:46:35 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2022-03-18 05:07:18 -0500

Seen: 1,425 times

Last updated: May 31 '23