motor pole pair count in config

This commit is contained in:
0x23 2025-09-02 08:21:57 +02:00
parent b4c1c9d9d1
commit e3627cc8e8
4 changed files with 13 additions and 5 deletions

View file

@ -1,3 +1,10 @@
// motor pole pair count
// * 100 for 0.9deg stepper motors
// * 50 for 1.8deg stepper motors
#define MOTOR1_POLE_PAIRS 100
#define MOTOR2_POLE_PAIRS 100
#define MOTOR3_POLE_PAIRS 100
// #define SINGLE_AXIS_BOARD
#ifdef SINGLE_AXIS_BOARD
// Single Axis Board
@ -31,7 +38,7 @@
#define PIN_ENCODER_MOSI 3
#else
// 3Axis Board
// Pins for 3Axis Board
#define PIN_BUILTIN_LED 23
#define PIN_USER_BUTTON 24

View file

@ -37,7 +37,7 @@ KinematicModel_Delta3D::KinematicModel_Delta3D() {
ee_attachment_points[2] = Vec3F(-15.0f, 1.5f, 0.5f);
*/
// set transfomration based on CAD model
// set transformation based on CAD model
actuator_to_base[0].rotation = QuaternionF::from_axis_angle(Vec3F(0.0f, 0.0f, 1.0f), 90.0f*D2R);
actuator_to_base[0].translation = Vec3F(-42.0f, 0.5f, 32.0f)+base_offset;

View file

@ -123,7 +123,7 @@ void Robot::init() {
PIN_MOTOR_EN, PIN_M1_PWM_A_POS, PIN_M1_PWM_A_NEG, PIN_MOTOR_PWMAB,
PIN_MOTOR_EN, PIN_M1_PWM_B_POS, PIN_M1_PWM_B_NEG, PIN_MOTOR_PWMAB
);
joints[0] = new RobotJoint(encoder, motor_driver, 400/4);
joints[0] = new RobotJoint(encoder, motor_driver, MOTOR1_POLE_PAIRS);
}
// axis 2
@ -133,7 +133,7 @@ void Robot::init() {
PIN_MOTOR_EN, PIN_M2_PWM_A_POS, PIN_M2_PWM_A_NEG, PIN_MOTOR_PWMAB,
PIN_MOTOR_EN, PIN_M2_PWM_B_POS, PIN_M2_PWM_B_NEG, PIN_MOTOR_PWMAB
);
joints[1] = new RobotJoint(encoder, motor_driver, 400/4);
joints[1] = new RobotJoint(encoder, motor_driver, MOTOR2_POLE_PAIRS);
}
// axis 3
@ -143,7 +143,7 @@ void Robot::init() {
PIN_MOTOR_EN, PIN_M3_PWM_A_POS, PIN_M3_PWM_A_NEG, PIN_MOTOR_PWMAB,
PIN_MOTOR_EN, PIN_M3_PWM_B_POS, PIN_M3_PWM_B_NEG, PIN_MOTOR_PWMAB
);
joints[2] = new RobotJoint(encoder, motor_driver, 400/4);
joints[2] = new RobotJoint(encoder, motor_driver, MOTOR3_POLE_PAIRS);
}
// initialize axes

View file

@ -102,6 +102,7 @@ class Robot : public ICommandProcessor {
uint32_t path_buffering_time_us;
uint64_t path_buffering_start_time;
int motor_pole_pairs;
RobotJoint* volatile joints[NUM_JOINTS];
IKinemtaicModel* kinematic_model;