Stepdance Software Library
Loading...
Searching...
No Matches
KinematicsCoreXY Class Reference

KinematicsCoreXY implements coreXY kinematics transformation. More...

#include <kinematics.hpp>

Inheritance diagram for KinematicsCoreXY:

Public Member Functions

void begin ()
 Initializes the KinematicsCoreXY. This must be called before using the kinematics.
void push_deep () override
void pull_deep () override

Public Attributes

BlockPort input_x
 Input BlockPort for X axis motion. Map upstream components to this port.
BlockPort input_y
 Input BlockPort for Y axis motion. Map upstream components to this port.
BlockPort output_a
 Output BlockPort for A motor motion. Map downstream components to this port.
BlockPort output_b
 Output BlockPort for B motor motion. Map downstream components to this port.

Protected Member Functions

void run ()

Detailed Description

KinematicsCoreXY implements coreXY kinematics transformation.

The KinematicsCoreXY class converts Cartesian X and Y motion inputs into CoreXY A and B motor outputs. This is useful for controlling CoreXY mechanisms commonly used in 3D printers, plotters and other CNC machines. Here's an example of how to instantiate and configure a KinematicsCoreXY:

#define module_driver
#include "stepdance.hpp"
Encoder enc_1;
Encoder enc_2;
KinematicsCoreXY corexy_kinematics;
Channel channel_a;
Channel channel_b;
OutputPort output_a;
OutputPort output_b;
void setup(){
// Initialize OutputPorts and enable drivers
output_a.begin(OUTPUT_A);
output_b.begin(OUTPUT_B);
enable_drivers();
// Initialize Channels
channel_a.begin(&output_a, SIGNAL_E);
channel_b.begin(&output_b, SIGNAL_E);
// Initialize Encoders
enc_1.begin(ENCODER_1);
enc_1.set_ratio(24, 2400); // 24mm per revolution, where 1 rev == 2400 encoder pulses
enc_2.begin(ENCODER_2);
enc_2.set_ratio(24, 2400); // 24mm per revolution, where 1 rev == 2400 encoder pulses
// Map Encoder outputs to KinematicsCoreXY inputs
enc_1.output.map(corexy_kinematics.input_x);
enc_2.output.map(corexy_kinematics.input_y);
// Initialize KinematicsCoreXY and map to channels
corexy_kinematics.begin();
corexy_kinematics.output_x.map(channel_a.input_target_position);
corexy_kinematics.output_y.map(channel_b.input_target_position);
dance_start();
}
void loop(){
dance_loop();
}

The documentation for this class was generated from the following file: