cmm-21 / a2

Assignment 2 - Kinematic walking controller
5 stars 0 forks source link

[Announcement] Please do not overwrite eigen matrix variable but rather declare another matrix variable. #33

Open eastskykang opened 3 years ago

eastskykang commented 3 years ago

Please try not overwriting eigen matrix but rather declare another matrix variable.

For instance, when you compute Jacobian, I noticed a lot of students wrote somewhat like

J = J.block(0,6,3,q.size() - 6);

to get rid of first 6 columns. But in some systems or compilers, this line can cause the problem. Rather do as follows

Matrix J2 = J.block(0,6,3,q.size() - 6);
// and use J2 for inverse kinematics
MiguelZamoraM commented 3 years ago

Another potential solution would be:

J = J.block(0,6,3,q.size() - 6).eval();

And a good read about the problem: https://eigen.tuxfamily.org/dox/group__TopicAliasing.html