Skip to content
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

Estimate motor and joint velocities through KF #909

Merged
merged 12 commits into from
Dec 2, 2024

Conversation

isorrentino
Copy link
Collaborator

This PR implements two KF to estimate the joint and motor velocities in the JointTorqueControlDevice.

cc @LoreMoretti

Comment on lines 296 to 299
// virtual bool getEncoderSpeed(int j, double* sp);
// virtual bool getEncoderSpeeds(double* spds);
// virtual bool getMotorEncoderSpeed(int m, double* sp);
// virtual bool getMotorEncoderSpeeds(double* spds);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// virtual bool getEncoderSpeed(int j, double* sp);
// virtual bool getEncoderSpeeds(double* spds);
// virtual bool getMotorEncoderSpeed(int m, double* sp);
// virtual bool getMotorEncoderSpeeds(double* spds);

Comment on lines 1630 to 1657
// bool JointTorqueControlDevice::getEncoderSpeeds(double* spds)
// {
// std::lock_guard<std::mutex>(this->globalMutex);
// memcpy(spds, measuredJointVelocities.data(), this->axes * sizeof(double));
// return true;
// }

// bool JointTorqueControlDevice::getEncoderSpeed(int j, double* sp)
// {
// std::lock_guard<std::mutex>(this->globalMutex);
// *sp = measuredJointVelocities[j];
// return true;
// }

// bool JointTorqueControlDevice::getMotorEncoderSpeeds(double* spds)
// {
// std::lock_guard<std::mutex>(this->globalMutex);
// memcpy(spds, measuredMotorVelocities.data(), this->axes * sizeof(double));
// return true;
// }

// bool JointTorqueControlDevice::getMotorEncoderSpeed(int j, double* sp)
// {
// std::lock_guard<std::mutex>(this->globalMutex);
// *sp = measuredMotorVelocities[j];
// return true;
// }

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably this is a leftover

Comment on lines +1685 to +1692
// TO BE CHANGED
// For the time being instead of reading the motor acceleration we are reading the
// estimated friction torques

// controlBoardRemapperMeasures.motorAccelerations.noalias()
// = controlBoardRemapperMeasures.remappedJointPermutationMatrix
// * controlBoardRemapperMeasures.motorAccelerationsUnordered * M_PI / 180;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a leftover?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we are writing the friction torques instead of the motor accelerations. I commented out this to avoid doing twice the conversion * M_PI/ 180.0 which now is not needed. I also added a comment to remember to change this once there will be a different solution to send the friction torques through yarp.

Is it ok like this or do you prefer not to change sensor bridge and apply the inverse conversion where I read the joint friction torques?

@GiulioRomualdi
Copy link
Member

Hi @isorrentino as far a I understood this pr includes also the #908. If you want you can close the other and keep only this open

@isorrentino
Copy link
Collaborator Author

Yes, this contains the other one. We can directly merge this.

@GiulioRomualdi GiulioRomualdi enabled auto-merge (squash) November 24, 2024 16:35
@GiulioRomualdi GiulioRomualdi merged commit ba2a98a into ami-iit:master Dec 2, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants