Giter Club home page Giter Club logo

Comments (2)

knightshrub avatar knightshrub commented on July 24, 2024 2

Hello Joan,
sorry for the late reply and thank you for the detailed answer!

Looking at it a second time, it should've been immediately clear to me from the 4x3 dimensions of the Jacobian that were mapping from the tangent space directly to the vector representation of a quaternion (the manifold element).

Also, thanks for clarifying my doubts about the right Jacobian, together with the reminder that the Jacobians as defined in [2] always map between tangent spaces (not from tangent space to manifold as above) I see now where my confusion came from.

In fact example A in section V that shows this quite nicely where the Jacobian of the measurement model is given as

$$
\mathbf{H} = \mathbf{J}^{\mathcal{X}^{-1} \cdot \mathbf{b}k}{\mathcal{X}} = \mathbf{J}^{\mathcal{X}^{-1} \cdot \mathbf{b}k}{\mathcal{X}^{-1}} \mathbf{J}^{\mathcal{X}^{-1}}_{\mathcal{X}}
$$

which in plain english would be

"How does a small change $\delta \boldsymbol{\theta}$ in the tangent space of $\mathcal{X}$ affect the tangent space of $\mathcal{X}^{-1} \cdot \mathbf{b}_k$?"

such that a linear approximation for $\mathcal{X}^{-1} \cdot \mathbf{b}_k$ can be written as

$$ \left(\mathcal{X} \oplus \delta \boldsymbol{\theta}\right)^{-1} \cdot \mathbf{b}_k \approx \mathcal{X}^{-1} \cdot \mathbf{b}_k + \mathbf{H} \delta \boldsymbol{\theta} $$

where regular $+$ is used for composition (both manifold and tangent space are $\in \mathbb{R}^3$)

Now the usefulness of manifpy becomes apparent

import numpy as np
from manifpy import SO3, SO3Tangent

X = SO3.Random()
bk = np.array([1,0,0])
dtheta = np.array([0,0,0.05])

J_Xi_act_b_Xi = np.zeros((3,3))
J_Xi_X = np.zeros((3,3))

# use manif's automatic Jacobian feature for individual operation's Jacobians
b_= X.inverse(J_Xi_X).act(bk, J_Xi_act_b_Xi)
# use the chain rule to compute the Jacobian of the chained operations
J_Xi_act_b_X = J_Xi_act_b_Xi @ J_Xi_X

# linear approximation
b_appr = b_ + J_Xi_act_b_X @ dtheta
# full non-linear expression
b_full = X.rplus(SO3Tangent(dtheta)).inverse().act(bk)

delta = b_appr - b_full

# should be small
print(delta)

from manif.

joansola avatar joansola commented on July 24, 2024

Hello. Yes, these two Jacobians are different.

In  [1], equation (1) above, we differentiate the 4-vector of the quaternion wrt the angular error. The result is a 4x3 matrix. This is regular differentiation in vector spaces.

In [2], equation (2) above, we use the differentiation definition given by Lie theory. It relates infinitesimal variations in the tangent space of the free variable (in this case, the angular error, which is itself a regular vector in this case), with infinitesimal variations in the tangent space of the output, in this case the quaternion manifold. These latter variations have 3 DOF, and therefore the resulting Jacobian matrix is 3x3.

But there is another difference:

In (1), the evaluation of the derivative is at q_t = q, therefore considering the angular error zero, d_theta=0.

In (2), the evaluation of the derivative is at q_t = q (+) d_theta = q * Exp(d_theta) with d_theta not necessarily zero. If d_theta = 0, then J_r(d_theta) is the identity matrix.

The fact that both Jacobians share the same notation, by the same author, is probably unfortunate, and it is my fault. However, I am a strong defender of explicit notations that favor the chain rule, and the notations I use are such that this rule is clearly visible. Having said this, I think in [2] I use D q_t / D d_theta and not d q_t / d d_theta precisely to break this ambiguity. Never take notation lightly.

from manif.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.