-
Notifications
You must be signed in to change notification settings - Fork 404
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
doc - Update nullspace projection formula. #2366
doc - Update nullspace projection formula. #2366
Conversation
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,
This is a reminder message to please assign a proper label to this Pull Request.
The possible labels are:
- build_collision (build pinocchio with coal support)
- build_casadi (build pinoochio with casadi support)
- build_autodiff (build pinocchio with cppad support)
- build_codegen (build pinocchio with cppadcg support)
- build_extra (build pinocchio with extra algorithms)
- build_mpfr (build pinocchio with Boost.Multiprecision support)
- build_sdf (build pinocchio with sdf parser)
- build_accelerate
- build_all (build pinocchio with all the options stated above)
Thanks.
Thank you for raising this point. Can you detail the math you've done and what problem you see with this formula? Here is one way it checks out: we want |
I did the same calculations. It seems to me that you are replacing |
e989b6b
to
9ddb70e
Compare
Ah yes OK, that's right 👍 Thank you for this correction 😃 |
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.
This is correct 👌
9ddb70e
to
4bf3fca
Compare
Thanks a lot, @abussy-aldebaran, for this documentation fix. Very helpful. |
@abussy-aldebaran Your calculation is indeed correct, however, the formula given by @stephane-caron is simpler and also correct because we have the property Indeed, However, I have no idea of why using |
Thanks @ymontmarin for double-checking 👍 I followed your reasoning and I agree with each step. (The Moore-Penrose property is listed e.g. in Proposition 6.1.6 of Matrix mathematics: theory, facts, and formulas.) Here is a sample script to test this numerically: import numpy as np
def sample(nv: int, nj: int):
J1 = np.random.random((nj, nv))
J2 = np.random.random((nj, nv))
P1 = np.eye(nv) - np.linalg.pinv(J1) @ J1
pinv_J2P1 = np.linalg.pinv(J2 @ P1)
norm_pinv = np.linalg.norm(pinv_J2P1)
norm_P1_pinv = np.linalg.norm(P1 @ pinv_J2P1)
residual = np.linalg.norm((np.eye(nv) - P1) @ pinv_J2P1, ord=1)
print(f"| {norm_pinv:.3} | {norm_P1_pinv:.3} | {residual:.2} |") If we run it with the for _ in range(10):
sample(10, 5)
But if we run it with for _ in range(10):
sample(9, 5)
I guess then for the introductory material in Pinocchio's documentation the formula with the extra projection is better? (Less steps to get there, reprojection has some practical benefits.) |
@abussy-aldebaran, after some discussions, indeed This stabilization come at the cost of an additional matrix multiplication. Another solution is tuning the Numpy variables Note that, you could still have some explosion coming from the null singular values of |
@ymontmarin Thanks for the precisions. First I'd like to apologize. I didn't do enough testing, and it was luck that it worked better with the reuse of As you pointed out, the explosions probably come from the low threshold on singular values. I increased the absolute tolerance to About Finally, the simplification of I can do a PR. |
@antoine-bussy Thank you for your proposition. Yes it could be a good idea to have a PR with the precisions:
Could you give me an example of a general task where it does not apply ? Finally, the property Mathematically Indeed, |
I submitted a PR #2415. @ymontmarin Thanks for the explanations. I was thinking about a joint-space task, such as joint-space impedance control. |
I think there's a missing
P_1
in the null-space projection formula in the "Inverse Kinematics" tutorial.I did the math and it checks out. And the simulation works better.