-
Notifications
You must be signed in to change notification settings - Fork 38
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
Bugfix in YarpRobotControl::Impl::setReferences #271
Conversation
scaling * (jointError / this->positioningDuration)); | ||
this->positionControlRefSpeeds[i] | ||
= std::max(maxVelocityInDegPerSeconds, | ||
scaling * (jointError / this->positioningDuration)); |
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 am not sure of this logic, but this is not part of what is changed by the PR.
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.
Actually, maxVelocityInDegPerSeconds
is misleading, as it is instead the minimum velocity. Each joint is supposed to reach the desired position in the time specified by positioningDuration
. If the joint is already close to the desired configuration, we don't want the joint to go too slow, so we set the desired velocity to maxVelocityInDegPerSeconds
, that should be called minVelocityInDegPerSeconds
.
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.
Thank you @S-Dafarra I reneame maxVelocityInDegPerSeconds
into minVelocityInDegPerSeconds
@@ -304,7 +309,7 @@ struct YarpRobotControl::Impl | |||
this->controlModes.resize(this->actuatedDOFs); | |||
this->controlModesYarp.resize(this->actuatedDOFs); | |||
this->axesName.resize(this->actuatedDOFs); | |||
|
|||
this->positionControlRefSpeeds.resize(this->actuatedDOFs); |
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 am just checking the modification, so I might be missing something, but it seems that you are resizing this vector in two different places, in two different ways. Above I see:
this->positionControlRefSpeeds.resize(
this->desiredJointValuesAndMode.index[IRobotControl::ControlMode::Position].size());
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.
Hi @S-Dafarra, both the resize are required.
Indeed when setDriver()
is called the motor control mode for each joint is retrieved.
Suppose that all the joints are in position when you call
You will have a segfault if this resize is missing:
On the other hand
is required when you ask for a different control mode. (Now the number of joints in position mode may be different)
By the way, I think it is more clear to change the resize as
this->positionControlRefSpeeds.resize(this->actuatedDOFs); | |
this->positionControlRefSpeeds.resize(this->desiredJointValuesAndMode.index[IRobotControl::ControlMode::Position].size()); |
and call it after this line.
scaling * (jointError / this->positioningDuration)); | ||
this->positionControlRefSpeeds[i] | ||
= std::max(maxVelocityInDegPerSeconds, | ||
scaling * (jointError / this->positioningDuration)); |
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.
Actually, maxVelocityInDegPerSeconds
is misleading, as it is instead the minimum velocity. Each joint is supposed to reach the desired position in the time specified by positioningDuration
. If the joint is already close to the desired configuration, we don't want the joint to go too slow, so we set the desired velocity to maxVelocityInDegPerSeconds
, that should be called minVelocityInDegPerSeconds
.
…he joints in position control.
This fixes #270