BIG devlog tonight! swerve drive kinematics code + some testing! today, I pulled through and did all the kinematics code for the swerve drive. it required using the offsets of the modules from the center, the drive joystick inputs, and the steer joystick inputs to calculate vector length and magnitude, then use those to derive a target angle and speed for each module, then speed is scaled down to fit the (0,4095) PWM range for my motors. the target angle is optimized to switch to a smaller rotation if the angle is above 90 degrees, then it is plugged into a PID loop that helps the steer motor achieve the angle. im super tired its like 6 am over here, so Im going to sleep. tomorrow I will have to replace an encoder that went bad on module two, and tune the PID loop. after that, this project will be complete, and I will begin the second half, which is pcb creation, and I will be documenting that on horizons as a seperate hardware project. :-)
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.