I have to implement a PID based controller to control my manipulator. It's a custom built manipulator and so we plan to test it on link levels first - i.e simulating for one link and getting the right PID gains and then replicating on hardware, then other links on top, after that.
Basically, I want to input a joint angle, and use PID control to ensure the right position(angle) is achieved. Doing this for a single joint only for now.
I am pretty new to ROS framework, and hence I don't have much idea about how to get things going. All the resources I have seen about controlling manipulators using ros2_control and ros2_controllers, use joint_trajectory_controller with position as command interface [a], [b]. This doesn't allow for PID gains to be used, as described here. Would I need to use velocity and effort command interfaces to achieve that? It again is not very clear to me, as to how to use these interfaces with the position inputs in my src file. My implementation with position command interfaces, work fine.
I also tried using the PID controller, but somehow my manipulator doesn't stay upright when I launch gazebo - PID gains have no effect.
My implementations:
controller_manager:
ros__parameters:
update_rate: 100 # Hz
joint_trajectory_controller:
type: joint_trajectory_controller/JointTrajectoryController
joint_state_broadcaster:
type: joint_state_broadcaster/JointStateBroadcaster
joint_trajectory_controller:
ros__parameters:
joints:
- joint_1
- joint_2
interface_name: position
command_interfaces:
- position
state_interfaces:
- position
- velocity
controller_manager:
ros__parameters:
update_rate: 1000
joint_state_broadcaster:
type: joint_state_broadcaster/JointStateBroadcaster
joint_pid_controller:
type: pid_controller/PidController
joint_pid_controller:
ros__parameters:
dof_names:
- joint_1
- joint_2
command_interface: effort
reference_and_state_interfaces: ["position"]
gains:
joint_1: {p: 0.05, i: 0.1, d: 0.05}
joint_2: {p: 100.0, i: 0.5, d: 0.0}
I am really sorry for such vague wording and a lack of basic understanding about this stuff. I am fairly new. Any tips / links to relevant resources is highly appreciated.