stack-of-tasks / pinocchio

A fast and flexible implementation of Rigid Body Dynamics algorithms and their analytical derivatives
http://stack-of-tasks.github.io/pinocchio/
BSD 2-Clause "Simplified" License
1.89k stars 392 forks source link

Jacobian for q1 \ominus q0 #1600

Closed stevenjj closed 2 years ago

stevenjj commented 2 years ago

Hi, Perhaps this is straightforward, but I'm unable to figure this out. I have two configuration vectors, q0 and q1. I know that I can find the tangent vector that brings q0 to q1 using the difference function, namely:

difference(q0, q1) = v, such that q1 = integrate(q0, v)

However, what I'm trying to achieve is a Jacobian for the difference function so that v = J*(q1-q0) where J is fixed about q0 and varies with q1 and that J should be size (model.nv x model.nq). Can this be constructed with any of the existing functions? I thought that dIntegrate is something that I could use, but it outputs a matrix of size (model.nv x model.nv) and requires \Delta q to be in tangent space already. The reason this is tricky is that model.nq > model.nv due do the presence of spherical joints represented as quaternions.

I do plan on moving on towards working with tangent spaces, but I'm just wondering if this exists in some capacity before I move on. Thank you!

proyan commented 2 years ago

Hi Steven

There is also a dDifference that seems to be what you are looking for

Best

On February 1, 2022 6:41:27 AM GMT+05:30, Steven Jens Jorgensen @.***> wrote:

Hi, Perhaps this is straightforward, but I'm unable to figure this out. I have two configuration vectors, q0 and q1. I know that I can find the tangent vector that brings q0 to q1 using the difference function, namely:

difference(q0, q1) = v, such that q1 = integrate(q0, v)

However, what I'm trying to achieve is a Jacobian for the difference function so that v = J*(q1-q0) where J is fixed about q0 and varies with q1 and that J should be size (model.nv x model.nq). Can this be constructed with any of the existing functions? I thought that dIntegrate is something that I could use, but it outputs a matrix of size (model.nv x model.nv) and requires \Delta q to be in tangent space already. The reason this is tricky is that model.nq > model.nv due do the presence of spherical joints represented as quaternions.

I do plan on moving on towards working with tangent spaces, but I'm just wondering if this exists in some capacity before I move on. Thank you!

-- Reply to this email directly or view it on GitHub: https://github.com/stack-of-tasks/pinocchio/issues/1600 You are receiving this because you are subscribed to this thread.

Message ID: @.***>

jmirabel commented 2 years ago

You seem confused about some facts.

stevenjj commented 2 years ago

Thanks for getting back to me @proyan @jmirabel! @proyan I thought so too, but dDifference also operates in tangent spaces only for Delta q.

@jmirabel I don't think I I follow. Let's take the case of a single spherical joint which would be represented as a quaternion. Here q is size 4, and v would be size 3. What I'm trying to achieve is a linear approximation of v = q1 \ominus q0 w.r.t. q0. So J in v = J*(q1-q0) needs to be 3x4. I'm not performing tangent space difference, I'm simply doing a subtraction operation. Perhaps my approach silly and I may just reformulate the rest of my work to be in tangent space.

jmirabel commented 2 years ago

I understand what you want. This isn't implemented in Pinocchio. If you want to stick to the coeff wise formulation, I advise you to write a proper limited development. dv = J1 dq1 + J2 dq2 where dq are understood coeff wise.

Now, if you go down this road, you are on your own. Pinocchio will not be of much help.

stevenjj commented 2 years ago

OK. Thank you very much for the clarification. I just wanted to make sure that the function didn't exist.

nmansard commented 2 years ago

In case it might be useful, there was a class about this question, material and video available here:

https://memory-of-motion.github.io/summer-school/materials

On 01/02/2022 19:09, Steven Jens Jorgensen wrote:

Closed #1600 https://github.com/stack-of-tasks/pinocchio/issues/1600.

— Reply to this email directly, view it on GitHub https://github.com/stack-of-tasks/pinocchio/issues/1600#event-5990275326, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADP4CF3Y5UTTNVVXZQEMMTUZAOXLANCNFSM5NH2M5SQ. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>