Skip to content

File syn_interpolator.h

FileList > motor > syn_interpolator.h

Go to the source code of this file

Coordinated multi-axis linear & circular arc trajectory interpolator. More...

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

Classes

Type Name
struct SYN_Interpolator
Multi-Axis Interpolator configuration and state machine.
struct SYN_Vector3F
3D Vector position in steps or user units

Public Types

Type Name
enum SYN_Interp_Mode
Interpolation mode enum.

Public Functions

Type Name
bool syn_interpolator_eval_at_time (SYN_Interpolator * interp, float t_sec, SYN_Vector3F * out_pos, SYN_Vector3F * out_vel)
Evaluate the interpolator at a specific time offset t seconds.
void syn_interpolator_init (SYN_Interpolator * interp)
Initialize a Multi-Axis Interpolator.
SYN_Status syn_interpolator_plan_bezier (SYN_Interpolator * interp, SYN_Vector3F p0, SYN_Vector3F p1, SYN_Vector3F p2, SYN_Vector3F p3, float feedrate, float max_accel, float max_jerk, float step_res)
Plan a Cubic 3D Bezier curve trajectory.
SYN_Status syn_interpolator_plan_circular (SYN_Interpolator * interp, SYN_Vector3F start, SYN_Vector3F target, SYN_Vector3F center_offset, bool is_cw, float feedrate, float max_accel, float max_jerk, float step_res)
Plan a Circular 2D arc move in XY plane.
SYN_Status syn_interpolator_plan_linear (SYN_Interpolator * interp, SYN_Vector3F start, SYN_Vector3F target, float feedrate, float max_accel, float max_jerk, float step_res)
Plan a Linear 2D/3D motion move.
bool syn_interpolator_step (SYN_Interpolator * interp, SYN_Vector3F * out_pos)
Advance the interpolator by one discrete step.

Detailed Description

Provides zero-allocation, fixed-step multi-axis DDA (Digital Differential Analyzer) vector trajectory generation for coordinated motion control across 2D/3D linear segments and 2D circular arcs.

Public Types Documentation

enum SYN_Interp_Mode

Interpolation mode enum.

enum SYN_Interp_Mode {
    SYN_INTERP_MODE_IDLE = 0,
    SYN_INTERP_MODE_LINEAR,
    SYN_INTERP_MODE_CIRCULAR_CW,
    SYN_INTERP_MODE_CIRCULAR_CCW
};


Public Functions Documentation

function syn_interpolator_eval_at_time

Evaluate the interpolator at a specific time offset t seconds.

bool syn_interpolator_eval_at_time (
    SYN_Interpolator * interp,
    float t_sec,
    SYN_Vector3F * out_pos,
    SYN_Vector3F * out_vel
) 

Parameters:

  • interp Pointer to interpolator struct.
  • t_sec Time offset from start of move in seconds.
  • out_pos Out: Position vector at time t.
  • out_vel Out: Velocity vector at time t (optional, can be NULL).

Returns:

true if t <= move total time.


function syn_interpolator_init

Initialize a Multi-Axis Interpolator.

void syn_interpolator_init (
    SYN_Interpolator * interp
) 

Parameters:

  • interp Pointer to interpolator struct.

function syn_interpolator_plan_bezier

Plan a Cubic 3D Bezier curve trajectory.

SYN_Status syn_interpolator_plan_bezier (
    SYN_Interpolator * interp,
    SYN_Vector3F p0,
    SYN_Vector3F p1,
    SYN_Vector3F p2,
    SYN_Vector3F p3,
    float feedrate,
    float max_accel,
    float max_jerk,
    float step_res
) 

Parameters:

  • interp Pointer to interpolator struct.
  • p0 Start point P0.
  • p1 Control point P1.
  • p2 Control point P2.
  • p3 End point P3.
  • feedrate Desired tangential speed (units/sec).
  • max_accel Max acceleration (units/sec^2).
  • max_jerk Max jerk (units/sec^3).
  • step_res Spatial resolution per step.

Returns:

SYN_OK on success.


function syn_interpolator_plan_circular

Plan a Circular 2D arc move in XY plane.

SYN_Status syn_interpolator_plan_circular (
    SYN_Interpolator * interp,
    SYN_Vector3F start,
    SYN_Vector3F target,
    SYN_Vector3F center_offset,
    bool is_cw,
    float feedrate,
    float max_accel,
    float max_jerk,
    float step_res
) 

Parameters:

  • interp Pointer to interpolator struct.
  • start Start position (X, Y).
  • target Target position (X, Y).
  • center_offset Center offset relative to start (I = center.x - start.x, J = center.y - start.y).
  • is_cw true for Clockwise, false for Counter-Clockwise.
  • feedrate Desired tangential speed (units/sec).
  • max_accel Max acceleration (units/sec^2).
  • max_jerk Max jerk (units/sec^3).
  • step_res Spatial resolution per step (units per step).

Returns:

SYN_OK on success.


function syn_interpolator_plan_linear

Plan a Linear 2D/3D motion move.

SYN_Status syn_interpolator_plan_linear (
    SYN_Interpolator * interp,
    SYN_Vector3F start,
    SYN_Vector3F target,
    float feedrate,
    float max_accel,
    float max_jerk,
    float step_res
) 

Parameters:

  • interp Pointer to interpolator struct.
  • start Start position (X, Y, Z).
  • target Target position (X, Y, Z).
  • feedrate Desired vector velocity (units/sec).
  • max_accel Max acceleration (units/sec^2).
  • max_jerk Max jerk (units/sec^3).
  • step_res Spatial resolution per step (units per step, e.g. 0.001mm).

Returns:

SYN_OK on success.


function syn_interpolator_step

Advance the interpolator by one discrete step.

bool syn_interpolator_step (
    SYN_Interpolator * interp,
    SYN_Vector3F * out_pos
) 

Parameters:

  • interp Pointer to interpolator struct.
  • out_pos Out: Calculated position after step.

Returns:

true if move active and advanced, false if move complete.



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