Mobile arm simulation behaves strangely when adding ros_control plugin for arm
Greetings. My model combining a simple mobile base with the UR10 acts strangely when I add
<plugin name="ros_control" filename="libgazebo_ros_control.so"/>
which is needed for controlling the UR10 joints. The strange behavior is that the mobile robot resists motion (or maybe it's just the mobile base that does this). Two examples:
(1) If I publish a large velocity twist to the cmd_vel topic for the differential_drive_controller on the mobile base the two wheels spin quickly but the robot rotates only very slowly.
(2) If I publish a positive z-position to set_model_state, effectively dropping the robot from this height, it falls very slowly to the ground.
The "real time factor" is 1.00 so it's not as if the simulation is running slowly when the plugin is added. When I don't add the plugin the robot arm is floppy but it moves quickly, as one would expect (the base moves it around at the desired rate and it falls as fast as normal). The differential_drive_controller seems to be working fine and so does the arm_controller it's just that when I'm using the arm_controller the sim acts crazy. If I remove the diff-drive controller but keep arm_controller the weird behavior remains.
I will look through the husky simulator with UR5 enabled to try to find what is wrong with my robot.
When publishing an arm pose to arm_controller/command the manipulator moves at a reasonable speed relative to its base but the overall mobile robot is still very slow. For example, if I drop it from two meters and publish a manipulator pose the arm moves fine but the entire robot falls very slowly.
For reference, here is the source (except for ur10.urdf.xacro). The offending gazebo plugin tag is found in models/common.gazebo.xacro.
One other note: this question is also posted to answers.gazebosim.org . Is it frowned-upon behavior to post at both these sites?
*edit: First off, thanks for the information in the accepted answer. My inital attempt to resolve this was to replace PositionJointInterface in ur.transmission.xacro with VelocityJointInterface. This required changing
type: position_controllers/JointTrajectoryController
in arm_controller_ur10.yaml to
type: velocity_controllers/JointTrajectoryController
however, when I launch my simulation the following appears.
[ERROR] [1520431422.716199942, 0.480000000]: No p gain specified for pid. Namespace: /arm_controller/gains/shoulder_pan_joint
Since I don't know how to specify gains for that controller, I tried another option you describe. For my second attempt, I reverted to the original configuration (PositionJointInterface with position_cotrollers) and added this line to my launch file.
<rosparam file="$(find mobile_arm)/models/my_ur10/pid_for_gazebo_ros_control.yaml" command="load"/>
where pid_for_gazebo_ros_control.yaml contains just the following.
gazebo_ros_control:
pid_gains:
shoulder_pan_joint: {p: 100.0, i: 0.01, d: 10.0}
shoulder_lift_joint: {p: 100.0, i: 0.01, d: 10.0}
elbow_joint: {p: 100.0, i: 0.01, d: 10.0}
wrist_1_joint: {p: 100.0, i: 0.01, d: 10.0}
wrist_2_joint: {p: 100.0, i: 0.01, d: 10.0}
wrist_3_joint: {p: 100.0, i ...
Re edit1: You can see how to specify gains for the velocity controller here: https://github.com/ThomasTimm/ur_mode... . Note however that these values are for the real UR5. For my Gazebo UR5, I use {p: 100.0, i: 0.0, d: 0.1} .
The UR10 is heavier, so you probably have to increase the p value.
Re edit4: I don't think that's how it works. Gazebo9 added the option of specifying that flag in a function call, but the source code of the ros_control gazebo plugin has to be changed to actually call that function with the flag. Until then, installing gazebo9 solves nothing.
@raequin are you saying that the problem is not solved? You have accepted an answer already so if this is a new problem (even if related) please create a new question and reference this one.
@jayess excuse me if I have muddied the waters. The accepted answer pinpoints the cause of the problem and offers a couple of solutions. The latest edit I made to this question gives details of how, starting with the accepted answer, the problem was resolved in my case.
No problem, but the body of a question isn't the appropriate place for a solution to a problem (i.e., an answer). Can you please put your solution as an answer instead?
I've updated my answer, no need to add another answer.
Great! Thank you both.