from dataclasses import dataclass, field
from typing import TYPE_CHECKING
from symaware.base import Entity as BaseEntity
from symaware.base import NullDynamicalModel
from .dynamical_model import DynamicalModel
if TYPE_CHECKING:
from symaware.extra.ros.utils import RosClient
[docs]
@dataclass(frozen=True)
class Entity(BaseEntity):
"""
Abstract class for the entities using meant to communicate with ROS.
The implementation can be empty, since they only need to transmit the control input to the real robot.
Args
----
id:
Identifier of the entity, if linked to an :class:`Agent`
model:
Dynamical model associated with the entity. Must be a subclass of :class:`.PybulletDynamicalModel`
"""
model: "DynamicalModel" = field(default_factory=NullDynamicalModel)
[docs]
def initialise(self, ros_client: "RosClient | None" = None):
self.model.initialise(ros_client)
[docs]
@dataclass(frozen=True)
class F1tenth(Entity):
"""
Simple entity representing a [f1tenth](https://roboracer.ai/) car.
Args
----
id:
Identifier of the entity, if linked to an :class:`Agent`
model:
Dynamical model associated with the entity. Must be a subclass of :class:`.PybulletDynamicalModel`
"""