Low‑level motion engine for stepper‑driven SCARA joints.
More...
#include "joint_inputs.h"
#include "motors.h"
#include "pins.h"
#include "us_sensor.h"
#include "stm32f4xx_hal.h"
#include <math.h>
#include <stdbool.h>
Go to the source code of this file.
|
void | motorsEnable (void) |
| Enable outputs on both DRV8825 stepper motor drivers.
|
|
void | motorsDisable (void) |
| Disable outputs on both DRV8825 stepper motor drivers.
|
|
bool | motorsHome (void) |
| Actuates both stepper motors until robot links engage limit switches.
|
|
void | moveServoPulse (uint32_t us) |
| Actuates servo motor to move prismatic end effector.
|
|
void | newsendJointAngles (float theta1, float theta2, int curr_z) |
| Actuates Joint 1, Joint 2 and end effector to prescribed positions.
|
|
bool | motorsRunSplinePlan (const GCodeMove *plan, size_t n) |
| Implements Catmull-Rom spline pathing for given draw plan.
|
|
void | MOT_TIM3_IRQHandler (void) |
| Checks if steps_remaining == 0 for reach stepper motor. If steps_remaining == 0 for either stepper motor, stops timer channel to shut off actuation.
|
|
Low‑level motion engine for stepper‑driven SCARA joints.
- Date
- 2025-06-12
- Author
- Dylan Featherson, Tomas Franco, Charith Sunku
Definition in file motors.c.
◆ DIR2_EXTEND
#define DIR2_EXTEND GPIO_PIN_RESET |
◆ DIR2_RETRACT
#define DIR2_RETRACT GPIO_PIN_SET |
◆ DIR_TO_HOME1
#define DIR_TO_HOME1 GPIO_PIN_SET |
◆ DIR_TO_HOME2
#define DIR_TO_HOME2 GPIO_PIN_SET |
◆ DRAW_FREQ_HZ
#define DRAW_FREQ_HZ 2000U |
◆ DRAW_TIMEOUT_MS
#define DRAW_TIMEOUT_MS 3000U |
◆ EN_ACTIVE_HIGH
◆ HOMING_FREQ_HZ
#define HOMING_FREQ_HZ 4000U |
◆ HOMING_TIMEOUT_MS
#define HOMING_TIMEOUT_MS 3000U |
◆ JOINT2_ZERO_DEG
#define JOINT2_ZERO_DEG 0.00f |
◆ MAX_PLAN_POINTS
#define MAX_PLAN_POINTS 5000 /* hard ceiling on way‑points */ |
◆ MAX_Z_MM
◆ PEN_DOWN
◆ PEN_UP
◆ SPLINE_MAX_SUBDIV
#define SPLINE_MAX_SUBDIV 48 /* upper cap on subdivisions/segment */ |
◆ SPLINE_RES_DEG
#define SPLINE_RES_DEG 0.05f /* max ∆θ (deg) between samples */ |
◆ SPLINE_TENSION
#define SPLINE_TENSION 0.75f |
◆ STEPS_PER_DEG1
#define STEPS_PER_DEG1 (200.0f * 32.0f / 360.0f) |
◆ STEPS_PER_DEG2
#define STEPS_PER_DEG2 (200.0f * 32.0f / 360.0f) |
◆ SWITCH_DEBOUNCE_MS
#define SWITCH_DEBOUNCE_MS 5U |
◆ SWITCH_STABLE_CNT
#define SWITCH_STABLE_CNT 3U |
◆ TIM3_CLOCK_HZ
#define TIM3_CLOCK_HZ 1000000U |
◆ MOT_TIM3_IRQHandler()
void MOT_TIM3_IRQHandler |
( |
void | | ) |
|
Checks if steps_remaining == 0 for reach stepper motor. If steps_remaining == 0 for either stepper motor, stops timer channel to shut off actuation.
◆ motorsDisable()
void motorsDisable |
( |
void | | ) |
|
Disable outputs on both DRV8825 stepper motor drivers.
◆ motorsEnable()
void motorsEnable |
( |
void | | ) |
|
|
inline |
Enable outputs on both DRV8825 stepper motor drivers.
Referenced by motorsHome().
◆ motorsHome()
◆ motorsRunSplinePlan()
bool motorsRunSplinePlan |
( |
const GCodeMove * | plan, |
|
|
size_t | n ) |
Implements Catmull-Rom spline pathing for given draw plan.
- Parameters
-
plan | Array of joint anlges for full drawing |
n | Size of plan |
References newsendJointAngles().
◆ moveServoPulse()
void moveServoPulse |
( |
uint32_t | us | ) |
|
◆ newsendJointAngles()
void newsendJointAngles |
( |
float | theta1, |
|
|
float | theta2, |
|
|
int | curr_z ) |
Actuates Joint 1, Joint 2 and end effector to prescribed positions.
- Parameters
-
theta1 | Required joint angle for Joint 1 |
theta2 | Required joint angle for Joint 2 |
curr_z | Required z position of end effector |
References moveServoPulse().
Referenced by motorsRunSplinePlan().
◆ htim1
◆ htim3