gz_ros2_control icon indicating copy to clipboard operation
gz_ros2_control copied to clipboard

PID effort control of joints (+mimic)

Open livanov93 opened this issue 2 years ago • 6 comments

Depends on #121

Description

PR introduces mapping all types of command interfaces (position, velocity, effort) to ForceJointCmd component.:

  1. For regular joints it does that in the following manner:
  • introduces pid controllers for position and velocity
  • creates parameter node for each hardware interface so the PID values can be tuned in runtime
    • https://github.com/livanov93/ign_ros2_control/blob/pid-with-force-output/ign_ros2_control/src/ign_ros2_control_parameters.yaml
    • https://github.com/livanov93/ign_ros2_control/blob/e8ac35e2cb2ffc223d33dfed23334908ca291a34/ign_ros2_control/src/ign_system.cpp#L784-L785
  • enables cascade control using https://github.com/livanov93/ign_ros2_control/blob/e8ac35e2cb2ffc223d33dfed23334908ca291a34/ign_ros2_control/src/ign_ros2_control_parameters.yaml#L10-L16
  1. For mimic joints it does that in the following manner:
  • Using the MimicJointSystem that can be found here which is pure ignition/gz system that is disconnected from ROS ecosystem.

    • it has PID controller which is trying to satisfy desired mimic behavior defined by multiplier and offset. It maps position error to force output which is applied to the joint.
    • PID parameters can't be changed in runtime, they must be specified within sdf tags
  • Using the same approach as for regular joints within ign_ros2_control::IgnitionSystemInterface here

    • cascade control is also an option for mimic joints

livanov93 avatar Feb 22 '23 16:02 livanov93

Can you rename the PR, "PID effort control of a mimic joint" or something like that?

AndyZe avatar Mar 20 '23 21:03 AndyZe

@AndyZe @kylc Please take a look into changes I implemented and comments I had on your questions/suggestions. Thanks!

livanov93 avatar Mar 24 '23 14:03 livanov93

@livanov93 it would help reviewers a lot in the future if you put a nice, long description in the PR. Especially on a 1,000+ line PR like this. Why did you make the design decisions you have made? Why did you choose to have 2 modes, ABS and PID? Then your reviewers won't have to ask ;)

AndyZe avatar Mar 24 '23 15:03 AndyZe

@livanov93 it would help reviewers a lot in the future if you put a nice, long description in the PR. Especially on a 1,000+ line PR like this. Why did you make the design decisions you have made? Why did you choose to have 2 modes, ABS and PID? Then your reviewers won't have to ask ;)

I was writing it at the moment you wrote this. See here.

livanov93 avatar Mar 24 '23 15:03 livanov93

I've been hearing good things from testing. For example, this can actually handle contact with the environment. That's a big win 👍

@AndyZe @livanov93 This seems like a great change.

I'm curious what you're seeing re: joint position accuracy. Sounds from some other issues (#113, for example) there are/were kinematic accuracy issues and sag with the prior position controllers anyway.

I'd imagine the cascaded controller coming in here could be better at achieving low joint position error than the effort_controllers/JointTrajectoryController was for ROS 1 UR simulation in Gazebo Classic. I observed pretty large errors there, while the regular position controller (which I think just drives ODE joint motors) was dead on, but of course couldn't touch anything rigid:

https://github.com/ros-industrial/universal_robot/issues/521#issuecomment-863583091

It'll be really nice to have a simulated robot that can make contact with a rigid environment. I was getting back to working on some ideas about elastic mounting, etc. in Gazebo Classic but maybe I should shift focus and try this out in new Gazebo first.

danzimmerman avatar Mar 28 '23 04:03 danzimmerman

@ahcorde friendly ping for a review.

livanov93 avatar Apr 03 '23 09:04 livanov93