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

Wrong joint state from Urdf Joint Revolute #40

Closed
HainingLuo opened this issue Feb 3, 2021 · 1 comment · Fixed by #44
Closed

Wrong joint state from Urdf Joint Revolute #40

HainingLuo opened this issue Feb 3, 2021 · 1 comment · Fixed by #44
Assignees

Comments

@HainingLuo
Copy link

HI,

I have been using Unity Robotics Hub for my own robot. With the getPosition() function in for revolute joints, I realised the joint states I got were always close to zero. After checking the code in UrdfJointRevolute.cs, I found the following definition.

    public override float GetPosition()
    {
        #if UNITY_2020_1_OR_NEWER
            return ((ArticulationBody)unityJoint).jointPosition[xAxis] * Mathf.Deg2Rad;
        #else
            return -((HingeJoint)unityJoint).angle * Mathf.Deg2Rad;
        #endif
    }

The states are tranformed from degree to radian. Although I am not sure if this is the case for all versions, as least in version 2020.2.0b9, the position from (ArticulationBody)unityJoint).jointPosition[xAxis] is already in radian, so they are transformed twice and therefore always close to zero.

It would be greatly appreciated if any members can verify if this is indeed a bug! Thanks in advance.

@at669
Copy link
Contributor

at669 commented Feb 3, 2021

Hi @HenningLuo, thanks for catching this bug! We'll put in a fix for this issue.

@at669 at669 self-assigned this Feb 4, 2021
@vidurvij-Unity vidurvij-Unity linked a pull request Feb 4, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants