-
Notifications
You must be signed in to change notification settings - Fork 4
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
ControlBoard: fix torque feedback #81
Comments
Gazebo-yarp-plugin issues:
Gazebo classic issues: |
Definition of JointTransmittedWrench from gz-sim: https://github.com/gazebosim/gz-sim/blob/633ce72171e27e83bf2e0292c9998e036d5da3fc/include/gz/sim/components/JointTransmittedWrench.hh#L36-L48 Joint Transmitted wrench in SI units (Nm for torque, N for force).
|
Definition of |
Inside the
From here I have to understand how the joint frame is defined in URDF an SDFs. |
At least in URDF, joint_frame == child_frame, see the image in http://wiki.ros.org/urdf/XML/joint . |
In SDF, it is not true in general that joint_frame == child_frame . I think you can find useful pointers in http://sdformat.org/tutorials?tut=pose_frame_semantics&cat=specification&#pose-frame-semantics-tutorial, https://vimeo.com/378683328 and https://roscon.ros.org/2019/talks/roscon2019_poseframespecificationforsdformat1_7.pdf . |
Thank you, this documentation was super useful to understand the different ways in which the frames can be specified! BTW I think it's interesting also for @Gio-DS |
If I have understood well the problem of getting the scalar joint torque value for a joint can be solved easily by just projecting the 6D wrench returned by with Now, since as we said in the previous comments, in the SDF specification there are multiple way to define the joint axis, we must always resort to have the axis represented in the parent link frame. I think this can be done using the SDF API Is it correct, @traversaro ? |
In order to test the correctness of the implementation, I would like to setup some unit tests, using the single pendulum as discussed in the lab, maybe something similar to what the developers of gz-sim had done here: https://github.com/gazebosim/gz-physics/pull/283/files#diff-d47feea35356bed8ccbd38262debeedb3d69aa7c1476744096daabc850340fb8R1160-R1209 In my case, should I assert that the torque computed as in #81 (comment) is equal to the one I could compute analytically from the single pendulum model? |
It make sense! The only way to be sure is to have tests, but for now we can proceed with what you wrote that seems to make sense. |
Exactly, this is a good example of a check. |
I summarize here the test I want to perform to validate the joint torque computation. The idea is to compare the joint torque obtained with my computations and the one coming from ther analytical equations of motion of the pendulum given an arbitrary motor torque The equations of motions are: with L the length of the link. |
Right now I'm dealing with two issues:
gzJoint.Axis(ecm).value().at(0).ResolveXyz(axis, gzJoint.ParentLinkName(ecm).value()) When running this I get the error
|
We can also think to obtain this information by numerical differentation if necessary. |
@traversaro I've a doubt regarding on how to setup a device driver for a unit test. By looking at the forcetorque test: gz-sim-yarp-plugins/tests/forcetorque/ForceTorqueTest.cc Lines 21 to 24 in b9c56cb
ForceTorqueDriver open() these options are not used. In the end, what options should I configure for my controlboard tests?
|
@traversaro I'm facing an unexpected behavior when comparing the joint torques with the unit test I've written (see 9886fbb). The setup of the test is the following:
A visualization of the test in the following: 2024-02-19_13-50-51.mp4What I get is that the joint torque I obtain by projecting the wrench is always equal to the torque I've set as reference, i.e. 0.5 Nm, while the expected joint torque from the eq. of motion starts close to 0.5 and then it decreases becoming also negative. I'm trying to understand what's missing: one of the terms could be the joint friction, but I though it would be automatically subtracted to the torque I've set at input, while it seems not the case. |
Related to the friction I've seen in SDF specification that the static and viscous friction of the joint can be explicitly defined with the tags |
After investigating with @traversaro, we found an error in the expected torque equation (#81 (comment)) in the sign of the term related to the gravity torque. Now with commit 0bac02e the test is passing and is producing coherent results. We also added a fixed joint to the sdf model in order to maintain fixed the pendulum base: see 9ef9126 |
Now that the unit test is working as expected I've tried to run it with a new SDF file defining the same pendulum model but using different frame conventions. In particular, my goal was to define the joint frame relative to an arbitrary frame different from the parent link frame used in the current SDF model, which represents the case adherent to theory, in which the joint frame and child frame coincide and are defined with respect to the predecessor link. The SDF pendulum_joint_relative_to_parent_link.sdf, defined in 1298c81, has a joint framed defined with respect an arbitrary frame with a custom orientation: gz-sim-yarp-plugins/tests/controlboard/pendulum_joint_relative_to_child_link.sdf Lines 116 to 123 in 1298c81
Also in this case the code to return the joint torque is working as expected, without modifications. In this case the joint axis is defined as @traversaro I think this validates the method for returning the joint torque even when the joint axis is defined in a different frame than the parent link, let me know if you have in mind other test cases to add for this topic. |
Perfect! I think we can proceed! |
The last thing I wanted to do in this issue is to refactor the unit test to make use of a parameterized test (see http://google.github.io/googletest/advanced.html#how-to-write-value-parameterized-tests). In 717929c I refactored my unit test to make use of this kind of parametrized test in order to use the same code for different input models. The tests are being correctly recognized but the second one is failing (this does not happen when it runs alone). @traversaro have you any experience with this? |
What is the failure message? |
I get sometimes a SEGFAULT and sometimes a |
It is useful to report the returned backtrace in the context of the segfault. If just running the second test works fine, and the problem just occurs if running both tests one after the other, probably you are right that this may be related to the missing closing of the drivers or anyhow some problems of that kind. |
Unfortunately I wasn'able to get a stack trace for such exception apart from the messages I wrote in the comment above, even with the |
We want to handle torques correctly in the control board plugin, by this we mean:
i.e. Gazebo returns the joint torque
CC @traversaro
The text was updated successfully, but these errors were encountered: