Skip to main content

Tuning PID Gains on the NDrive Z1

· 4 min read

This guide walks you through a simple and practical way to tune the velocity and position gains on the NDrive Z1, helping you achieve clean and reliable motion in your application.

Introduction

The NDrive Z1 uses cascaded control loops to achieve smooth and accurate motion. The velocity loop controls how quickly the motor responds to commands, while the position loop ensures the motor reaches and holds the target position without overshoot or oscillation. Correct tuning of these gains is important for stable and predictable operation, especially when working with different loads or motion profiles.

This guide walks you through a simple and practical way to tune the velocity and position gains on the NDrive Z1, helping you achieve clean and reliable motion in your application.

If you are working with the NDrive Z1 for the first time, refer to Integrating the 5010 360 kV BLDC Motor with the NDrive Z1 blog for the required wiring, mounting, and initial configuration procedures before proceeding with the PID tuning steps in this guide.

  1. 1

    Set Velocity Integrator Gain to Zero:

    Before starting the tuning procedure, initialize the controller with a very small velocity gain ( 0.001 in this example) and set the velocity integrator gain to zero. Use the command setVelocityControllerGain(vel_gain,vel_integrator_gain). Starting with the integrator disabled helps keep the system stable while tuning.

  2. 2

    Monitoring Velocity Response During Tuning:

    Operate the driver in velocity control mode and plot the motor velocity to assess how the system responds as the gains are adjusted.

    Use plotter.plot(lambda:[Driver_10_ttyACM0.getOutputVelocity()[1]] command to plot the motor velocity and use Driver_10_ttyACM0.setVelocityControl(360*10) set velocity control.

    Note that the plotted velocity may differ from the commanded value at this stage because the control gains have not yet been tuned.

  3. 3

    Tune Velocity Gain (vel_gain):

    Gradually increase vel_gain by approximately 30% per iteration using: setVelocityControllerGains(vel_gain, 0)

    Continue increasing vel_gain until the motor begins to exhibit vibrations.

    Motor Exhibits Vibrations

    When vibration occurs, reduce vel_gain to 50 percent of the value at which vibrations first appeared. From there, increase the gain in smaller increments to approach a stable operating point.

    For the 5010 360 kV BLDC motor, the velocity gain is typically around 0.02, though the exact value depends on the load and mechanical setup.

  4. 4

    Monitoring Position Response (Position Control Mode):

    For position tuning, operate the driver in position control mode and plot the motor position to visualize tracking accuracy and stability.

    Use command plotter.plot(lambda:[Driver_10_ttyACM0.getOutputPosition()[1]]) to visualize the change in motor position.

    While tuning, move between different positions using setPositionControl(angle,degrees_per_seconds) command and check the for overshooting.

  5. 5

    Tune Position Gain (pos_gain):

    Start with a small position gain and increase it in increments of roughly 30% while observing motor behavior. Continue adjusting the gain until the motion becomes responsive, smooth, and well controlled without oscillation. Higher position gains improve tracking and help suppress load-induced motion, but setting the gain too high will reduce stability. Choose a value that provides stable, accurate, and smooth motion.

    Unstable Gain

    danger

    Avoid setting the position gain too high, as excessively large values can make the motor assembly unstable.

  6. 6

    Set Velocity Integrator Gain:

    After setting the velocity gain, configure the velocity integrator gain using the guideline vel_integrator = 10 × vel_gain .

    In position control mode, the position gain and velocity integrator gain influence each other and may need to be adjusted together to maintain stable operation. Fine-tune the integrator based on observed stability and settling behavior.

By following these steps, you can tune the NDrive Z1 gains to achieve stable and precise motion. Final values should be verified against actual motor behavior and adjusted as needed for your specific setup.

Nawe Robotics Logo  NMotionTM  is a sub-brand of Nawe Robotics
  Terms of Service  
  Privacy  
  Shipping  
  Return & Replacement  
Copyright © 2026 Nawe Robotics Private Limited