how pos/vel_based_pos_traj_controller work?
Hi all,
I am trying to control a real UR5 using the position based controller of urmoderndriver package, but I have a little problem: when i plan and execute a trajectory through MoveIt the robot achieves the goal not in a clean way (the end-effector passes over the goal and reaches it in a second moment after few oscillations).
What should I do in order to improve this situation? I know there are some parameters that could be set in the ur5controllers.yaml file (urmoderndriver -> config -> ur5controllers.yaml) but the PID parameters can be set only for velocity_based controller, which I don't use because when I try to use it the robot doesn't move at all! Then here comes another question:
how can I use velbasedpostrajcontroller from urmoderndriver package?
At the moment I am using posbasedpostrajcontroller, but I don't know how to setup it. Here I copy its yaml code:
pos_based_pos_traj_controller:
type: position_controllers/JointTrajectoryController
joints:
- shoulder_pan_joint
- shoulder_lift_joint
- elbow_joint
- wrist_1_joint
- wrist_2_joint
- wrist_3_joint
constraints:
goal_time: 0.6
stopped_velocity_tolerance: 0.05
shoulder_pan_joint: {trajectory: 0.1, goal: 0.1}
shoulder_lift_joint: {trajectory: 0.1, goal: 0.1}
elbow_joint: {trajectory: 0.1, goal: 0.1}
wrist_1_joint: {trajectory: 0.1, goal: 0.1}
wrist_2_joint: {trajectory: 0.1, goal: 0.1}
wrist_3_joint: {trajectory: 0.1, goal: 0.1}
stop_trajectory_duration: 0.5
state_publish_rate: 125
action_monitor_rate: 10
# state_publish_rate: 50 # Defaults to 50
# action_monitor_rate: 20 # Defaults to 20
#hold_trajectory_duration: 0.0 # Defaults to 0.5
The commands I run in order to communicate with real hardware are the followings:
roslaunch ur_modern_driver ur5_ros_control.launch robot_ip:=192.168.0.9
roslaunch ur5_moveit_config ur5_moveit_planning_execution.launch
roslaunch ur5_moveit_config moveit_rviz.launch config:=true
my ubuntu version: 16.04 Ros Kinetic
Thanks in advance to anyone who will help. -Enrico
Edit: this is the error when using /velbasedpostrajcontroller:
[ WARN] [1530109956.151695655]: Controller /vel_based_pos_traj_controller failed with error code PATH_TOLERANCE_VIOLATED
[ WARN] [1530109956.151808590]: Controller handle /vel_based_pos_traj_controller reports status ABORTED
[ INFO] [1530109956.170454938]: Completed trajectory execution with status ABORTED ...
[ INFO] [1530109956.170689596]: Execution completed: ABORTED
(Actually I have the same kind of error when running pos_based controller, but the execution is done anyway)
this is my controller.yaml when using velbasedcontroller:
controller_list:
- name: /vel_based_pos_traj_controller
action_ns: follow_joint_trajectory
type: FollowJointTrajectory
default: true
joints:
- shoulder_pan_joint
- shoulder_lift_joint
- elbow_joint
- wrist_1_joint
- wrist_2_joint
- wrist_3_joint
Asked by enrico on 2018-06-25 10:57:32 UTC
Answers
Are you already using the ur_modern_driver package? The velocity controller is loaded then by default - then those oscillations are occurring because of bad PID values. If you want to be sure that you use the controller that you want you need to edit the moveit controllers config (everything is in the ur_modern_driver repository). Also, I see that the position controller has its own PID, so changing those values might help.
Asked by Fiddle on 2018-06-26 10:23:36 UTC
Comments
Yes I'm using ur_modern_driver package, but if I don't switch from velocity_controller to position_controller I am not able to plan and execute a trajectory. In the piece of code of pos_controller I pasted above I can't see PID values... are you referring to another file?
Asked by enrico on 2018-06-26 13:44:26 UTC
Ah, sorry, I looked at the wrong piece of code. Anyway, I was fine with using the velocity controller, only I had to change the PID values (you have to experiment with them). Also, I've played with action_monitor_rate. What are your logs when using velocity controller?
Asked by Fiddle on 2018-06-27 09:08:26 UTC
I edited the question. Another thing is that I read about ros_control and ros_controllers packages but I haven't installed them already. Did you install them?
Asked by enrico on 2018-06-27 09:39:33 UTC
Sorry for responding so late, and yes, I have ros_control and ros_controllers installed
Asked by Fiddle on 2018-07-03 04:43:09 UTC
I installed them, but still bad result in the trajectory execution. Did you modify them in some way?
Asked by enrico on 2018-07-03 10:06:05 UTC
The only thing I changed are PID values that I found somewhere on the web: {p: 18.0, i: 270.0, d: 0.0001, i_clamp: 20.14} for all joints. This of course needs to changed further, but it worked enough for my usage at the time.
Asked by Fiddle on 2018-07-04 05:37:28 UTC
can you paste here your ur5_ros_control.launch file please?
Asked by enrico on 2018-07-04 08:57:20 UTC
Its the same as here
the only difference is
Asked by Fiddle on 2018-07-04 09:02:08 UTC
Thanks for the suggestion, but I'm already using zagitta fork
Asked by enrico on 2018-07-04 09:32:41 UTC
Comments
This is probably an issue with the specific driver and how it uses the external interfaces of the UR controller, and not necessarily something to do with the parameters. It could still be the case that those parameters influence this, but just thought I'd mention this.
Asked by gvdhoorn on 2018-06-25 11:15:46 UTC
In that case what would you suggest? Or alternatively, do you have an idea on how I could implement the vel_based controller instead of the pos_based one? (if you've ever experienced it...)
Asked by enrico on 2018-06-25 11:32:08 UTC