SpeedAccelDeccelPositionM1
-
- Posts: 37
- Joined: Wed Jul 31, 2019 7:24 am
SpeedAccelDeccelPositionM1
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?
- Attachments
-
- Unbenannt.PNG (35.07 KiB) Viewed 17666 times
- Basicmicro Support
- Posts: 1594
- Joined: Thu Feb 26, 2015 9:45 pm
Re: SpeedAccelDeccelPositionM1
Instead of assuming perfect speed and position control(not possible in the real world), the position system on our controllers breaks the complete movement down into chunks 1/300th of a second in duration. Each interpolated movement is moved to(or attempted to move to). So at the end of all the interpolated movements if the motor isn't at the target position, the command is still considered finished. The motor, of course will still be trying to get to that position if it isnt at the target but it is not guaranteed the motor will BE at that position.