Rospy controllers¶
The rospy_controllers package implements a Python ROS node that can be used to implement controllers for CRS in Python. It mimics the structure of ros_controllers with a few differences.
- All Python files are stored in the same folder (e.g. for the visualizer, solver generation, controller).
- Control inputs and visualization are managed by the Python controller.
Usage¶
- Set
control_package:=rospy_controllersin the CRS launch file (e.g. insim_single_car.launch). - Set
controller_typein the controller configuration such that it is correctly resolved in__init__.py. - Launch!
Implemented controllers¶
Zero-order GP-MPC¶
The documentation for the zero-order GP-MPC controllers can be found here.
Development¶
Adding a new Python controller¶
To add a new Python controller,
- Add another Python module (directory with
__init__.py) in therospy_controllersdirectory. - Decide on a
controller_typefor your Python controller and resolve it in the__init__.pyfile. Set the samecontroller_typein your controller config, see, e.g., this example config. - Implement your controller as a subclass of the abstract
RosPyControllerclass defined inrospy_controller.py. In particular, it needs to return a control input when callingget_input(state); visualization is performed by publishing messages withpublish_visualization(); both methods are called at every controller sampling time.