-
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 PID and SemanticVersion. #229
Conversation
Signed-off-by: LolaSegura <[email protected]>
Codecov Report
@@ Coverage Diff @@
## ign-math6 #229 +/- ##
==========================================
Coverage 99.21% 99.21%
==========================================
Files 65 65
Lines 6089 6089
==========================================
Hits 6041 6041
Misses 48 48 Continue to review full report at Codecov.
|
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.
LGTM, just some nits
I've removed the draft label. @LolaSegura Let me know if there is something that is missing |
Signed-off-by: LolaSegura <[email protected]>
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.
LGTM
@scpeters @chapulina It is ready for a review!
Signed-off-by: Louise Poubel <[email protected]>
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.
LGTM!
The Update(const double _error, const std::chrono::duration &_dt) method received a variable of type std::chrono::duration. To give support to this method in python a new update function was defined using the %extend command. This new update method receives a variable of type double double Update(const double error, double dt).
I think this is ok for now, but maybe in the future we should look into using python time to be more expressive?
Agree. I think that we should provide a conversion from std::chrono to python time. Sadly, swig doesn't provide bindings as it does for |
Signed-off-by: LolaSegura [email protected]
🎉 New feature
Related to #101 #210
Summary
Adds Python interface for two math classes: PID, SemanticVersion. For each class a python test has been created.
Related issues and notes
PID
operator=
is not supported, there was no way to copy two variables of type PID.Update(const double _error, const std::chrono::duration<double> &_dt)
method received a variable of typestd::chrono::duration
. To give support to this method in python a new update function was defined using the%extend
command. This new update method receives a variable of type doubledouble Update(const double error, double dt)
.void Errors(double &_pe, double &_ie, double &_de) const;
method changed the values of the arguments inside it. For native types swig has a way to handle this using the%apply <type> *OUTPUT {}
directive. So in python this method can be used as[pe, ie, de] = pid.errors()
%rename
command is failing on adding and under case when the variable name is conformed by one letter and a world, for example,PGain()
was being renamed aspgain()
instead ofp_gain()
. So this cases where contemplated using an specific%rename
tag.SemanticVersion
std_string.i
module was added in order to work withstd::string
.Checklist
codecheck
passed (See contributing)