-
Notifications
You must be signed in to change notification settings - Fork 67
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
Adds python interface to Quaternion, Pose3, Matrix3 and Matrix4 #221
Conversation
Codecov Report
@@ Coverage Diff @@
## ign-math6 #221 +/- ##
==========================================
Coverage 99.40% 99.40%
==========================================
Files 66 66
Lines 6185 6185
==========================================
Hits 6148 6148
Misses 37 37
Continue to review full report at Codecov.
|
6f5bb13
to
ad00569
Compare
Signed-off-by: LolaSegura <[email protected]>
Signed-off-by: LolaSegura <[email protected]>
Signed-off-by: LolaSegura <[email protected]>
Signed-off-by: LolaSegura <[email protected]>
Signed-off-by: LolaSegura <[email protected]>
Signed-off-by: LolaSegura <[email protected]>
…tyle. Signed-off-by: LolaSegura <[email protected]>
…hon test to the python folder. Signed-off-by: LolaSegura <[email protected]>
ad00569
to
88dc6f6
Compare
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.
Good job! Just a few comments.
Signed-off-by: LolaSegura <[email protected]>
Signed-off-by: LolaSegura <[email protected]>
Signed-off-by: LolaSegura <[email protected]>
Signed-off-by: Franco Cipollone <[email protected]>
I've pushed a workaround at f394e9c for adding coverage to |
Signed-off-by: Franco Cipollone <[email protected]>
I've just fixed conflicts. |
I'm almost done reviewing this; looks good so far, and you've found bugs in our c++ code! Great work |
This changes the test matrices that are multiplied togther so that they aren't scalar multiples of each other. This confirms non-commutativity in the test. Signed-off-by: Steve Peters <[email protected]>
I noticed a problem in our |
Signed-off-by: Steve Peters <[email protected]>
I added a stream out test to Matrix3_TEST.py in bb6b120 |
there's one final thing that I've noticed and will file in an issue: the python tests are missing some statement in which scalars are left multiplied to Vector and Matrix types ( |
|
Signed-off-by: Steve Peters <[email protected]>
Nice catch. Thanks for filling the issue. |
* Adds scripting interface to Quaternion and a python test * Adds scripting interface to Matrix3 and a python test * Adds scripting interface to Pose3 and a python test * Solves bug in the Reset() method inside Pose3 * Adds scripting interface to Matrix4 and a python test * Solves bug in the Construct test for Matrix4 class * Adds %rename tag to interface files in order to match pep-8 naiming style. * Adds a python method to convert from a Matrix3 to a Quaternion. * Adds to_quaternion() method to Matrix3. Signed-off-by: LolaSegura <[email protected]> * Adds python binding for Quaternion::ToAxis method. Signed-off-by: Franco Cipollone <[email protected]> * Matrix3_TEST: improve multiplication test This changes the test matrices that are multiplied togther so that they aren't scalar multiples of each other. This confirms non-commutativity in the test. * Matrix3_TEST.py: add stream out test Signed-off-by: Steve Peters <[email protected]> Co-authored-by: Franco Cipollone <[email protected]> Co-authored-by: Franco Cipollone <[email protected]> Co-authored-by: Steve Peters <[email protected]> Signed-off-by: Arjo Chakravarty <[email protected]>
🎉 New feature
Goes on top of #216
Related to #101 #210
Summary
Adds Python interface for three math classes: Quaternion, Pose3, Matrix3, Matrix4. For each class a python test has been created.
Related issues and notes
Quaternion
operator<<
had to be made. This adds a__str()__
method that callsoperator<<
inside.W()
,X()
,Y()
andZ()
was re-defined using%extend()
.void ToAxis(Vector3<T> &_axis, T &_angle) const;
is currently not being supported because both parameters (_axis
and_angle
) are being modify inside it and there is not a straight forward implementation for these cases when using swig.%extend
command and called theQuaternion(Matrix3<t> _mat);
constructor inside it.Quaternion.i
file, like is being done at the momentMatrix3.i
file, and add an extension of the matrix method that is being called in the constructor from the Quaternion class:This last approach would imply that for using Quaternion in python the class Matrix3 has to be bind.
Pose3
Reset()
method resets the value of the quaternion as:this->q = Quaternion<double> ::Identity
I change this tothis->q = Quaternion<T> ::Identity
because the implementation would only work when the template was of type double. 'operator<<
had to be made. This adds a__str()__
method that callsoperator<<
inside.Matrix3
operator<<
had to be made. This adds a__str()__
method that callsoperator<<
inside.operator()
method functionality in python, the class had to be extended in the interface file.Matrix4
Matrix4_TEST.cc
on the constructor test bothfor
loops where testingEXPECT_DOUBLE_EQ(mat2(i, **i**), 0.0);
, so only the elements on the diagonal were tested. I changed toEXPECT_DOUBLE_EQ(mat2(i, **j**), 0.0);
operator<<
had to be made. This adds a__str()__
method that callsoperator<<
inside.operator()
method functionality in python, the class had to be extended in the interface file.Checklist
codecheck
passed (See contributing)