-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add full PID control, plus small bug fixes #117
Conversation
this->nh_->get_logger(), | ||
"The position_proportional_gain parameter was not defined, defaulting to: " << | ||
default_gain); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved this PID initialization stuff to the bottom of the function so that joint names would be available for the debug prints.
@@ -589,7 +607,7 @@ hardware_interface::return_type IgnitionSystem::write( | |||
{ | |||
this->dataPtr->ecm->CreateComponent( | |||
this->dataPtr->joints_[i].sim_joint, | |||
ignition::gazebo::components::JointVelocityCmd({0})); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't believe it makes sense to initialize this to 0 when we have a command available.
} else if (!vel->Data().empty()) { | ||
vel->Data()[0] = target_vel; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops, I duplicated this block of code. Plus, I think it is safer to use:
const auto jointVelCmd =
this->dataPtr->ecm->Component<ignition::gazebo::components::JointVelocityCmd>(
this->dataPtr->joints_[i].sim_joint);
*jointVelCmd = ignition::gazebo::components::JointVelocityCmd(
{target_vel});
Than...
vel->Data()[0] = target_vel;
I might be wrong, though.
7e94c08
to
57a8a08
Compare
6193718
to
94a6c4a
Compare
@AndyZe I was looking at your changes in We could also create cascade loop when using position interface from IMHO this would be the correct way of doing this. What do you think? |
That sounds like it is worth trying. I also see that (in the example you linked) they use a I don't trust the derivative term from the I see something weird with this PR and I haven't been able to track down the cause. After I make contact with a surface, the arm occasionally springs back rapidly. I don't know if this is coming from the PID controller or from Gazebo contact physics. |
Then I will try to add those, and maybe some kind of wrapper for cascade control. Please don't mind if I hijack some commits from here.
Too bad. I wasn't aware about that issue.
I can't tell without testing :/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I merged the ign to gz
PR, and you have some conflicts, Sorry, it was a huge change
Closing this because I think effort-based control like in #122 would be a lot better 👍 |
Use the control_toolbox PID controller instead of simple proportional control.