The 'type' param was not defined for 'forward_velocity_controller'
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:
- Velocity Controller does not operate in Gazebo when position command interface is also specified.
- Gazebo Control Plugin Does Not Care Whether a Resource is Claimed or Not
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 ...