UMRT Arm Firmware Library
Static Public Attributes | List of all members
MksTest.Constants Class Reference

Constants associated with MksTest.py. More...

Static Public Attributes

dictionary MAX_SPEED
 The maximum speed the driver can spin a motor, depending on the work mode. More...
 
int MAX_ACCEL = 255
 The maximum acceleration ramp a motor can use. More...
 

Detailed Description

Constants associated with MksTest.py.

Organised in a class to get Doxygen to generate links properly.

Member Data Documentation

◆ MAX_ACCEL

int MksTest.Constants.MAX_ACCEL = 255
static

The maximum acceleration ramp a motor can use.

When acceleration is set to 0, the motor instantaneously accelerates to the target speed.

When not set to 0, the current speed of the motor increases by 1 RPM per tick, and the acceleration value controls the time between ticks. Therefore, the speed of the motor is governed by:

\[ t_{next} - t_{now} = (256 - \alpha) * 50 [\mu s] \\ v_{next} = \begin{cases} v_{now} + 1, & v_{now} \le v_{target} \\ v_{now}, & v_{now} = v_{target} \\ v_{now} - 1, & v_{now} \gt v_{target} \end{cases} \]

For example, to reach \(v_{target}=5\) at \(\alpha=246\):

Time [ms] Speed [RPM]
0 0
0.5 1
1 2
1.5 3
2 4
2.5 5
3 5

◆ MAX_SPEED

dictionary MksTest.Constants.MAX_SPEED
static
Initial value:
= {
0x00: 400, # Open loop, pulse interface (CR_OPEN)
0x03: 400, # Open loop, serial interface (SR_OPEN)
0x01: 1500, # Closed loop, pulse interface (CR_CLOSE)
0x04: 1500, # Closed loop, serial interface (SR_CLOSE)
0x02: 3000, # Field oriented control, pulse interface (CR_vFOC)
0x05: 3000, # Field oriented control, serial interface (SR_vFOC)
}

The maximum speed the driver can spin a motor, depending on the work mode.

The values are nominally:

Work Mode Max Speed [RPM] Work Mode Description
CR_OPEN 400 Open loop, pulse interface
SR_OPEN 400 Open loop, serial interface
CR_CLOSE 1500 Closed loop, pulse interface
SR_CLOSE 1500 Closed loop, serial interface
CR_vFOC 3000 Field oriented control, pulse interface
SR_vFOC 3000 Field oriented control, serial interface

However, these values actually indicate the maximum step rate, computed under nominal conditions. If another microstepping mode is used, the maximum speed will be adjusted. Despite this, the motor speed cannot exceed 3000 RPM regardless of microstepping mode. TODO: Why?

For example, if using CR_OPEN at quarter-stepping, the maximum speed is 1600 RPM instead of 400 RPM.

Note that if a speed greater than one of these is used, the motor will instead spin at the applicable maximum.

TODO: It is not clear from the manual whether *_CLOSE and *_vFOC were computed using 16-microstepping, or perhaps 32- and 64-microstepping respectively.


The documentation for this class was generated from the following file: