<p align="center">
<a href="https://github.com/EymoLabs/eymos">
<img src="./logo.png" alt="EymOS banner" width="230" height="100" style="margin-bottom: -15px;">
</a>
<h3 align="center">EymOS - Lightweight Middleware for Robotics</h3>
<p align="center">
EymOS is a lightweight and efficient middleware for robotics, providing streamlined node communication and device control, designed for simplicity and high performance
<br>
<a href="https://github.com/EymoLabs/eymos/issues/new?template=bug.md">Report bug</a>
·
<a href="https://github.com/EymoLabs/eymos/issues/new?template=feature.md&labels=feature">Request feature</a>
</p>
</p>
## Table of contents
- [Introduction](#introduction)
- [Features](#features)
- [What's included](#whats-included)
- [Installation](#installation)
- [Prerequisites](#prerequisites)
- [Setup](#setup-with-pip-recommended)
- [Usage](#usage)
- [Services](#services)
- [First steps](#first-steps)
- [Dependencies](#dependencies)
- [Methods](#methods)
- [Attributes](#attributes)
- [Definitions](#definitions)
- [ServiceManager](#servicemanager)
- [Utilities](#utilities)
- [Logger](#logger)
- [My OS](#my-os)
- [Bugs and feature requests](#bugs-and-feature-requests)
- [Creators](#creators)
- [Collaborators](#collaborators)
- [License](#license)
## Introduction
EymOS is a lightweight and efficient middleware designed for robotics applications, inspired by the flexibility and modularity of systems like ROS, but optimized to be faster and lighter.
Originally developed for the robot Eymo, EymOS has evolved into an independent platform that provides all the essential functionalities for node communication, device control, and process management, with a focus on simplicity and performance.
## Features
* Lightweight and fast communication between nodes
* Device control and process management for small-scale robots
* Minimal resource usage, ideal for embedded systems and small robots
* Easy integration with cloud services for advanced features
## What's included
Within the download you'll find the following directories and files:
```text
root/
├── eymos/
│ ├── services/
│ │ ├── __init__.py
│ │ └── camera.py
│ ├── __init__.py
│ ├── logger.py
│ ├── service.py
│ ├── service_manager.py
│ └── utils.py
├── examples/
│ ├── timer/
│ └── camera_timer/
├── LICENSE
├── logo.png
├── README.md
├── requirements.txt
└── setup.py
```
## Installation
### Prerequisites
Ensure you have the following installed on your system:
- Python 3.9 or higher
### Setup with pip (recommended)
Use `pip` to install the package from PyPI.
1. Install the package using `pip`:
```sh
pip install eymos
```
2. Import the package and [start using it](#usage).
### Setup from source
Alternatively, you can clone the repository and install the package from the source code.
1. Clone the repository:
```sh
git clone https://github.com/EymoLabs/eymos.git
```
2. Navigate to the project directory and install the required dependencies:
```sh
cd eymos
pip install -r requirements.txt
```
3. You’re ready to use EymOS! [Start using it](#usage).
## Usage
After installing the package, you need to create the services for your robot, which will handle the communication between nodes and devices. Next, you could initialize them and start the service.
### Create a new service
Create a new Python file for your service, and define the class for the service. The service should inherit from the `Service` class provided by EymOS.
```python
from eymos import Service, utils, log
class TimerService(Service):
def init(self):
"""Initialize the service. Required."""
self.__time = 0
self.__is_running = False
self.__max_time = self._config.get("max_time", 300)
self._loop_delay = 1 # Control the loop delay in seconds
def destroy(self):
"""Destroy the service. Required."""
self.__time = None
self.__is_running = None
self.__max_time = None
def before(self):
"""Before the loop. (Before the loop method is called, in the service thread) Optional."""
# Not required for this service
pass
def loop(self):
"""Service loop. Optional."""
if not self.__is_running:
return
if self.__time > 0:
self.__time -= 1
if self.__time == 0:
self.__is_running = False
log("Timer stopped")
else:
log(f"Time left: {self.__time}")
# Add more custom methods if needed
def start_timer(self, time):
self.__time = min(time, self.__max_time)
self.__is_running = True
log("Timer started")
def stop_timer(self):
self.__is_running = False
self.__time = 0
log("Timer stopped")
def get_time(self):
return self.__time
```
### Initialize and start the service
Create a new Python file for your main program, and initialize the service manager. Add the services to the manager, and start the services.
```python
from eymos import ServiceManager
from eymos.services import CameraService
from services.timer import TimerService
def main():
# Create a new service manager
service_manager = ServiceManager()
# Link a configuration to the service manager
service_manager.set_config_file("config.json")
# Add the services to the manager
service_manager.add("timer", TimerService)
service_manager.add("camera", CameraService)
# Initialize the services
service_manager.start() # Start the first service added, and then the rest
if __name__ == "__main__":
main()
```
### Configuration file
Create a configuration file for the services, and specify the parameters for each service.
```json
{
"timer": {
"max_time": 300
},
"camera": {
"resolution": [640, 480],
"fps": 30
}
}
```
Optionally, you could use the `set_config` method to set the configuration dictionary directly, instead of using a configuration file.
```python
service_manager.set_config({
"timer": {
"max_time": 300
},
})
```
## Services
EymOS provides a set of services that can be used to control devices and processes in your robot. Each service is defined as a class that inherits from the `Service` class, and implements the required methods and attributes.
### First steps
When a service is initialized, some actions are performed automatically, to ensure the service is correctly set up and ready to run.
**On start**, when a service is started, the `init` method is called, which initializes the variables and configurations for the service. This method is required for all services. Additionally, a new asyncronous thread is created for the service, which will run the `before` and `loop` methods in a loop, with a delay specified by the `loop_delay` attribute.
**On stop**, when a service is stopped, the `destroy` method is called, which cleans up the resources used by the service. This method is required for all services.
### Dependencies
A service can define dependencies on other services, which will be started before the service is started. This is useful when a service requires another service to be running before it can start.
To define dependencies, set the [`DEPENDENCIES`](#definitions) constant in the service class, with the names of the services that the service depends on.
```python
class MyService(Service):
DEPENDENCIES = ["camera", "motor"]
```
### Methods
A service can define custom methods to perform specific actions or operations. These methods can be created as needed, and can be called from other services or external programs.
| Method | Description | Required |
| --- | --- | --- |
| `init` | Initialize the service, setting up the variables and configurations. | Yes |
| `destroy` | Destroy the service, cleaning up the resources used by the service. | Yes |
| `before` | Perform actions before the loop starts. This method is called in the service thread, before the loop method. | No |
| `loop` | Perform the main actions of the service. This method is called in the service thread, in a loop with a delay specified by the `loop_delay` attribute or the `LOOP_DELAY` constant. | No |
Additionally, a service has some reserved methods that should not be overridden:
| Method | Description |
| --- | --- |
| `start` | Start the service, initializing the service and starting the service thread. When the service is started, automatically starts all the other services that have not been started yet. If the service has dependencies, starts the dependencies first. |
| `stop` | Stop the service, stopping the service thread and cleaning up the resources used by the service. When the service is stopped, automatically stops all the other services that depend on this service. |
| `is_initialized` | Check if the service has been initialized. |
| `__init__` | Initialize the service instance, setting up the service attributes. |
| `__reboot` | Reboot all the services, stopping and starting all the services. |
| `__thread__execution` | Execute the service thread, calling the `before` and `loop` methods in a loop with the specified delay. |
| `__start_other_service` | Start another service that has not been started yet. |
### Attributes
The service class has some attributes that can be used to configure the service during the execution, or to access some information.
| Attribute | Description | Default |
| --- |----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| --- |
| _config | The configuration dictionary for the service. It contains the parameters specified in the configuration file (only the configuration dictionary identified by the service name). | `{}` (set in constructor) |
| _global_config | The global configuration dictionary for all the services. It contains the parameters specified in the global configuration file. | `None` (set in constructor) |
| _loop_delay | The delay between each loop iteration, in seconds. It controls the frequency of the loop method. | `self.LOOP_DELAY` |
| _manager | The service manager object that is running the service. | `None` |
| _name | The name of the service. It allows, for example, identifying other services and accessing to them (e.g., `self._services["camera"].get_frame()`). | `None` (set in constructor) |
| _services | The dictionary of all the services in the service manager. It allows accessing other services and calling their methods. | `None` |
| __errors | The number of consecutive errors that have occurred during the execution of the service. | `0` |
| __initialized | A flag that indicates if the service has been initialized. | `False` |
| __init_try | The number of times the service has tried to initialize. | `0` |
| __thread | The thread object that is running in the service. | `None` |
| __thread_stop_event | The event object that controls the stopping of the service thread. | `None` |
### Definitions
Some constants are defined in the service class, which can be used to configure the service or to define some properties.
| Constant | Description | Default |
| --- |--------------------------------------------------------------------------------------------------------------------------------------| --- |
| DEPENDENCIES | The list of services that the service depends on. The services in the list will be started before the service is started. | `[]`
| ERROR_INTERVAL | The interval between each error, in seconds. It controls the frequency of the error messages and helps to avoid flooding the logs. | `5` |
| LOOP_DELAY | The default delay between each loop iteration, in seconds. It controls the frequency of the loop method. | `0.25` (4 times per second) |
| MAX_ERRORS | The maximum number of consecutive errors that can occur before the service is stopped. Can be disabled by setting it to `-1`. | `5` |
| MAX_ERRORS_REBOOT | The maximum number of consecutive errors that can occur before **all the services** are rebooted. Can be disabled by setting it to `-1`. | `-1` (disabled) |
## ServiceManager
The `ServiceManager` class is used to manage the services in the robot, including all the necessary operations to start, stop, restart, reboot, and configure the services, allowing the interaction between them.
The class provides the following methods to manage the services:
| Method | Description |
| --- |----------------------------------------------------------------------------------------------------------------------|
| `add` | Add a new service to the manager. |
| `get` | Get a service instance from the manager. |
| `get_services` | Get a dictionary with all the services in the manager. |
| `start` | Start all the services in the manager. |
| `stop` | Stop all the services in the manager. |
| `restart` | Restart all the services in the manager. |
| `reboot` | Reboot the system, forcing all the services to be stopped. This method requires elevated permissions to be executed. |
| `exit` | Stop all the services and exit the program. |
| `set_config` | Set the global configuration dictionary for all the services. |
| `set_config_file` | Set the global configuration file for all the services. |
## Utilities
EymOS provides some utilities that can be used to simplify the development of services and programs, including a logger and an OS utility.
### Logger
The `log(<message>, <type>)` function allows you to log messages to the console, with different levels of severity.
#### Arguments
The first argument is the message to log, and the second argument is the level of the message (by default, `logging.INFO`).
#### Levels
The following levels are available (require the `import logging` statement):
- `logging.DEBUG`
- `logging.INFO`
- `logging.WARNING`
- `logging.ERROR`
- `logging.CRITICAL`
#### Example
```python
import logging
from eymos import log
log("This is an info message")
log("This is a debug message", logging.DEBUG)
log("This is a warning message", logging.WARNING)
log("This is an error message", logging.ERROR)
log("This is a critical message", logging.CRITICAL)
```
### My OS
The `utils.my_os()` function allows you to get the name of the operating system running on the device.
#### Returns
The function returns a string with the name of the operating system. The possible values are: `"Windows"`, `"Linux"`, `"Mac"` and `"Rpi"`. If the operating system is not recognized, the function returns `None`.
#### Example
```python
from eymos import utils
os_name = utils.my_os()
print(f"Operating system: {os_name}")
if os_name == "Rpi":
print("Do something specific for Raspberry Pi")
elif os_name == "Mac":
print("Do something specific for Mac")
else:
print("Do something generic")
```
## Bugs and feature requests
Have a bug or a feature request? Please search for existing and closed issues. If your problem or idea is not addressed yet, [open a new issue](https://github.com/EymoLabs/eymos/issues/new).
## Creators
This project was developed entirely by Xavi Burgos, as part of the [EymoLabs](https://github.com/EymoLabs) team.
### Xavi Burgos
- Website: [xburgos.es](https://xburgos.es)
- LinkedIn: [@xavi-burgos](https://www.linkedin.com/in/xavi-burgos/)
- GitHub: [@xavi-burgos99](https://github.com/xavi-burgos99)
- X (Twitter): [@xavi_burgos14](https://x.com/xavi_burgos14)
## Collaborators
Special thanks to the following people from the [EymoLabs](https://github.com/EymoLabs) team for their contributions to the project:
### Yeray Cordero
- GitHub: [@yeray142](https://github.com/yeray142/)
- LinkedIn: [@yeray142](https://linkedin.com/in/yeray142/)
### Javier Esmorris
- GitHub: [@jaesmoris](https://github.com/jaesmoris/)
- LinkedIn: [Javier Esmoris Cerezuela](https://www.linkedin.com/in/javier-esmoris-cerezuela-50840b253/)
### Gabriel Juan
- GitHub: [@GabrielJuan349](https://github.com/GabrielJuan349/)
- LinkedIn: [@gabi-juan](https://linkedin.com/in/gabi-juan/)
### Samya Karzazi
- GitHub: [@SamyaKarzaziElBachiri](https://github.com/SamyaKarzaziElBachiri)
- LinkedIn: [Samya Karzazi](https://linkedin.com/in/samya-k-2ba678235/)
## License
This project is licensed under a custom license, that allows you to **use and modify the code** for any purpose, as long as you **provide attribution to the original authors**, but you **cannot distribute the code** or any derivative work **without permission**. For more information, see the [LICENSE](LICENSE) file.
Raw data
{
"_id": null,
"home_page": "https://github.com/EymoLabs/eymos",
"name": "EymOS",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "robotics middleware eymos lightweight",
"author": "EymoLabs",
"author_email": "info@dzin.es",
"download_url": "https://files.pythonhosted.org/packages/7d/34/caa148878d0ccc87ec70f15a396085abb8afb450990caadebeb9d42d4df8/eymos-1.0.0.tar.gz",
"platform": null,
"description": "<p align=\"center\">\n <a href=\"https://github.com/EymoLabs/eymos\">\n <img src=\"./logo.png\" alt=\"EymOS banner\" width=\"230\" height=\"100\" style=\"margin-bottom: -15px;\">\n </a>\n <h3 align=\"center\">EymOS - Lightweight Middleware for Robotics</h3>\n <p align=\"center\">\n EymOS is a lightweight and efficient middleware for robotics, providing streamlined node communication and device control, designed for simplicity and high performance\n <br>\n <a href=\"https://github.com/EymoLabs/eymos/issues/new?template=bug.md\">Report bug</a>\n \u00b7\n <a href=\"https://github.com/EymoLabs/eymos/issues/new?template=feature.md&labels=feature\">Request feature</a>\n </p>\n</p>\n\n\n## Table of contents\n\n- [Introduction](#introduction)\n- [Features](#features)\n- [What's included](#whats-included)\n- [Installation](#installation)\n\t- [Prerequisites](#prerequisites)\n\t- [Setup](#setup-with-pip-recommended)\n- [Usage](#usage)\n- [Services](#services)\n\t- [First steps](#first-steps)\n - [Dependencies](#dependencies)\n - [Methods](#methods)\n - [Attributes](#attributes)\n - [Definitions](#definitions)\n- [ServiceManager](#servicemanager)\n- [Utilities](#utilities)\n - [Logger](#logger)\n - [My OS](#my-os)\n- [Bugs and feature requests](#bugs-and-feature-requests)\n- [Creators](#creators)\n- [Collaborators](#collaborators)\n- [License](#license)\n\n\n## Introduction\n\nEymOS is a lightweight and efficient middleware designed for robotics applications, inspired by the flexibility and modularity of systems like ROS, but optimized to be faster and lighter.\n\nOriginally developed for the robot Eymo, EymOS has evolved into an independent platform that provides all the essential functionalities for node communication, device control, and process management, with a focus on simplicity and performance.\n\n## Features\n\n* Lightweight and fast communication between nodes\n* Device control and process management for small-scale robots\n* Minimal resource usage, ideal for embedded systems and small robots\n* Easy integration with cloud services for advanced features\n\n## What's included\n\nWithin the download you'll find the following directories and files:\n\n```text\nroot/\n\u251c\u2500\u2500 eymos/\n\u2502 \u251c\u2500\u2500 services/\n\u2502 \u2502 \u251c\u2500\u2500 __init__.py\n\u2502 \u2502 \u2514\u2500\u2500 camera.py\n\u2502 \u251c\u2500\u2500 __init__.py\n\u2502 \u251c\u2500\u2500 logger.py\n\u2502 \u251c\u2500\u2500 service.py\n\u2502 \u251c\u2500\u2500 service_manager.py\n\u2502 \u2514\u2500\u2500 utils.py\n\u251c\u2500\u2500 examples/\n\u2502 \u251c\u2500\u2500 timer/\n\u2502 \u2514\u2500\u2500 camera_timer/\n\u251c\u2500\u2500 LICENSE\n\u251c\u2500\u2500 logo.png\n\u251c\u2500\u2500 README.md\n\u251c\u2500\u2500 requirements.txt\n\u2514\u2500\u2500 setup.py\n```\n\n## Installation\n\n### Prerequisites\nEnsure you have the following installed on your system:\n- Python 3.9 or higher\n\n### Setup with pip (recommended)\nUse `pip` to install the package from PyPI.\n\n1. Install the package using `pip`:\n ```sh\n pip install eymos\n ```\n2. Import the package and [start using it](#usage).\n\n### Setup from source\nAlternatively, you can clone the repository and install the package from the source code.\n\n1. Clone the repository:\n ```sh\n git clone https://github.com/EymoLabs/eymos.git\n ```\n2. Navigate to the project directory and install the required dependencies:\n ```sh\n cd eymos\n pip install -r requirements.txt\n ```\n3. You\u2019re ready to use EymOS! [Start using it](#usage).\n\n## Usage\nAfter installing the package, you need to create the services for your robot, which will handle the communication between nodes and devices. Next, you could initialize them and start the service.\n\n### Create a new service\nCreate a new Python file for your service, and define the class for the service. The service should inherit from the `Service` class provided by EymOS.\n```python\nfrom eymos import Service, utils, log\n\nclass TimerService(Service):\n\tdef init(self):\n\t\t\"\"\"Initialize the service. Required.\"\"\"\n\t\tself.__time = 0\n\t\tself.__is_running = False\n\t\tself.__max_time = self._config.get(\"max_time\", 300)\n\t\tself._loop_delay = 1 # Control the loop delay in seconds\n\n\tdef destroy(self):\n\t\t\"\"\"Destroy the service. Required.\"\"\"\n\t\tself.__time = None\n\t\tself.__is_running = None\n\t\tself.__max_time = None\n\n\tdef before(self):\n\t\t\"\"\"Before the loop. (Before the loop method is called, in the service thread) Optional.\"\"\"\n\t\t# Not required for this service\n\t\tpass\n\n\tdef loop(self):\n\t\t\"\"\"Service loop. Optional.\"\"\"\n\t\tif not self.__is_running:\n\t\t\treturn\n\t\tif self.__time > 0:\n\t\t\tself.__time -= 1\n\t\tif self.__time == 0:\n\t\t\tself.__is_running = False\n\t\t\tlog(\"Timer stopped\")\n\t\telse:\n\t\t\tlog(f\"Time left: {self.__time}\")\n\t\t\n\t# Add more custom methods if needed\n\tdef start_timer(self, time):\n\t\tself.__time = min(time, self.__max_time)\n\t\tself.__is_running = True\n\t\tlog(\"Timer started\")\n\t \n\tdef stop_timer(self):\n\t\tself.__is_running = False\n\t\tself.__time = 0\n\t\tlog(\"Timer stopped\")\n\t \n\tdef get_time(self):\n\t\treturn self.__time\n```\n\n### Initialize and start the service\nCreate a new Python file for your main program, and initialize the service manager. Add the services to the manager, and start the services.\n```python\nfrom eymos import ServiceManager\nfrom eymos.services import CameraService\nfrom services.timer import TimerService\n\ndef main():\n\t# Create a new service manager\n\tservice_manager = ServiceManager()\n\t\n\t# Link a configuration to the service manager\n\tservice_manager.set_config_file(\"config.json\")\n\t\n\t# Add the services to the manager\n\tservice_manager.add(\"timer\", TimerService)\n\tservice_manager.add(\"camera\", CameraService)\n\t\n\t# Initialize the services\n\tservice_manager.start()\t# Start the first service added, and then the rest\n\nif __name__ == \"__main__\":\n\tmain()\n```\n\n### Configuration file\nCreate a configuration file for the services, and specify the parameters for each service.\n```json\n{\n\t\"timer\": {\n\t\t\"max_time\": 300\n\t},\n\t\"camera\": {\n\t\t\"resolution\": [640, 480],\n\t\t\"fps\": 30\n\t}\n}\n```\n\nOptionally, you could use the `set_config` method to set the configuration dictionary directly, instead of using a configuration file.\n\n```python\nservice_manager.set_config({\n\t\"timer\": {\n\t\t\"max_time\": 300\n\t},\n})\n```\n\n## Services\nEymOS provides a set of services that can be used to control devices and processes in your robot. Each service is defined as a class that inherits from the `Service` class, and implements the required methods and attributes.\n\n### First steps\nWhen a service is initialized, some actions are performed automatically, to ensure the service is correctly set up and ready to run.\n\n**On start**, when a service is started, the `init` method is called, which initializes the variables and configurations for the service. This method is required for all services. Additionally, a new asyncronous thread is created for the service, which will run the `before` and `loop` methods in a loop, with a delay specified by the `loop_delay` attribute.\n\n**On stop**, when a service is stopped, the `destroy` method is called, which cleans up the resources used by the service. This method is required for all services.\n\n### Dependencies\nA service can define dependencies on other services, which will be started before the service is started. This is useful when a service requires another service to be running before it can start.\n\nTo define dependencies, set the [`DEPENDENCIES`](#definitions) constant in the service class, with the names of the services that the service depends on.\n\n```python\nclass MyService(Service):\n\tDEPENDENCIES = [\"camera\", \"motor\"]\n```\n\n### Methods\nA service can define custom methods to perform specific actions or operations. These methods can be created as needed, and can be called from other services or external programs.\n\n| Method | Description | Required |\n| --- | --- | --- |\n| `init` | Initialize the service, setting up the variables and configurations. | Yes |\n| `destroy` | Destroy the service, cleaning up the resources used by the service. | Yes |\n| `before` | Perform actions before the loop starts. This method is called in the service thread, before the loop method. | No |\n| `loop` | Perform the main actions of the service. This method is called in the service thread, in a loop with a delay specified by the `loop_delay` attribute or the `LOOP_DELAY` constant. | No |\n\nAdditionally, a service has some reserved methods that should not be overridden:\n\n| Method | Description |\n| --- | --- |\n| `start` | Start the service, initializing the service and starting the service thread. When the service is started, automatically starts all the other services that have not been started yet. If the service has dependencies, starts the dependencies first. |\n| `stop` | Stop the service, stopping the service thread and cleaning up the resources used by the service. When the service is stopped, automatically stops all the other services that depend on this service. |\n| `is_initialized` | Check if the service has been initialized. |\n| `__init__` | Initialize the service instance, setting up the service attributes. |\n| `__reboot` | Reboot all the services, stopping and starting all the services. |\n| `__thread__execution` | Execute the service thread, calling the `before` and `loop` methods in a loop with the specified delay. |\n| `__start_other_service` | Start another service that has not been started yet. |\n\n### Attributes\nThe service class has some attributes that can be used to configure the service during the execution, or to access some information.\n\n| Attribute | Description | Default |\n| --- |----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| --- |\n| _config | The configuration dictionary for the service. It contains the parameters specified in the configuration file (only the configuration dictionary identified by the service name). | `{}` (set in constructor) |\n| _global_config | The global configuration dictionary for all the services. It contains the parameters specified in the global configuration file. | `None` (set in constructor) |\n| _loop_delay | The delay between each loop iteration, in seconds. It controls the frequency of the loop method. | `self.LOOP_DELAY` |\n| _manager | The service manager object that is running the service. | `None` |\n| _name | The name of the service. It allows, for example, identifying other services and accessing to them (e.g., `self._services[\"camera\"].get_frame()`). | `None` (set in constructor) |\n| _services | The dictionary of all the services in the service manager. It allows accessing other services and calling their methods. | `None` |\n| __errors | The number of consecutive errors that have occurred during the execution of the service. | `0` |\n| __initialized | A flag that indicates if the service has been initialized. | `False` |\n| __init_try | The number of times the service has tried to initialize. | `0` |\n| __thread | The thread object that is running in the service. | `None` |\n| __thread_stop_event | The event object that controls the stopping of the service thread. | `None` |\n\n\n### Definitions\nSome constants are defined in the service class, which can be used to configure the service or to define some properties.\n\n| Constant | Description | Default |\n| --- |--------------------------------------------------------------------------------------------------------------------------------------| --- |\n| DEPENDENCIES | The list of services that the service depends on. The services in the list will be started before the service is started. | `[]`\n| ERROR_INTERVAL | The interval between each error, in seconds. It controls the frequency of the error messages and helps to avoid flooding the logs. | `5` |\n| LOOP_DELAY | The default delay between each loop iteration, in seconds. It controls the frequency of the loop method. | `0.25` (4 times per second) |\n| MAX_ERRORS | The maximum number of consecutive errors that can occur before the service is stopped. Can be disabled by setting it to `-1`. | `5` |\n| MAX_ERRORS_REBOOT | The maximum number of consecutive errors that can occur before **all the services** are rebooted. Can be disabled by setting it to `-1`. | `-1` (disabled) |\n\n\n## ServiceManager\nThe `ServiceManager` class is used to manage the services in the robot, including all the necessary operations to start, stop, restart, reboot, and configure the services, allowing the interaction between them.\n\nThe class provides the following methods to manage the services:\n\n| Method | Description |\n| --- |----------------------------------------------------------------------------------------------------------------------|\n| `add` | Add a new service to the manager. |\n| `get` | Get a service instance from the manager. |\n| `get_services` | Get a dictionary with all the services in the manager. |\n| `start` | Start all the services in the manager. |\n| `stop` | Stop all the services in the manager. |\n| `restart` | Restart all the services in the manager. |\n| `reboot` | Reboot the system, forcing all the services to be stopped. This method requires elevated permissions to be executed. |\n| `exit` | Stop all the services and exit the program. |\n| `set_config` | Set the global configuration dictionary for all the services. |\n| `set_config_file` | Set the global configuration file for all the services. |\n\n\n## Utilities\nEymOS provides some utilities that can be used to simplify the development of services and programs, including a logger and an OS utility.\n\n### Logger\nThe `log(<message>, <type>)` function allows you to log messages to the console, with different levels of severity.\n\n#### Arguments\nThe first argument is the message to log, and the second argument is the level of the message (by default, `logging.INFO`).\n\n#### Levels\nThe following levels are available (require the `import logging` statement):\n- `logging.DEBUG`\n- `logging.INFO`\n- `logging.WARNING`\n- `logging.ERROR`\n- `logging.CRITICAL`\n\n#### Example\n```python\nimport logging\nfrom eymos import log\n\nlog(\"This is an info message\")\nlog(\"This is a debug message\", logging.DEBUG)\nlog(\"This is a warning message\", logging.WARNING)\nlog(\"This is an error message\", logging.ERROR)\nlog(\"This is a critical message\", logging.CRITICAL)\n```\n\n### My OS\nThe `utils.my_os()` function allows you to get the name of the operating system running on the device.\n\n#### Returns\nThe function returns a string with the name of the operating system. The possible values are: `\"Windows\"`, `\"Linux\"`, `\"Mac\"` and `\"Rpi\"`. If the operating system is not recognized, the function returns `None`.\n\n#### Example\n```python\nfrom eymos import utils\n\nos_name = utils.my_os()\nprint(f\"Operating system: {os_name}\")\n\nif os_name == \"Rpi\":\n\tprint(\"Do something specific for Raspberry Pi\")\nelif os_name == \"Mac\":\n\tprint(\"Do something specific for Mac\")\nelse:\n\tprint(\"Do something generic\")\n```\n\n## Bugs and feature requests\nHave a bug or a feature request? Please search for existing and closed issues. If your problem or idea is not addressed yet, [open a new issue](https://github.com/EymoLabs/eymos/issues/new).\n\n## Creators\nThis project was developed entirely by Xavi Burgos, as part of the [EymoLabs](https://github.com/EymoLabs) team.\n\n### Xavi Burgos\n- Website: [xburgos.es](https://xburgos.es)\n- LinkedIn: [@xavi-burgos](https://www.linkedin.com/in/xavi-burgos/)\n- GitHub: [@xavi-burgos99](https://github.com/xavi-burgos99)\n- X (Twitter): [@xavi_burgos14](https://x.com/xavi_burgos14)\n\n## Collaborators\nSpecial thanks to the following people from the [EymoLabs](https://github.com/EymoLabs) team for their contributions to the project:\n\n### Yeray Cordero\n- GitHub: [@yeray142](https://github.com/yeray142/)\n- LinkedIn: [@yeray142](https://linkedin.com/in/yeray142/)\n\n### Javier Esmorris\n- GitHub: [@jaesmoris](https://github.com/jaesmoris/)\n- LinkedIn: [Javier Esmoris Cerezuela](https://www.linkedin.com/in/javier-esmoris-cerezuela-50840b253/)\n\n### Gabriel Juan\n- GitHub: [@GabrielJuan349](https://github.com/GabrielJuan349/)\n- LinkedIn: [@gabi-juan](https://linkedin.com/in/gabi-juan/)\n\n### Samya Karzazi\n- GitHub: [@SamyaKarzaziElBachiri](https://github.com/SamyaKarzaziElBachiri)\n- LinkedIn: [Samya Karzazi](https://linkedin.com/in/samya-k-2ba678235/)\n\n## License\nThis project is licensed under a custom license, that allows you to **use and modify the code** for any purpose, as long as you **provide attribution to the original authors**, but you **cannot distribute the code** or any derivative work **without permission**. For more information, see the [LICENSE](LICENSE) file.\n",
"bugtrack_url": null,
"license": "Custom License",
"summary": "EymOS - Lightweight Middleware for Robotics",
"version": "1.0.0",
"project_urls": {
"Bug Reports": "https://github.com/EymoLabs/eymos/issues",
"Homepage": "https://github.com/EymoLabs/eymos",
"Source": "https://github.com/EymoLabs/eymos"
},
"split_keywords": [
"robotics",
"middleware",
"eymos",
"lightweight"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "927566b0be985f87290dd7902d742e1a0247791cfea1a5a4a4858cf703d28894",
"md5": "2e28d6dad98f0873723e7df4ceac11b0",
"sha256": "bf5bbf0d83e3c4601d5956025072daefc6140571a6e924ffe09a985ea148cb77"
},
"downloads": -1,
"filename": "EymOS-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2e28d6dad98f0873723e7df4ceac11b0",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 14219,
"upload_time": "2024-09-28T12:42:06",
"upload_time_iso_8601": "2024-09-28T12:42:06.792042Z",
"url": "https://files.pythonhosted.org/packages/92/75/66b0be985f87290dd7902d742e1a0247791cfea1a5a4a4858cf703d28894/EymOS-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "7d34caa148878d0ccc87ec70f15a396085abb8afb450990caadebeb9d42d4df8",
"md5": "9599718a280c55798fec47e0688df77e",
"sha256": "c13c6b242e122e6f34fd482944a2b26ddab0cefd43d04e70114516ccc052837c"
},
"downloads": -1,
"filename": "eymos-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "9599718a280c55798fec47e0688df77e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 13000,
"upload_time": "2024-09-28T12:42:08",
"upload_time_iso_8601": "2024-09-28T12:42:08.460117Z",
"url": "https://files.pythonhosted.org/packages/7d/34/caa148878d0ccc87ec70f15a396085abb8afb450990caadebeb9d42d4df8/eymos-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-28 12:42:08",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "EymoLabs",
"github_project": "eymos",
"github_not_found": true,
"lcname": "eymos"
}