Skip to content

File syn_interpolator.c

FileList > motor > syn_interpolator.c

Go to the source code of this file

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

  • #include "../util/syn_assert.h"
  • #include "syn_interpolator.h"
  • #include <math.h>
  • #include <string.h>

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.

Macros

Type Name
define M_PI 3.14159265358979323846

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.


Macro Definition Documentation

define M_PI

#define M_PI `3.14159265358979323846`


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