-
Notifications
You must be signed in to change notification settings - Fork 311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feature_request] Adds ability to switch gazebo hardware interface #161
Comments
This comment has been minimized.
This comment has been minimized.
@gollth I think for releasing the Noetic version of the panda_moveit_config it would be enough if you could provide add a Example controllersEffort trajectory controllerThe PID gains below do not work on the real robot (i.e. will lead to very big velocities) and cause small oscillations (i.e. non-zero velocities) in the simulation. This is because this PID controller was tuned for #126. joint_position_example_controller:
type: franka_example_controllers/JointPositionExampleController
arm_id: $(arg arm_id)
joint_names:
- $(arg arm_id)_joint1
- $(arg arm_id)_joint2
- $(arg arm_id)_joint3
- $(arg arm_id)_joint4
- $(arg arm_id)_joint5
- $(arg arm_id)_joint6
- $(arg arm_id)_joint7
+joint_effort_trajectory_example_controller:
+ type: effort_controllers/JointTrajectoryController
+ joints:
+ - panda_joint1
+ - panda_joint2
+ - panda_joint3
+ - panda_joint4
+ - panda_joint5
+ - panda_joint6
+ - panda_joint7
+ constraints:
+ goal_time: 0.5
+ panda_joint1:
+ goal: 0.05
+ panda_joint2:
+ goal: 0.05
+ panda_joint3:
+ goal: 0.05
+ panda_joint4:
+ goal: 0.05
+ panda_joint5:
+ goal: 0.05
+ panda_joint6:
+ goal: 0.05
+ panda_joint7:
+ goal: 0.05
+ gains:
+ panda_joint1: { p: 12000, d: 50, i: 0.0, i_clamp: 10000 }
+ panda_joint2: { p: 30000, d: 100, i: 0.02, i_clamp: 10000 }
+ panda_joint3: { p: 18000, d: 50, i: 0.01, i_clamp: 1 }
+ panda_joint4: { p: 18000, d: 70, i: 0.01, i_clamp: 10000 }
+ panda_joint5: { p: 12000, d: 70, i: 0.01, i_clamp: 1 }
+ panda_joint6: { p: 7000, d: 50, i: 0.01, i_clamp: 1 }
+ panda_joint7: { p: 2000, d: 20, i: 0.0, i_clamp: 1 } Position trajectory controllerThe controller below works on the real robot but does not work in simulation as the joint_position_example_controller:
type: franka_example_controllers/JointPositionExampleController
arm_id: $(arg arm_id)
joint_names:
- $(arg arm_id)_joint1
- $(arg arm_id)_joint2
- $(arg arm_id)_joint3
- $(arg arm_id)_joint4
- $(arg arm_id)_joint5
- $(arg arm_id)_joint6
- $(arg arm_id)_joint7
+joint_position_trajectory_example_controller:
+ type: position_controllers/JointTrajectoryController
+ joints:
+ - panda_joint1
+ - panda_joint2
+ - panda_joint3
+ - panda_joint4
+ - panda_joint5
+ - panda_joint6
+ - panda_joint7
+ constraints:
+ goal_time: 0.5
+ panda_joint1:
+ goal: 0.05
+ panda_joint2:
+ goal: 0.05
+ panda_joint3:
+ goal: 0.05
+ panda_joint4:
+ goal: 0.05
+ panda_joint5:
+ goal: 0.05
+ panda_joint6:
+ goal: 0.05
+ panda_joint7:
+ goal: 0.05
+ gains:
+ panda_joint1: { p: 12000, d: 50, i: 0.0, i_clamp: 10000 }
+ panda_joint2: { p: 30000, d: 100, i: 0.02, i_clamp: 10000 }
+ panda_joint3: { p: 18000, d: 50, i: 0.01, i_clamp: 1 }
+ panda_joint4: { p: 18000, d: 70, i: 0.01, i_clamp: 10000 }
+ panda_joint5: { p: 12000, d: 70, i: 0.01, i_clamp: 1 }
+ panda_joint6: { p: 7000, d: 50, i: 0.01, i_clamp: 1 }
+ panda_joint7: { p: 2000, d: 20, i: 0.0, i_clamp: 1 }
+
+ gazebo_ros_control:
+ pid_gains:
+ panda_joint1: { p: 12000, d: 50, i: 0.0, i_clamp: 10000 }
+ panda_joint2: { p: 30000, d: 100, i: 0.02, i_clamp: 10000 }
+ panda_joint3: { p: 18000, d: 50, i: 0.01, i_clamp: 1 }
+ panda_joint4: { p: 18000, d: 70, i: 0.01, i_clamp: 10000 }
+ panda_joint5: { p: 12000, d: 70, i: 0.01, i_clamp: 1 }
+ panda_joint6: { p: 7000, d: 50, i: 0.01, i_clamp: 1 }
+ panda_joint7: { p: 2000, d: 20, i: 0.0, i_clamp: 1 }
+ panda_finger_joint1: { p: 5, d: 3.0, i: 0, i_clamp: 1 }
+ panda_finger_joint2: { p: 5, d: 1.0, i: 0, i_clamp: 1 } |
Problems with the earlier mentioned PID gainsEffort trajectory controller PID gainsThe current PID gains found in the effort_joint_trajectory_controllers.yaml are not correct. With these PID gains.
This is because this PID controller was tuned for #126. These wrongly tuned PID gains lead to a number of problems. Joint trajectory controller GOAL_TOLERANCE_VOILATED errorWith the current PID gains the robot has small oscillations when the velocity should be zero (see the gif and the console log below). As a result, during trajectory control, the JointTrajectoryController throws a velocity: [-2.3700327160491814, -0.07111169060622406, 2.42011259637029, -0.1602890653322738, -0.5338011186773755, 0.25708581160465127, 1.144875244723069, 0.04420516084897766, -0.044204294583440176] As can be seen from the picture above, the velocity of the first panda joint is very high, while we do not see this movement in the simulation. This is likely because the PID gains are very high, causing it to constantly switch the direction of the control. This assumption strengthened by looking at the velocity between time steps. One time step it is MoveIt gripper control execution timeoutIn addition to the problem above, these wrongly tuned PID gains also prohibit MoveIt from correctly using the franka_gripper/gripper_action action service. This is because under the hood, this action uses the franka_ros/franka_gazebo/src/franka_gripper_sim.cpp Lines 435 to 439 in 054af53
This state only transitions to the franka_ros/franka_gazebo/src/franka_gripper_sim.cpp Lines 171 to 191 in 054af53
Due to the badly tuned PID gains these velocities are never under the velocity threshold of
As a result, the controller never transitions to the
Consequently, the third party services like MoveIt, which depend on the I think this is caused by the fact that the InvestigationLet's verify this hypothesis by inspecting the finger velocity commands while moving the arm arround. We can use the pick & place example that is given in the documentation. Below I added a gif of how the velocities behave when I move the arm arround. Keep in mind that the velocity threshold is set to Resting velocities velocity: [-0.0008394972722331565, 0.002920198607601596, -0.0004664629045941222, 0.0018506860899074268, -0.008040965487597593, -0.0017851274417448255, 0.0021114798536561847, -5.6208884257551426e-05, 5.6490498751197266e-05] From this we can see that the finger velocities are indeed a little bit influenced by the movement of the robot arm. I'm unsure if this is because of finger PID gains that can be improved or that this is due to instaiblities inside the gazebo simulation. I however think that this should not cause to much problems as the velocity is only shortly above the threshold. I only becomes a problem when the arm controllers are tuned badly (see gif below). Resting velocities velocity: [-2.3617382151641126, 0.00779549310441726, 2.398145283557499, 0.004950285110020838, -0.5145020878195646, -0.21680003827061464, -0.7459508604510294, 0.031055436989710014, -0.031054684808693785]
velocity: [2.3645298595526008, -0.007416133146815294, -2.4055287574456763, -0.0077949747761998645, 0.5515721516252698, 0.22718758256158672, 0.7415553930080468, -0.030523518801102368, 0.03052436581763448] Position trajectory controller PID gainsFor this controller both the With only controller gains and no gazebo PID gainsWith controller gains and gazebo PID gains |
Wow, many things happening at once here 😲
To answer this first part: You are right, this was one of the reasons we didn't provide positions and velocity interfaces. I totally agree with keeping the simulation as close to the real system as possible. However due to proprietary reasons, unfortunately we are not able to release the internal workings of the FCI. This includes open-sourcing the motion generators. Since as you say user would need to tune gains in both cases, maybe the solution proposed in #156 is the next best solution, still? |
Hi @rickstaa, I had a look at the problem with the alternating high velocities of joint 1. On first glance it seems that your gains are way too high. I tested with the following gains and got rid of the oscillations:
joint_effort_trajectory_example_controller:
type: effort_controllers/JointTrajectoryController
joints:
- $(arg arm_id)_joint1
- $(arg arm_id)_joint2
- $(arg arm_id)_joint3
- $(arg arm_id)_joint4
- $(arg arm_id)_joint5
- $(arg arm_id)_joint6
- $(arg arm_id)_joint7
gains:
$(arg arm_id)_joint1: { p: 600, d: 30, i: 0 }
$(arg arm_id)_joint2: { p: 600, d: 30, i: 0 }
$(arg arm_id)_joint3: { p: 600, d: 30, i: 0 }
$(arg arm_id)_joint4: { p: 600, d: 30, i: 0 }
$(arg arm_id)_joint5: { p: 250, d: 10, i: 0 }
$(arg arm_id)_joint6: { p: 150, d: 10, i: 0 }
$(arg arm_id)_joint7: { p: 50, d: 5, i: 0 }
constraints:
goal_time: 0.5
$(arg arm_id)_joint1: { goal: 0.05 }
$(arg arm_id)_joint2: { goal: 0.05 }
$(arg arm_id)_joint3: { goal: 0.05 }
$(arg arm_id)_joint4: { goal: 0.05 }
$(arg arm_id)_joint5: { goal: 0.05 }
$(arg arm_id)_joint6: { goal: 0.05 }
$(arg arm_id)_joint7: { goal: 0.05 } With this rough tuning the robot is still able to track the joint trajectories okayish in Gazebo. See position error in right plot is around 1.2 degrees peak. Also the jittering in RViz is (almost) gone. One could tune further of course. If this is useful we can think about adding the tuned gains into the sim_controllers.yaml |
@gollth Thanks for your answer! No problem, I think this is closely related to the discussion held in #143. On one side, you have to hide the internal workings of the robot and the controllers from your competitors, but also want to provide the best experience for researchers. Since even a I agree with you that #156 would already be a significant improvement. This gives users the ability also to test position and velocity controllers in the simulation if they need to. In that case, it would be beneficial if you could provide working The main reason why I created this pull request is that the new
Great, thanks a lot! I already found them suspiciously high, but like the For adjusting the |
@gollth I just noticed that the As, a result my comments above are incorrect. To fix the position and velocity control, we need to implement the PID logic inside the franka_gazebo/FrankaHWSim class. |
This commit adds a temporary fix for the problems explained in frankaemika/franka_ros#161. This fixed can be removed when frankaemika/franka_ros#173 is merged.
As we don't have valid PID gains for an effort controller on the real robot, we resort to position control on the real robot. For Gazebo, Franka provided PID gains in frankaemika/franka_ros#161 (comment)
This feature was implemented in 2514ae1. |
I think it would be handy to have the ability to switch the
hardware_interface
that is used in the gazebo simulation for controlling the panda arm. This feature would allow users to test control the robot using different hardware interfaces, similar to the real robot.Currently, the
hardware_interface/JointEffortInterface
is hardcoded into the panda_arm.urdf.xacro file. Because of this, the release of the Noetic panda_moveit_config package, which targets franka_ros v0.8.0, is blocked, as we would like to both use theJointPositionInterface
in the gazebo simulation and on the real robot (see moveit/panda_moveit_config#74 and moveit/panda_moveit_config#68).I also tried switching to the
effort_controllers/JointTrajectoryController
while using the following pid gains:Unfortunately, although these gains seem decent on the simulation robot (i.e. control has a slight offset), they lead to dangerous situations (i.e. very high velocities and acceleration) on the real robot, which causes the software emergency stop to be invoked).
I created #156 and #157 to add this feature.
The text was updated successfully, but these errors were encountered: