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.
I have been trying to use the cartesian compliance controller from the cartesian controllers you suggested with a UR3 and a SensOne F/T sensor. I have gotten it to work so far but experience some vibrations/oscillations when the end-effector comes into contact with a rigid surface. I have tried fine-tuning the controller parameters but with little luck so far.
Have you experienced anything similar, or do you know whether this is a known issue with the controller?
I really appreciate any help you can provide.
Very nice that you got the controller working in your application, this means you are already a step ahead of me! I have to admit that I also did not spend that much time on it anymore as we focused on other things in the project first.
For that reason I also do not have a similar experience with this controller, but the issue you mention does sound like the controller settings you use do not guarantee completely passive behavior. Minimizing the impedance of the system (using a compliance controller) can result in non-passive interaction with rigid objects. The oscillations will probably be damped out by the physical damping in the joint which makes that the overall system will still be passive, but for guaranteed safe interaction it might be best to keep the compliance away from its maximum value.
It might be interesting for you to take a look at passive interaction control:
Yes, oscillation on rigid surfaces can occur depending on the specific setup and parameters. Reducing the
error_scale, p-gains and stiffness values might help you getting a stable (yet less reactive) system, from which you can slowly increase the parameters as much as the system doesn’t become instable.
See the package’s README configuration section for details and feel free to open an issue there on anything being unclear.