fix(feetech): motor position readings overflow (#3373)

This commit is contained in:
Maxime Ellerbach
2026-04-13 22:39:58 +02:00
committed by GitHub
parent 187b2167ed
commit a656a982af
2 changed files with 69 additions and 0 deletions
+8
View File
@@ -216,6 +216,14 @@ class FeetechMotorsBus(SerialMotorsBus):
self.write("Maximum_Acceleration", motor, maximum_acceleration)
self.write("Acceleration", motor, acceleration)
# Clear bit 4 (0x10) of the Phase register (0x12) to set angle feedback mode to 0.
# This forces position readings to be in the range [0, resolution - 1] and prevents overflow or negative values.
# Only known to be necessary for the STS3215.
if self.motors[motor].model == "sts3215":
phase = self.read("Phase", motor, normalize=False)
if phase & 0x10:
self.write("Phase", motor, phase & ~0x10)
@property
def is_calibrated(self) -> bool:
motors_calibration = self.read_calibration()