Zubax Myxa with T-Motor MN5212 KV340 problem

Hi all,

I’m integrating PX4 with Zubax Myxa via Cyphal interface, using the T-Motor MN5212 KV340 motors.

When I using GQC to test a motor, other motors will keep spinup and then stop continuously even the torque value is 0 (readiness = 3). I assume that whenever the readines value is equal to 3, we will face this issue.

Do we have any option to disable this behavior?

Here is my config (I have used the MotorID service to get the motor params as well, but still the same issue):

uavcan.node.id:                             122
# Motor parameters. The motor used here is T-Motor MN5212 KV340. MN5212 IP35 Navigator Type UAV Multi-Motor KV340
# Spinup configuration
drive.runner.0_ramp.spinup_current_pu:      [0.3, 0.3]
drive.runner.0_ramp.spinup_duration:        [0.1, 0.3, 0.7, 0.002, 0.015, 0.6]
drive.runner.0_ramp.velocity_stall_spinup:  [5, 40]
drive.runner.1_passive.delay:               0.2
drive.runner.1_passive.velocity_off_on:     [5, 10]
drive.runner.type:                          0
# Motor model
motor.current_ctl_bwr:                      0.0452
motor.current_max:                          35
motor.current_ramp:                         5000
motor.flux_linkage:                         0.001641
motor.inductance_dq:                        [4.74e-06, 4.74e-06]
motor.resistance:                           0.0112
motor.mechanical_ratio:                     11
# vsi
vsi.phase_current_stderr:                   [0.3, 0.3, 0.2, 0.2]
vsi.phase_current_gain:                     [100, 100, 25, 25]
# Cyphal/CAN parameters.
uavcan.can.count:                           1             # In this setup we are not using CAN2.
# Cyphal ports.
uavcan.sub.setpoint_rat_torque.id:          111
uavcan.sub.readiness.id:                    112
uavcan.pub.dq.id:                           1001
uavcan.pub.dynamics.id:                     1002
uavcan.pub.power.id:                        1003
uavcan.pub.temperature.id:                  1004
# General parameters.
mns.setpoint_index:                         0
mns.status_period:                          1
mns.deadman_timeout:                        1             # 1 sec
sys.debug:                                  false         # Debug interfaces shall be disabled in production use.

Indeed. Motors spin up because they receive a command message (the magnitude of the command is irrelevant because zero or negative torque can occur during normal operation). They stop briefly afterward because the commanded torque is not sufficient to maintain sensorless operation. The cycle continues as long as the command is published.

You can address this in multiple ways:

  • Control each motor via a separate Cyphal topic.
  • Publish a higher torque command during testing to ensure motors don’t stall.
  • Set mns.ratiometric_setpoint_min to some low value (e.g., 0.05) to ensure motors don’t stall. This will interfere with the control, however, because torque setpoints that fall into [-0.05, 0.05] (or other values depending on your configuration) will be clipped to zero.

But I think the first way is unsuitable if we use the PX4:

  • Control each motor via a separate Cyphal topic → We need to change the PX4 code to send a separate topic for readiness to control each motor. Then we need at least 5 topics to control 4 motors.

The last two ways will lead the motor to spin up with a minimum speed even if the torque setpoint is 0. Do we have any option to stall the motor when the torque setpoint is 0 and the readiness = 3?

And one more question, with my setting whenever the torque setpoint value is higher than 0.1 (from 0.1 to 1.0), the l motor will spin at 100% speed. I expect the motor should spin at 10% speed when the torque setpoint is 0.1, is this right? Do you have any suggestions to fix this?

No, because it doesn’t make sense. A torque setpoint of zero doesn’t mean that the motor should stop, it just means that the torque should be zero.

This is the expected behavior. You command a 10% torque, the controller applies 10% torque. In the absence of load, this will cause the motor to accelerate indefinitely until the maximum speed is reached. If you would like it to stop accelerating, you need to reduce the torque. The acceleration equation is a = \frac{T - Q}{J}, with applied torque T, load torque Q, and the moment of inertia of the load J. This is also covered in the reference manual:

This is not how torque works. Consider using the velocity control mode instead.