4 Motors - Position / Velocity tracking

General discussion of using Roboclaw motor controllers
Post Reply
SimonRafferty
Posts: 7
Joined: Sun Sep 06, 2020 9:02 am
4 Motors - Position / Velocity tracking

Post by SimonRafferty »

I have a platform, lifted & lowered by 4 linear actuators (DC Servo Motor + Encoder + Limit Switches).

I'm using 2 x 15A Roboclaw Dual Channel controllers connected to an Arduino through Packet Serial.

I need all four to stay locked together, so the platform stays level.

I've tried closed loop Velocity - then setting the same velocity on each. Over short distances, they track OK but eventually they drift.

I can move to a position - but then they do not all move at the same velocity.

The only option that seems to work is a position move over a short distance, wait for all the motors to catch up (stop) then repeat. The trouble with that is it's slow - and jerky as the motors have to accelerate & decelerate for each step.

The best approach so far is to use PWM control & read all the encoders. If an encoder count is higher than the mean of the four, slow that motor down a bit. If lower, speed it up. It works fairly well at low speeds.

I guess I could implement a PID on the difference between the mean and actual - but I think the issue I'm running into is the Serial speed - and the delay between reading an encoder and the speed changing, leading to oscillation.

Is there a way to lock two or ideally four motors together so they track position / velocity?

I'm using bi-directional limit switches - and detecting when all four motors have stopped moving to zero the encoder counts. I've tried to find a way to read the state of the limit switches (S4 & S5) - but the values returned do not always match the switch state. Is there a better way?
User avatar
Basicmicro Support
Posts: 1594
Joined: Thu Feb 26, 2015 9:45 pm
Re: 4 Motors - Position / Velocity tracking

Post by Basicmicro Support »

Tune your speed PID with a higher I value. I(integral) is what compensates for speed error over time. The higher this is the more accurate the average speed will be and it is that average speed that is determining if your motors are staying synced up or not. Setting too high an I however can cause oscilations/vibrations so you have to play with the setting until you get something that works well.

I assume you are using a PIV tuning setup for position control(cascaded Velocity and Position tuning).

With a proper Velocity I setting, position commands should stay synced through a full movement accurately enough to prevent binding. The position command itself already breaks its movements up into intervals of 1/300th of a second. It calculates where the motor should be at any give moment and uses an appropriate speed to get to that position based on the current actual position every 1/300th of a second. As long as your tuning is tight all motors should be within a very small margin of each other.
SimonRafferty
Posts: 7
Joined: Sun Sep 06, 2020 9:02 am
Re: 4 Motors - Position / Velocity tracking

Post by SimonRafferty »

Thanks. I was gradually coming to that conclusion.
I started with the Auto-Tune result - and gradually increased the I term until it was very close. Close enough.

The 3mS calculation / movement interval is interesting - may be useful one day!

Si

Post Reply