Universal Robots Forum

Force control via ROS

Hi,

For my application I want to let the robot (UR5e) follow a trajectory that I have planned using MoveIt but once the trajectory has been executed, I would like to apply a specific force pattern with the end-effector. Is it possible to implement a force mode controller in ROS such that it is possible to just switch between this and the joint_trajectory_controller?

Currently I am using a different way to control the robot in force mode via the RTDE interface (ur-rtde · PyPI), but this requires to continually switch between the External_control URcap to perform the planned motion and return to the RTDE-interface for force mode. (As was suggested in Force control on UR5e using moveit - ROS Answers: Open Source Q&A Forum, but the also suggested uncertainty about how well the RTDE interface would deal with another client could also play a role in the controllers not starting. For that reason I would like to know about the possibility to use only the ROS driver)

The issue is that this switching is not always smooth as the ROS driver sometimes cannot restart the controllers. This is something we can only solve by completely restarting the driver. I would really appreciate any advice on either implementing force control via ROS or a more smooth method to switch between the different programs.

We’ve been using force control together with our cartesian_controllers. There are different controllers available for different use cases. For your use case, it might be desirable to use the “force_controller”. It will apply the target wrench as long as the robot’s kinematics allow it.

As those are also ROS controllers, you can easily switch between the “scaled_pos_based_trajectory_controller” and the “force_controller” as needed by doing a service call to the controller manager.