Source code for dobot1_control.DobotBase

"""
Base class for Dobot control.

Provides common debugging and utility functions.

:author: Ingo Breßler, May 13, 2026
:license: MIT
"""

import numpy as np

BASE, REAR, FRONT = range(3)
JOINT_NAME = ["base", "rear", "front"]


[docs] def valueToStr(v): if isinstance(v, (float, np.floating)): s = f"{v: 7.4f}" elif isinstance(v, (bool, np.bool_)): s = f"{str(v):>7s}" elif isinstance(v, (int, np.integer)): # int? s = f"{v:>7d}" else: s = f"{v:>7s}" # string? return s
[docs] def arrayToStr(arr): if arr is None: return "None" try: return f"({",".join([valueToStr(v) for v in arr])})" except TypeError: return valueToStr(arr)
[docs] class DobotBase: def class_name(self): return type(self).__name__ def _debug(self, *args, level=1): indent = level * 2 prefix = " " * indent + f"{self.class_name()}:" if level == 0 else "" print(prefix, *args)