close-circle
Close

Position loop example: setting angle in code

A project log for Mechaduino

Mechaduino is an affordable, open-source, industrial servo motor. Position, torque, velocity, and custom modes. Arduino compatible.

jcchurch 10/25/2016 at 23:181 Comment

Here's a quick example demonstrating how to change the setpoint of the position control loop:

This motion was implemented as shown below. "r" is our global setpoint variable. Since the control loop is implemented using interrupts, you don't really have to worry about it in your main loop once it is enabled!

Discussions

Simon Benoit wrote 10/29/2016 at 23:26 point

When my motor reach the setpoint, it overshoot and start being unstable. Do you have any quick fix for that ???

Is it something bad in the calibration or in the PID settings ?

  Are you sure? yes | no