No p gain specified for pid. for velocity controller
I'm trying to get the velocity controller to work but I'm keep getting errors. I have a robot that has a single joint to keep the problem minimized, see the picture below. The yaml
file is shown below.
rrbot:
# Publish all joint states ------------------------
joint_state_controller:
type: joint_state_controller/JointStateController
publish_rate: 50
# Velocity Controllers ----------------------------
joint1_velocity_controller:
type: velocity_controllers/JointVelocityController
joint: joint1
pid: {p: 500.0, i: 10.0, d: 5.0}
The part of robot.xacro
that is related to joint is
<!-- Joint Between Base Link and Middle Link -->
<joint name="joint1" type="revolute">
<parent link="base_link"/>
<child link="mid_link"/>
<origin xyz="0 ${width} ${height1-axle_offset}" rpy="0 0 0"/>
<axis xyz="0 1 0"/>
<dynamics damping="${damp}"/>
<limit effort="100.0" velocity="0.5" lower="-3.14" upper="3.14"/>
</joint>
<!-- ros_control pluging -->
<gazebo>
<plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
<robotNamespace>/rrbot</robotNamespace>
<robotSimType>
gazebo_ros_control/DefaultRobotHWSim
</robotSimType>
</plugin>
</gazebo>
<transmission name="transmission1">
<type>transmission_interface/SimpleTransmission</type>
<joint name="joint1">
<hardwareInterface>hardware_interface/VelocityJointInterface</hardwareInterface>
</joint>
<actuator name="motor1">
<hardwareInterface>VelocityJointInterface</hardwareInterface>
<mechanicalReduction>1</mechanicalReduction>
</actuator>
</transmission>
I run the simulation in Gazebo 9 and melodic, I get this error
No p gain specified for pid. Namespace: /rrbot/gazebo_ros_control/pid_gains/joint1
Even with this error, it seems the simulation works fine. Some people also are complaining about this exact problem. Some suggest to add the following lines in .yaml
file
gazebo_ros_control:
pid_gains:
joint1:
p: 500.0
i: 10.0
d: 5.0
The .yaml
look likes this
rrbot:
# Publish all joint states ------------------------
joint_state_controller:
type: joint_state_controller/JointStateController
publish_rate: 50
# Velocity Controllers ----------------------------
joint1_velocity_controller:
type: velocity_controllers/JointVelocityController
joint: joint1
pid: {p: 500.0, i: 10.0, d: 5.0}
gazebo_ros_control:
pid_gains:
joint1:
p: 500.0
i: 10.0
d: 5.0
The error disappears but the simulation is not working properly. The arm doesn't response to any command and it keeps falling down. Notice that using position controller with effort interface, I have no problem. The problem pops up only with velocity controller.