Close

Program Loop Timing Issues 15.03.2019

A project log for "Straddle Crane" Self-Balancing Robot

I am aiming to create a new self-balancing robot that can drive around an object, pick it up, carry it and offload it.

Ben PetersBen Peters 03/24/2019 at 14:130 Comments

I had noticed that the accelerometer had a strange offset in addition to the gyro drift I had encountered. Therefore, I conducted some more rigorous tests to look at the signal to assess the gyro drift and the accelerometer readings simultaneously. The testing method was as follows:

With the code set to record the accelerometer angle, gyro angle & overall pitch angle...

1)  Undisturbed testing...

2)  Disturbed testing...

See the below data for the accelerometer angle...

Undisturbed data:

Disturbed data:

Observations:

Further experimentation to verify the above:

I made the MPL time period a variable and increased it from 4ms to 7ms and the result was as follows:

I subtracted the mean from the above data and took more readings:

As a result of the above changes, the robot needed some more PID tuning (MPL period resulted in new gain values needed), but looked very promising in terms of stability.


Because I am coming to the end of my project timescale, I decided to move on to the mechanical design of the crane system despite the remaining balancing perfromance issues. The robot works well enough for proof of concept.

Discussions