Design of a teleop-api
I need to write a python script which will be callable from any other python script (that is, outside of the normal ROS loop that includes a call to .spin or .sleep and does both topic publish and subscribe-class function. For example I would like to be able to write:
teleopapi.move(0.1, 2) # move at 0.1 m/s for 2 seconds
or
dist = teleopapi.lidar(0) # return distance reading from LIDAR at zero degrees.
These are just samples which in reality I would experiment further to get the "right" api. I've been thinking and reading about how I would implement this. I am wondering if anyone has done something like this, knows of existing code, or knows of a reasonable way to structure the code.
If you are wondering, this is just an experimental "testing tool" that I am exploring.