0
$\begingroup$

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:

  1. With joint_trajectory_controller with position command interface - Github repo link of how I am doing.
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
  1. With PID controller - Github repo link of how I am doing.
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.

$\endgroup$
2
  • $\begingroup$ Welcome at RSE. I think you have pasted the same image twice? Furthermore: please don't paste text as screenshots, but add them as plaintext and format as code. $\endgroup$ Commented Oct 27 at 17:08
  • $\begingroup$ Thanks for pointing out, I have made the changes as you mentioned. $\endgroup$
    – RoM
    Commented Oct 27 at 19:07

1 Answer 1

0
$\begingroup$
  • joint_trajectory_controller does not use a feedback PID control loop if the command interface is of type position.
  • If you use gazebo_ros2_control with position command interface, then the joint will move instantaneous at the goal position -> you cannot tune PID gains.

Use the same interface as you hardware provides. (effort, as you have in your PID configuration?).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.