diff --git a/setup.cfg b/setup.cfg index bce4661d..486eb6bc 100644 --- a/setup.cfg +++ b/setup.cfg @@ -20,7 +20,7 @@ install_requires = grpcio>=1.59.0, <=1.62.2 pyquaternion==0.9.9 opencv-python>=4.8.0, <4.9.0 - reachy2-sdk-api>=1.0.9, <1.1.0 + reachy2-sdk-api>=1.0.10, <1.1.0 [options.packages.find] where = src diff --git a/src/reachy2_sdk/config/reachy_info.py b/src/reachy2_sdk/config/reachy_info.py index e1f17790..cf683a85 100644 --- a/src/reachy2_sdk/config/reachy_info.py +++ b/src/reachy2_sdk/config/reachy_info.py @@ -5,7 +5,7 @@ from typing import Any, Dict, List, Optional -from reachy2_sdk_api.reachy_pb2 import Reachy +from reachy2_sdk_api.reachy_pb2 import Reachy, ReachyCoreMode from ..parts.mobile_base import MobileBase @@ -36,6 +36,8 @@ def __init__(self, reachy: Reachy) -> None: self._disabled_parts: List[str] = [] self._mobile_base: Optional[MobileBase] = None + self._mode: ReachyCoreMode = reachy.info.core_mode + self._set_config(reachy) def _set_config(self, msg: Reachy) -> None: @@ -73,12 +75,14 @@ def _set_mobile_base(self, mobile_base: MobileBase) -> None: def __repr__(self) -> str: """Clean representation of a ReachyInfo.""" repr_template = ( - '" ) return repr_template.format( + mode=self.mode, serial_number=self.robot_serial_number, hardware_version=self.hardware_version, software_version=self.core_software_version, @@ -112,3 +116,11 @@ def hardware_version(self) -> str: def core_software_version(self) -> str: """Returns the robot's core software version.""" return self._core_software_version + + @property + def mode(self) -> str: + """Returns the robot's core mode. + + Can be either "FAKE", "REAL" or "GAZEBO". + """ + return str(ReachyCoreMode.keys()[self._mode])