Skip to content

File syn_scurve.h

FileList > src > syntropic > util > syn_scurve.h

Go to the source code of this file

Jerk-limited S-curve trajectory generator. More...

  • #include "../common/syn_defs.h"
  • #include <stdbool.h>
  • #include <stdint.h>

Classes

Type Name
struct SYN_SCurve
S-curve trajectory generator state.
struct SYN_SCurve3D
Synchronized 3D S-Curve trajectory generator.

Public Functions

Type Name
void syn_scurve3d_plan (SYN_SCurve3D * sc3d, int32_t start_x, int32_t start_y, int32_t start_z, int32_t target_x, int32_t target_y, int32_t target_z, int32_t v_max, int32_t a_max, int32_t j_max)
Initialize and plan a synchronized 3D vector move.
bool syn_scurve3d_update (SYN_SCurve3D * sc3d, int32_t * out_x, int32_t * out_y, int32_t * out_z)
Step 3D synchronized S-Curve profile by one tick.
void syn_scurve_init (SYN_SCurve * sc, int32_t initial_p)
Initialize the S-Curve generator.
void syn_scurve_set_constraints (SYN_SCurve * sc, int32_t v_max, int32_t a_max, int32_t j_max)
Configure the kinematic constraints.
void syn_scurve_set_target (SYN_SCurve * sc, int32_t target)
Set a new target position.
int32_t syn_scurve_update (SYN_SCurve * sc)
Update the trajectory generator by one time step (tick).

Public Static Functions

Type Name
int32_t syn_scurve_acceleration (const SYN_SCurve * sc)
Get current acceleration.
bool syn_scurve_done (const SYN_SCurve * sc)
Check if trajectory is complete.
int32_t syn_scurve_position (const SYN_SCurve * sc)
Get current position.
int32_t syn_scurve_velocity (const SYN_SCurve * sc)
Get current velocity.

Detailed Description

Generates smooth motion profiles by bounding velocity, acceleration, and jerk. Ideal for stepper motors and servo positioning.

Public Functions Documentation

function syn_scurve3d_plan

Initialize and plan a synchronized 3D vector move.

void syn_scurve3d_plan (
    SYN_SCurve3D * sc3d,
    int32_t start_x,
    int32_t start_y,
    int32_t start_z,
    int32_t target_x,
    int32_t target_y,
    int32_t target_z,
    int32_t v_max,
    int32_t a_max,
    int32_t j_max
) 

Parameters:

  • sc3d 3D profile pointer.
  • start_x Starting X coordinate.
  • start_y Starting Y coordinate.
  • start_z Starting Z coordinate.
  • target_x Target X coordinate.
  • target_y Target Y coordinate.
  • target_z Target Z coordinate.
  • v_max Vector max velocity.
  • a_max Vector max acceleration.
  • j_max Vector max jerk.

function syn_scurve3d_update

Step 3D synchronized S-Curve profile by one tick.

bool syn_scurve3d_update (
    SYN_SCurve3D * sc3d,
    int32_t * out_x,
    int32_t * out_y,
    int32_t * out_z
) 

Parameters:

  • sc3d 3D profile pointer.
  • out_x Out: Current X coordinate.
  • out_y Out: Current Y coordinate.
  • out_z Out: Current Z coordinate.

Returns:

true if move active, false if completed.


function syn_scurve_init

Initialize the S-Curve generator.

void syn_scurve_init (
    SYN_SCurve * sc,
    int32_t initial_p
) 

Parameters:

  • sc Pointer to generator.
  • initial_p Initial position.

function syn_scurve_set_constraints

Configure the kinematic constraints.

void syn_scurve_set_constraints (
    SYN_SCurve * sc,
    int32_t v_max,
    int32_t a_max,
    int32_t j_max
) 

Parameters:

  • sc Pointer to generator.
  • v_max Maximum velocity (units/tick).
  • a_max Maximum acceleration (units/tick^2).
  • j_max Maximum jerk (units/tick^3).

function syn_scurve_set_target

Set a new target position.

void syn_scurve_set_target (
    SYN_SCurve * sc,
    int32_t target
) 

Parameters:

  • sc Pointer to generator.
  • target Target position.

function syn_scurve_update

Update the trajectory generator by one time step (tick).

int32_t syn_scurve_update (
    SYN_SCurve * sc
) 

Parameters:

  • sc Pointer to generator.

Returns:

Current position.


Public Static Functions Documentation

function syn_scurve_acceleration

Get current acceleration.

static inline int32_t syn_scurve_acceleration (
    const SYN_SCurve * sc
) 

Parameters:

  • sc S-curve instance.

Returns:

Current acceleration value.


function syn_scurve_done

Check if trajectory is complete.

static inline bool syn_scurve_done (
    const SYN_SCurve * sc
) 

Parameters:

  • sc S-curve instance.

Returns:

true if target reached.


function syn_scurve_position

Get current position.

static inline int32_t syn_scurve_position (
    const SYN_SCurve * sc
) 

Parameters:

  • sc S-curve instance.

Returns:

Current position value.


function syn_scurve_velocity

Get current velocity.

static inline int32_t syn_scurve_velocity (
    const SYN_SCurve * sc
) 

Parameters:

  • sc S-curve instance.

Returns:

Current velocity value.



The documentation for this class was generated from the following file src/syntropic/util/syn_scurve.h