UniversalRobots/Universal_Robots_ROS2_Driver

Velocity command interface

fafux opened this issue · 5 comments

fafux commented

Hi,
I am trying to control an UR robot both in simulation and with the real hardware with the command interface in velocity with ROS2 foxy. The values of the joint velocities states, in simulation, are changing but the robot is not moving. While if I try to move the robot using the position command interface I can do it.
Is it possible to move the robot only using the velocity command interface? If so, is there any example on how to do it?
Thanks.

fmauch commented

For Foxy, velocity commands have not been implemented. We suggest to use ROS 2 humble, since Foxy is end of life by now.

For humble, a forwarding velocity controller is built in and simply has to be activated using the ros2 control switch_controllers cli tool. To use it, there is a test motion script ros2 launch ur_robot_driver test_forward_velocity_controller.launch.py which runs this script

tldr:
While the robot is running, do

ros2 control load_controller forward_velocity_controller
ros2 control set_controller_state forward_velocity_controller inactive
ros2 control switch_controllers --deactivate scaled_joint_trajectory_controller --activate forward_velocity_controller

# start motion
ros2 topic pub --once /forward_velocity_controller/commands std_msgs/msg/Float64MultiArray "{data:[0,0,0,0,0,0.1]}"

# stop motion
ros2 topic pub --once /forward_velocity_controller/commands std_msgs/msg/Float64MultiArray "{data:[0,0,0,0,0,0.0]}"
fafux commented

Thanks for the clarification.

fafux commented

Hi,

I am using ROS2 humble and I follow your instructions:

ros2 launch ur_robot_driver ur_control.launch.py ur_type:=ur10e robot_ip:=yyy.yyy.yyy.yyy initial_joint_controller:=scaled_joint_trajectory_controller use_fake_hardware:=true launch_rviz:=true
ros2 control load_controller forward_velocity_controller
ros2 control set_controller_state forward_velocity_controller inactive
ros2 control switch_controllers --deactivate scaled_joint_trajectory_controller --activate forward_velocity_controller
ros2 topic pub --once /forward_velocity_controller/commands std_msgs/msg/Float64MultiArray "{data:[0,0,0,0,0,0.1]}"

but the robot is not moving.

fmauch commented

Confirmed that with fake hardware this does not work. With URSim / a real robot this works, however.

fmauch commented

As a comment: Velocity mode for mock_hw is currently being implemented in ros2_control: ros-controls/ros2_control#1028

I've just tested this and with that the robot is indeed moving on velocity commands.