Caltech-AMBER / obelisk

A stable generic robot control interface.
https://caltech-amber.github.io/obelisk/
MIT License
5 stars 0 forks source link

Remove the need for super calls by providing abstract methods #35

Open Zolkin1 opened 1 month ago

Zolkin1 commented 1 month ago

Requiring the user to perform a super call is not great because they might forget, and on the C++ side, its a bit messy with the templating. Further, on the C++ side since there is no super then the user must specify which parent node class to use, so if on_ functions are not implemented for each obelisk node type, then this will be very confusing for the user, unless every class implements all of them, which is silly in some cases. For another take on this, see here. It would be cleaner to provide an abstract method that we call in each on_ function. Then the user will be required to implement this function and we can guarantee that it gets called (and better yet, that it gets called at the right point in the function).

Zolkin1 commented 1 month ago

On the C++ side I have implemented PostConfigure(), PostActivate(), etc... that the user can override if they want an action to be called. It is always called last so that we can assure everything is setup for the user. The normal on_* methods are not overridable currently (but we can undo this change easily if we want).

Zolkin1 commented 1 month ago

We have removed the PostConfigure(), PostActivate(), etc... functions in favor of having the user call super. Note that all C++ classes now have all on_*() functions implemented so the user can always call super on the immediate parent class. We may choose to re-visit this in the futue.