You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This test was performed on a Sintro Uno R3 unit, not connected to any motor etc.
The command sequence is: "E", "Z", "Tn", and I measure how soon does - appear after sending the T command.
Test results:
degree
duration (seconds)
0
0.10
1~255
3.31
256~359
3.27
I was expecting the duration to increase from 0 to 180 and decrease from 180 to 359.
It's surprising that there are only two duration values and the gap suspiciously falls between 255 and 256, the overflow point of uint8_t type.
The program for this test is:
#!/usr/bin/python3importserialimporttimeclassTurntable:
""" Control a MocoMakers.com turntable over serial port. """def__init__(self, port, ackTimeout=0.2):
""" Initialize a turntable controller. :param port: serial port name :type port: str :param ackTimeout: how long (seconds) to wait for an acknowledgement :type ackTimeout: float """self.ackTimeout=ackTimeoutself.serial=serial.Serial(
port=port, baudrate=115200, timeout=ackTimeout, writeTimeout=ackTimeout)
foriinrange(10):
self.serial.read()
defclose(self):
self._cmd("E", immediate=True)
self.serial.close()
def_cmd(self, cmd, immediate=False, timeout=None):
""" Send a command and wait for completion. :param cmd: command string including parameters :type cmd: str :param immediate: whether the command would complete immediately (no "-" return) :type immediate: boolean :param timeout: timeout (seconds) for command completion :type timeout: float :return: whether success :rtype: bool """cmd= ("%s\n"%cmd).encode("ascii")
self.serial.write(cmd)
time.sleep(0.1)
ack=self.serial.read()
ifack!=cmd[0:1]:
returnFalseifimmediate:
returnTruetimeout=timeoutiftimeoutisnotNoneelse30.0elapsed=0.0whileelapsed<timeout:
ack=self.serial.read()
ifack==b'-':
returnTrueelapsed=elapsed+self.ackTimeoutreturnFalsedefzero(self):
""" Mark current position as zero. """returnself._cmd("Z", immediate=True)
defrotateBy(self, n, timeout=None):
""" Rotate n degrees from current position. :param n: relative position (degrees). :type n: float """returnself._cmd("B%0.2f"%n, timeout=timeout)
defrotateTo(self, n, timeout=None):
""" Rotate n degrees from zero position. :param n: absolute position (degrees). :type n: float """returnself._cmd("T%0.2f"%n, timeout=timeout)
defstop(self, timeout=None):
""" Stop rotation. """returnself._cmd("S", timeout=timeout)
defestop(self):
""" Emergency stop. """returnself._cmd("E", immediate=True)
defmeasureTiming(port):
""" Measure rotation timing of a turntable and print as TSV. """turntable=Turntable(port)
forninrange(0, 360):
ifnotturntable.estop():
raiseRuntimeError("estop command failed")
ifnotturntable.zero():
raiseRuntimeError("zero command failed")
t0=time.time()
ok=turntable.rotateTo(n)
t1=time.time()
ifnotok:
raiseRuntimeError("rotateTo command failed")
print("%d\t%0.2f"% (n, t1-t0))
if__name__=='__main__':
importargparseparser=argparse.ArgumentParser(
description='Turntable timing measurements.')
parser.add_argument('--port', type=str, required=True, help='serial port')
args=parser.parse_args()
measureTiming(args.port)
The text was updated successfully, but these errors were encountered:
The last test result was incorrect due to bug #4. I retested on the real unit with the following code:
defmeasureTiming(port):
""" Measure rotation timing of a turntable and print as TSV. """forninrange(0, 1800, 30):
turntable=Turntable(port)
ifnotturntable.zero():
raiseRuntimeError("zero command failed")
t0=time.time()
ok=turntable.rotateBy(n)
t1=time.time()
ifnotok:
raiseRuntimeError("rotateTo command failed")
print("%d\t%0.2f"% (n, t1-t0))
turntable.close()
The results are:
rotateBy
duration(seconds)
0
0.10
30
6.23
60
7.42
90
8.48
120
9.50
150
10.51
180
11.51
210
12.51
240
13.52
270
14.47
300
15.48
330
16.48
360
17.48
390
18.48
420
19.48
450
20.48
480
21.48
510
22.48
540
23.45
570
24.45
600
25.45
630
26.46
660
27.45
690
28.46
720
29.46
750
30.46
780
31.46
810
32.46
840
33.47
870
34.47
My test indicates that the display is consistent with LCD display, but the actual motor/turntable is very inaccurate. In fact, rotateTo(oldPosition) does not actually go to the old position. This is probably a hardware issue.
I measured timing of StepperFast.ino.
This test was performed on a Sintro Uno R3 unit, not connected to any motor etc.
The command sequence is: "E", "Z", "Tn", and I measure how soon does
-
appear after sending the T command.Test results:
I was expecting the duration to increase from 0 to 180 and decrease from 180 to 359.
It's surprising that there are only two duration values and the gap suspiciously falls between 255 and 256, the overflow point of
uint8_t
type.The program for this test is:
The text was updated successfully, but these errors were encountered: