Skip to content

Instantly share code, notes, and snippets.

#include <iostream>
#include <omp.h>
#include "tbb/task_scheduler_init.h"
#include "tbb/blocked_range.h"
#include "tbb/parallel_for.h"
using namespace std;
using namespace tbb;
void L_matrix(int ** A, int n, int * B, int * C)
@agalakhov
agalakhov / s-curve.md
Last active August 15, 2024 02:33
On S-Curve aceleration of stepper and servo motors

On S-Curve aceleration of stepper and servo motors

Alexey Galakhov, 2024

Abstract

We present an algorithm for interpolation S-curve jerk limited acceleration. Our algorithm can be implemeted as integer-only using ARM Cortex M4 vector instructions with only a few instructions per step, thus theoretically capable of generating 100s kHz of steps for multiple axes on a regular Cortex M4. The steps generated are always accurate, there is no error accumulation over time.

Introduction

Most of stepper motor controller designs for 3d Printers and small CNC milling machines use STEP-DIR-based driving with steps generated in software. While cruise moves require just uniform step generation, acceleration and decceleration are much more complex due to their speed profiles.

The state-of-art acceleration (and decceleration) nowadays consider maximal velocity, acceleration and jerk (the first derivative of acceleration over time) in order to make movements as smooth as possible. Jerk-limited control is known to