Universal_Robots_ROS_Driver
Universal_Robots_ROS_Driver copied to clipboard
Confusion with setting up a homebrew velocity controller
I am currently running the Foxy build of the driver with a UR5e and I've built my own velocity controller that subscribes to the FT topics and publishes velocity commands on the topic "cmd_vel".
I have been having trouble configuring the UR to accept these velocity commands and am not sure if how I am setting up my .yaml is actually appropriate. It seems like velocity control has only recently been incorporated, but I couldn't find the controllers on the master for the life of me. My .yaml is written as follows...
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription
from launch.conditions import IfCondition
from launch.substitutions import Command, FindExecutable, LaunchConfiguration, PathJoinSubstitution, ThisLaunchFileDir
from launch_ros.actions import Node
from launch_ros.substitutions import FindPackageShare
from launch.actions import GroupAction
from launch_ros.actions import PushRosNamespace
from launch.launch_description_sources import PythonLaunchDescriptionSource
import sys
from pprint import pprint
def generate_launch_description():
declared_arguments = []
declared_arguments.append(
DeclareLaunchArgument(
"robot_ip",
default_value="192.168.0.99",
description="IP address by which the robot can be reached.",
)
)
declared_arguments.append(
DeclareLaunchArgument(
"use_fake_hardware",
default_value="false",
description="Start robot with fake hardware mirroring command to its states.",
)
)
declared_arguments.append(
DeclareLaunchArgument(
"fake_sensor_commands",
default_value="false",
description="Enable fake command interfaces for sensors used for simple simulations. \
Used only if 'use_fake_hardware' parameter is true.",
)
)
declared_arguments.append(
DeclareLaunchArgument(
"robot_controller",
default_value="right_velocity_controller",
description="Robot controller to start.",
)
)
declared_arguments.append(
DeclareLaunchArgument("launch_rviz", default_value="false", description="Launch RViz?")
)
# Initialize Arguments
robot_ip = LaunchConfiguration("robot_ip")
use_fake_hardware = LaunchConfiguration("use_fake_hardware")
fake_sensor_commands = LaunchConfiguration("fake_sensor_commands")
robot_controller = LaunchConfiguration("robot_controller")
controller_namespace = LaunchConfiguration("controller_namespace")
launch_rviz = LaunchConfiguration("launch_rviz")
base_launch = IncludeLaunchDescription(
PythonLaunchDescriptionSource([ThisLaunchFileDir(), "/ur_control.launch.py"]),
launch_arguments={
"ur_type": "ur5e",
"robot_ip": robot_ip,
"use_fake_hardware": use_fake_hardware,
"fake_sensor_commands": fake_sensor_commands,
"robot_controller": robot_controller,
"reverse_port": "50004",
"script_sender_port": "50005",
"trajectory_port": "50006",
"controller_namespace": "/right/controller_manager",
"launch_rviz": launch_rviz,
}.items(),
)
right_launch_namespace = GroupAction(
actions=[
PushRosNamespace('right')
]+declared_arguments+[base_launch]
)
# return LaunchDescription(declared_arguments + [base_launch])
return LaunchDescription([right_launch_namespace])
Once I run the ur_bringup, I get the following error:
[ros2_control_node-14] [ERROR] [1662560085.951697309] [right.controller_manager]: The 'type' param not defined for 'right_velocity_controller'.
This could be perhaps because of how I've configured my controller, but I am not quite certain. How is the UR supposed to accept these inputs?
I apologize if my query comes off misinformed, I still quite don't understand how this driver is accepting velocity commands.
@TheFalcoGuy The code you showed is not your controller yaml file, but a launch file, so that unfortunately won't help with debugging your controller setup.
I am under the impression, that there is some misunderstanding about controllers here.
If you have written your own controller that uses an FTS interface and writes commands into a velocity interface, then you will have written a plugin with a corresponding plugin file. This has to be defined inside your controllers.yaml file similar to this entry probably accompanied by some parametrization such as this one.
If you have simply written a node that listens to the TF topic and wants to publish messages to a running velocity controller, then you should have the forward_velocity_controller running for your robot, which will provide a /forward_velocity_controller/commands topic for you to publish commands to. However, be aware, that using this topic-based communication will introduce some undeterministic delay in your controller-like node. This is why controllers exist in the first place.
This issue has not been updated for a long time. If no further updates are added, this will be closed automatically. Comment on the issue to prevent automatic closing.
This issue has been closed due to inactivity. Feel free to comment or reopen if this is still relevant.