Close

Stepper motor execution playbook: Concept

A project log for Building the Thor robot

Building a 6-axis robot based on the Thor robot. When size DOES matter!

olaf-baeyensOlaf Baeyens 01/22/2017 at 21:560 Comments

Finally started with the main core of the Thor robot software development.

We have 3 parts.

  1. Stepper motor execution playbook
  2. Code that generates the stepper motor execution playbook.
  3. UI and external control.

We only focus here on the first part in the software design: The Stepper motor execution playbook.

It will consist of a FIFO buffer that only contains the bytes to execute the 7 stepper motors defines for each bit 'step'. That will be driven by a Timer 1 interrupt.


The execution will be a fixed execution rate. The speed of the motors will be controlled by modulating the 1 and 0 step commands. This way we get different speeds for each motor independently.


Because each movement only contains stepper motor next step bits, we do not need to set the enable or direction over and over again. We only set it once when we start to execute the stepper bits and keep the same enabled and direction. The cool thing about this is that we can also describe curves acceleration and deceleration.


Memory is limited and we want to use the CPU as much as possible for calculating the FIFO playbook, we will pre-define a fixed memory block. Moving bytes in memory is very costly in CPU cycles. So we only move pointers.


We want agile responses to changing events so we will create smaller FIFO buffers that can be disregarded instantly and swapped by a new execution FIFO buffer.

To prevent memory fragmentation we used fixed size segmented FIFO buffers.


These are concepts-only at this moment. We must also add mechanisms for safety and discovery when the stepper motors gets fed bad data.

To be continued....

Discussions