Package: rosys
RoSys - The Robot SystemRoSys provides an easy-to-use robot system.
Its purpose is similar toROS.
But RoSys is fully based on modern web technologies and focusses on mobile robotics.The full documentation is available atrosys.io.PrinciplesAll PythonPython is great to write business logic.
Computation-heavy tasks are wrapped in processes, accessed through WebSockets or called via C++ bindings.
Like you would do in any other Python program.ModularityYou can structure your code as you please.
RoSys provides its magic without assuming a specific file structure, configuration files or enforced naming.Event LoopThanks toasyncioyou can write your business logic without locks and mutexes.
The execution isparallel but not concurrentwhich makes it easier to read, write and debug.
In real-case scenarios this is also much faster thanROS.
Its multiprocessing architecture requires too much inter-process communication.Web UIMost machines need some kind of human interaction.
RoSys is built from the ground up to make sure your robot can be operated fully off the grid with any web browser.
This is done by incorporatingNiceGUI, a wonderful all-Python UI web framework.
It is also possible to proxy the user interface through a gateway for remote operation.SimulationRobot hardware is often slower than your own computer.
To rapidly test out new behavior and algorithms, RoSys provides a simulation mode.
Here, all hardware is mocked and can even be manipulated to test wheel blockages and similar.TestingYou can usepytestto write high-level integration tests.
It is based on the above-described simulation mode and accelerates the robot's time for super fast execution.Architecture and FeaturesModulesRoSys modules are just Python modules which encapsulate certain functionality.
They can hold their own state, register lifecycle hooks, run methods repeatedly and subscribe to or raiseevents.
Modules can depend on other modules which is mostly implemented by passing them into the constructor.Lifecycle Hooks and LoopsModules can register functions viarosys.on_startuporrosys.on_shutdownas well as repeatedly with a given interval withrosys.on_repeat.!!! note
Note that NiceGUI'sappobject also provides methodsapp.on_startupandapp.on_shutdown, but it is recommended to use RoSys' counterparts:rosys.on_startupensures the callback is executedafterpersistent modules have been loaded from storage.
If you, e.g., set therosys.config.simulation_speedprogrammatically viaapp.on_startup()instead ofrosys.on_startup,
the change is overwritten by RoSys'persistence.restore().EventsModules can provide events to allow connecting otherwise separated modules of the system.
For example, one module might read sensor data and raise an eventNEW_SENSOR_DATA, without knowing of any consumers.
Another module can register onNEW_SENSOR_DATAand act accordingly when being called.AutomationsRoSys provides anAutomatormodule for running "automations".
Automations are coroutines that can not only be started and stopped, but also paused and resumed, e.g. usingAutomationControls.
Have a look at ourClick-and-driveexample.PersistenceModules can register backup and restore methods to read and write their state to disk.TimeRoSys uses its own time which is accessible throughrosys.time.
This way the time can advance much faster in simulation and tests if no CPU-intensive operation is performed.
To delay the execution of a coroutine, you should invokeawait rosys.sleep(seconds: float).
This creates a delay until the provided amount ofRoSys timehas elapsed.Threading and MultiprocessingRoSys makes extensive use ofasync/awaitto achieve parallelism without threading or multiprocessing.
But not every piece of code you want to integrate is offering an asyncio interface.
Therefore RoSys provides two handy wrappers:IO-bound:
If you need to read from an external device or use a non-async HTTP library likerequests,
you should wrap the code in a function and await it withawait rosys.run.io_bound(...).CPU-bound:
If you need to do some heavy computation and want to spawn another process,
you should wrap the code in a function and await it withawait rosys.run.cpu_bound(...).SafetyPython (and Linux) is fast enough for most high-level logic, but has no realtime guarantees.
Safety-relevant behavior should therefore be put on a suitable microcontroller.
It governs the hardware of the robot and must be able to perform safety actions like triggering emergency hold etc.We suggest to use an industrial PC with an integrated controller like theZauberzeug Robot Brain.
It provides a Linux system to run RoSys, offers AI acceleration via NVidia Jetson, two integratedESP32microcontrollers and six I/O sockets with up to 24 GPIOs for digital I/Os, CAN, RS485, SPI, I2C, etc.
It also has two hardware ENABLE switches and one which is controllable via software.To have flexible configuration for the microcontroller we created another open source project calledLizard.
It is a domain-specific language interpreted by the microcontroller which enables you to write reactive hardware behavior without recompiling and flashing.User InterfaceRoSys builds upon the open source projectNiceGUIand offers many robot-related UI elements.
NiceGUI is a high-level UI framework for the web.
This means you can write all UI code in Python and the state is automatically reflected in the browser through WebSockets.
See any of ourexamples.RoSys can also be used with other user interfaces or interaction models if required, for example a completely app-based control through Bluetooth Low Energy with Flutter.NotificationsModules can notify the user throughrosys.notify('message to the user').
When using NiceGUI, the notifications will show as snackbar messages.
The history of notifications is stored in the listrosys.notifications.