diff --git a/examples/sample_client.py b/examples/sample_client.py index 1a9c115..7602d84 100755 --- a/examples/sample_client.py +++ b/examples/sample_client.py @@ -26,7 +26,7 @@ async def on_classifier_event(self, ce: ClassifierEvent): pass async def on_aggregated_data(self, ad: AggregatedData): - logging.info(ad.json()) + logging.info(ad) async def on_emg_data(self, emg: EMGData): # logging.info(emg) diff --git a/myo/core.py b/myo/core.py index 4553637..75a67d4 100644 --- a/myo/core.py +++ b/myo/core.py @@ -62,7 +62,7 @@ def __init__(self, fvd: FVData, imu: IMUData): self.imu = imu def __str__(self): - return f"{repr(self.fvd)},{repr(self.imu)}" + return f"{','.join(map(str, self.fvd.fv))},{self.imu}" def json(self): return json.dumps(self.to_dict()) diff --git a/myo/types.py b/myo/types.py index 046518d..94ea826 100644 --- a/myo/types.py +++ b/myo/types.py @@ -197,6 +197,9 @@ def __init__(self, w, x, y, z): self.y = y / ORIENTATION_SCALE self.z = z / ORIENTATION_SCALE + def __str__(self): + return f"{self.w},{self.x},{self.y},{self.z}" + def to_dict(self): return {"w": self.w, "x": self.x, "y": self.y, "z": self.z} @@ -218,6 +221,9 @@ def __repr__(self): ) ) + def __str__(self): + return f"{self.orientation},{','.join(map(str, self.accelerometer))},{','.join(map(str, self.gyroscope))}" + def json(self): return json.dumps(self.to_dict())