Safe stop and mode switching

3 years 3 months ago #29532922 by maple
I am trying to find a safe procedure for stopping/starting motors in Position Relative mode. The requirements:
- stop must be fast but not abrupt, i.e. with controlled deceleration;
- motors must not move while stopped;
- re-activation of the position tracking should not produce motor movement until next positioning command received;

First I tried _MS command. It does stop movement, then it writes actual position into command register. While visually this presents an appearance of stopped motors in fact the controller keeps tracking, so there are some tiny movements and power still applied to motors. This breaks requirement #2. Also I could not figure out how to control deceleration. Calling _DC in advance seems to affect the stopping distance but nowhere close to expected. For example, reducing _DC by magnitude of 100 only increased stopping distance by 5-10%.

Next I tried switching mode to Open Loop. This makes controlled deceleration possible, however switching between modes changes the meaning of current motor command, which produces spikes in motor power. Since I cannot change _MMOD and _G at the same time it breaks requirement #3.

Just for the sake of completeness I've tried _EX. Even though _MS is said to work "similar but for individual motors" in fact _EX is completely different - it does cut power to motors and it allows me to pre-set _G to current position before re-activating position tracking. So, there is no movement in deactivated state (#2) and there are no sudden movements when going back to active state (#3). Unfortunately the stopping itself is almost instantaneous (well, Emergency Stop is supposed to be), which breaks requirement #1.

Any suggestions on how to implement these Start/Stop procedures?

Please Log in or Create an account to join the conversation.

3 years 3 months ago #29532923 by maple
Replied by maple on topic Safe stop and mode switching
Here is what I have right now and it seems to be working. Not sure if this is the best way to do things. Only one channel shown.
StopTracking:
setcommand(_DC, 2, 300000)      ' change deceleration to stopping rate
setconfig(_MMOD, 2, 0)      ' open-loop mode
setcommand(_G, 2, 0)     ' send stop command
do while getValue(_P, 2) <> 0     ' wait for applied motor power to drop to 0
loop
setcommand(_EX, 1)	' emergency stop (both motors)
return

ResumeTracking:
setcommand(_DC, 2, 200000)     ' change deceleration back to normal
setconfig(_MMOD, 2, 2)	' closed-loop position relative
setcommand(_G, 2, getValue(_F, 2))     ' set target position to current position
setcommand(_MG, 1)	' release emergency stop (both motors)
return

Please Log in or Create an account to join the conversation.

3 years 3 months ago #29532929 by niko
Replied by niko on topic Safe stop and mode switching
Do MS and when it stops do EX.

Please Log in or Create an account to join the conversation.

3 years 3 months ago #29532930 by maple
Replied by maple on topic Safe stop and mode switching
hi niko,

please, read my post re !MS. It does NOT cut power to motors in position mode. It simply fixes the command. Power applied to motors fluctuates around 0 because ADC on analog inputs is not precise, it fluctuates around current positions. There is simply no way to find a moment when both motors receiving exactly 0 power simultaneously so I can use !EX.

This is a problem with MS implementation. It is said to work "similar to EX" but it does not.

Please Log in or Create an account to join the conversation.

Time to create page: 0.114 seconds