SpeedAccelDeccelPositionM1
Posted: Wed Sep 23, 2020 12:51 am
I have configured the PID position and with BasicMicro Motion Studio it is accurate.
speed = 5690,acc and decc = 4000,P=10,I=1,D=2

when I send use the serial command SpeedAccelDeccelPositionM1(self,address,accel,speed,deccel,position,buffer) in the following code:
the output from the print is:
(1, -134, 3) (1, 0, 128)
(1, -134, 2) (1, 0, 128)
(1, -134, 2) (1, 0, 128)
(1, -134, 2) (1, 0, 128)
(1, -134, 2) (1, 0, 128)
(1, -134, 2) (1, 0, 128)
(1, -134, 2) (1, 0, 128)
(1, -134, 2) (1, 0, 128)
(1, -133, 4) (1, 0, 128)
(1, -133, 0) (1, 0, 128)
(1, -132, 4) (1, 0, 128)
(1, -132, 0) (1, 0, 128)
(1, -131, 4) (1, 0, 128)
(1, -131, 0) (1, 0, 128)
(1, -130, 4) (1, 0, 128)
(1, -130, 0) (1, 0, 128)
(1, -129, 4) (1, 0, 128)
(1, -128, 4) (1, 0, 128)
(1, -127, 4) (1, 0, 128)
(1, -126, 4) (1, 0, 128)
(1, -125, 4) (1, 0, 128)
(1, -123, 4) (1, 0, 128)
(1, -122, 4) (1, 0, 128)
(1, -121, 4) (1, 0, 128)
(1, -120, 4) (1, 0, 128)
(1, -118, 4) (1, 0, 128)
(1, -116, 4) (1, 0, 128)
(1, -114, 4) (1, 0, 128)
(1, -112, 4) (1, 0, 128)
(1, -111, 4) (1, 0, 128)
(1, -111, 0) (1, 0, 128)
(1, -108, 4) (1, 0, 128)
(1, -106, 4) (1, 0, 128)
(1, -105, 4) (1, 0, 128)
(1, -103, 4) (1, 0, 128)
(1, -101, 4) (1, 0, 128)
(1, -99, 4) (1, 0, 128)
(1, -96, 4) (1, 0, 128)
(1, -94, 4) (1, 0, 128)
(1, -91, 4) (1, 0, 128)
(1, -89, 4) (1, 0, 128)
(1, -85, 4) (1, 0, 128)
(1, -82, 4) (1, 0, 128)
(1, -78, 4) (1, 0, 128)
(1, -75, 4) (1, 0, 128)
(1, -71, 4) (1, 0, 128)
(1, -69, 4) (1, 0, 128)
(1, -66, 4) (1, 0, 128)
(1, -64, 4) (1, 0, 128)
(1, -62, 4) (1, 0, 128)
(1, -58, 4) (1, 0, 128)
(1, -56, 4) (1, 0, 128)
(1, -54, 4) (1, 0, 128)
(1, -52, 4) (1, 0, 128)
(1, -49, 4) (1, 0, 128)
(1, -47, 4) (1, 0, 128)
(1, -45, 4) (1, 0, 128)
(1, -43, 4) (1, 0, 128)
(1, -41, 4) (1, 0, 128)
(1, -39, 4) (1, 0, 128)
(1, -38, 4) (1, 0, 128)
(1, -36, 4) (1, 0, 128)
(1, -35, 4) (1, 0, 128)
(1, -34, 4) (1, 128, 128)
after while: (1, -4, 4)
what is wrong? why do I quit the loop when the encoder is not =0 and why after the while loop it seems that the motor is still turning?
speed = 5690,acc and decc = 4000,P=10,I=1,D=2
when I send use the serial command SpeedAccelDeccelPositionM1(self,address,accel,speed,deccel,position,buffer) in the following code:
Code: Select all
v = 5690
acc= 4000
#definition SpeedAccelDeccelPositionM1(self,address,accel,speed,deccel,position,buffer):
self.rc.SpeedAccelDeccelPositionM1(address,acc,v,acc,0,1)
buffers = self.rc.ReadBuffers(address)
while(buffers[1]!=0x80): #Loop until distance command has completed
enc1 = self.rc.ReadEncM1(address)
buffers = self.rc.ReadBuffers(address)
self.master.update_idletasks()
#time.sleep(0.2)
print(enc1,buffers)
time.sleep(0.2)
enc1 = self.rc.ReadEncM1(address)
print("after while:",enc1)
(1, -134, 3) (1, 0, 128)
(1, -134, 2) (1, 0, 128)
(1, -134, 2) (1, 0, 128)
(1, -134, 2) (1, 0, 128)
(1, -134, 2) (1, 0, 128)
(1, -134, 2) (1, 0, 128)
(1, -134, 2) (1, 0, 128)
(1, -134, 2) (1, 0, 128)
(1, -133, 4) (1, 0, 128)
(1, -133, 0) (1, 0, 128)
(1, -132, 4) (1, 0, 128)
(1, -132, 0) (1, 0, 128)
(1, -131, 4) (1, 0, 128)
(1, -131, 0) (1, 0, 128)
(1, -130, 4) (1, 0, 128)
(1, -130, 0) (1, 0, 128)
(1, -129, 4) (1, 0, 128)
(1, -128, 4) (1, 0, 128)
(1, -127, 4) (1, 0, 128)
(1, -126, 4) (1, 0, 128)
(1, -125, 4) (1, 0, 128)
(1, -123, 4) (1, 0, 128)
(1, -122, 4) (1, 0, 128)
(1, -121, 4) (1, 0, 128)
(1, -120, 4) (1, 0, 128)
(1, -118, 4) (1, 0, 128)
(1, -116, 4) (1, 0, 128)
(1, -114, 4) (1, 0, 128)
(1, -112, 4) (1, 0, 128)
(1, -111, 4) (1, 0, 128)
(1, -111, 0) (1, 0, 128)
(1, -108, 4) (1, 0, 128)
(1, -106, 4) (1, 0, 128)
(1, -105, 4) (1, 0, 128)
(1, -103, 4) (1, 0, 128)
(1, -101, 4) (1, 0, 128)
(1, -99, 4) (1, 0, 128)
(1, -96, 4) (1, 0, 128)
(1, -94, 4) (1, 0, 128)
(1, -91, 4) (1, 0, 128)
(1, -89, 4) (1, 0, 128)
(1, -85, 4) (1, 0, 128)
(1, -82, 4) (1, 0, 128)
(1, -78, 4) (1, 0, 128)
(1, -75, 4) (1, 0, 128)
(1, -71, 4) (1, 0, 128)
(1, -69, 4) (1, 0, 128)
(1, -66, 4) (1, 0, 128)
(1, -64, 4) (1, 0, 128)
(1, -62, 4) (1, 0, 128)
(1, -58, 4) (1, 0, 128)
(1, -56, 4) (1, 0, 128)
(1, -54, 4) (1, 0, 128)
(1, -52, 4) (1, 0, 128)
(1, -49, 4) (1, 0, 128)
(1, -47, 4) (1, 0, 128)
(1, -45, 4) (1, 0, 128)
(1, -43, 4) (1, 0, 128)
(1, -41, 4) (1, 0, 128)
(1, -39, 4) (1, 0, 128)
(1, -38, 4) (1, 0, 128)
(1, -36, 4) (1, 0, 128)
(1, -35, 4) (1, 0, 128)
(1, -34, 4) (1, 128, 128)
after while: (1, -4, 4)
what is wrong? why do I quit the loop when the encoder is not =0 and why after the while loop it seems that the motor is still turning?