I created a micro-framework on top of rclpy
with some additional functionality builtin that I think makes ROS2 less verbose to use and also solves a few common problems.
Similar to webservers, things are done via decorating callbacks. Here are some of the features implemented:
- auto-declare parameters from dataclass or attrs
- init/clean callbacks are called when the config options set as their dependencies are changed
- auto-infer publish and subscribe message types
- subscriptions automatically refresh when the parameter for their topic is changed
I am also planning to:
- create decorators for service servers and action servers as well
- pass the time delta to the interval callback
- auto-infer service call type
If you are wondering why I set topics as parameters instead of remapping, it is because ros2topic cannot detect the message type automatically on a remapped topic. So in my launch files, I set topics via parameters instead of remapping.
I also created my own devcontainer template for using ROS2, featuring noVNC built-in and doing everything via a named volume: GitHub - Interpause/ros2-workspace-template
As for the code for this framework, it is on a Github organization account I am supposed to keep semi-private. This post serves more as inspiration for someone to come along, copy the idea and do it better.