-
Notifications
You must be signed in to change notification settings - Fork 252
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
Non-const getter for coeffs() #132
Comments
Dear @markusgft, Indeed Lie group objects do not expose a public non-const The rational is quite simple, we try to prevent the user from assigning values that do not respect the group constraint(s) (e.g. non-normalized quaternions). By returning a non-const reference to the Right now I can't think of a good path to make non-const @joansola do you have some input on this matter? |
Yes, I see that this design decision makes sense from a point of view, where you want to avoid that the user does anything "uninformed". However, I believe that only people who know what they are doing and are familiar with the basic math of manifolds are using this library. |
Hello all. I see the point raised by Markus (thanks Markus) and I think it makes sense. Very often automatic checks and prohibitions that seek safety against misuses are compromised by other opposing needs such as portability, compatibility, speed, and other. Since Manif is intended as a tool library, it makes sense also to assume that its users know what they are doing, so I'd say it is OK to leave the user satisfy the unit constraint on quaternions. Finally, if we want to have different levels of protection for different users, the public/private character of parts of the API could be controlled at compile time with some flag on the CMAKE file. I'm no pro programmer and I am sure there might be more elegant ways to do so, but this one is simple. |
In class SomeClass {
public:
...
#ifdef MANIF_SOME_CLASS_PLUGIN
#include MANIF_SOME_CLASS_PLUGIN
#endif
private:
...
} And then @markusgft would write in Type* someNonConstTypeAccessor() { return &the_thing_; } And then to use #define MANIF_SOME_CLASS_PLUGIN "some_class_extension.h`
#include "manif/some_class.h" |
@andre-nguyen I see your point, although not in the details. I guess that the Or is it that the |
Yes! Sorry, edited that. Basically its the same extension system Eigen has http://eigen.tuxfamily.org/dox-3.2/TopicCustomizingEigen.html |
Cool! Thanks for this input! |
Hi all,
Well sometimes even "informed" users make tiny mistakes that takes way too much time to figure out - coughing 😄. Although I could agree with your point.
Having an Eigen-like API is also a design objective of
I'm really excited to hear about that and I'm looking forward to the manif integration and to trying it myself.
We'd be happy to know which extensions and how we could integrate them upstream. Let us know!
I totally agree with you. Note that
I don't know if I would personally consider that good practice :D. But we do publicly expose
Ok then it looks like we agree on making this API change. However,
I wouldn't do that. Changing the API based on a flag is prone to confusion more than anything. I'd rather make the function public and write a good old warning in the doc. @andre-nguyen So, to conclude, I've been convinced to make an API change and have a public non const Finally @markusgft, as you seem to be a |
@markusgft sorry I forgot to ask you, which 'auto-diff tools' are you using? It would be great to confirm that manif supports other tools than |
Dear all,
But what about addressing all those issues in separate threads? I will start opening separate feature requests for the additional small changes that I would need, and then I can continue discussing there! |
Dear all,
I am working on an optimal control library which supports both native Eigen-types and manif-types, as well as optimal control on manifolds.
I am trying to make things as generic as possible, i.e. write my code such that Eigen-types and manif-types are interchangeable where possible.
One of the unfortunate obstacles in the way is that manif does not have a non-const getter for
coeffs()
.Do you see any major obstacles for adding such a feature?
Any thoughts and discussion on this would be highly appreciated.
Best!
The text was updated successfully, but these errors were encountered: