laas / metapod

A template-based robot dynamics library
GNU Lesser General Public License v3.0
14 stars 10 forks source link

fix bcalc recursion #4

Closed sbarthelemy closed 11 years ago

sbarthelemy commented 12 years ago

bcalc is currently not used in the project, but is useful when one needs to get the position of the body frames in the world frame.

However, the implementation was flawed: all bodies were treated like the root of the tree. This patch fixes that problem.

An automated test should follow

olivier-stasse commented 12 years ago

Hi Sebastien, I am not sure that this one is needed, by default (l.33 of bcalc.hh) the hasParent field is set to false.

Therefore they should not be treated like the root of the tree. Do you have a sample examplify the problem ?

sbarthelemy commented 12 years ago

It is my understanding that, normally, only the root node has no parent. so this default value is indeed the problem.

I have an example too, could you check https://github.com/laas/metapod/pull/5 first? It will be easier to merge.

olivier-stasse commented 12 years ago

Right, Sorry ... stupid mistake. Indeed I am wondering if the default value is not the source of the problem.

I am also checking pull/5 and trying to understand what you are trying to do. The overall idea sounds nice, just checking the details...

olivier-stasse commented 12 years ago

Hi Sebastien, I think I got it. The flag hasParent has not a proper name.

In fact, if you look at HoR Table 2.6 (p.52), you can see that the position of the body is only needed when your forces are expressed in the world coordinate frames. If they are given in the body frame, which is often the case with the sensor attached to the body, you can save some operations by avoiding the geometric update.

But indeed if you need the geometrical position of your bodies in the world coordinate frame, this flag should be set to true. So I do not think it is a hasParent flag, but rather a geometricComputation flag.

sbarthelemy commented 12 years ago

On Fri, Aug 3, 2012 at 3:34 PM, Olivier Stasse < reply@reply.github.com

wrote:

Hi Sebastien, I think I got it. The flag hasParent has not a proper name.

In fact, if you look at HoR Table 2.6 (p.52), you can see that the position of the body is only needed

What is HoR?

when your forces are expressed in the world coordinate frames. If they are given in the body frame, which is often the case with the sensor attached to the body, you can save some operations.

But indeed if you need the geometrical position of your bodies in the world coordinate frame, this flag should be to true.

So I do not think it is a hasParent flag, but rather a geometricComputation flag.

I'm not sure. Check

https://github.com/laas/metapod/blob/master/include/metapod/tools/bcalc.hh#L53

and

https://github.com/laas/metapod/blob/master/include/metapod/tools/bcalc.hh#L68

for a non root joint, you get iX0 = sXp * (i-1)X0 for the root joint, iX0 = sXp. It does make sense.

sbarthelemy commented 12 years ago

There is a bclac test in the following pull request https://github.com/laas/metapod/pull/6 You can use it to experiment.