I have been working on implementing a PID motor controller for two DC motors. to keep things short the teensy interfaces over serial 3 with a Sabertooth motor driver and on digital pins with two optical quadrature encoders.
I am certain that I am not using the best technique for decoding the encoders but what I have has been working fine.
Before implementing the control I would like to implement an EKF but the code I have written (which works fine on my windows computer) crashes after about 7 seconds on the teensy.
I know that the issue must be something to do with the KalmanFilters.h or the Matrix.h file I recently added since all the code was previously working without crashing.
I know very little about embedded systems and I was wondering if someone could take a look at my class constructors and destructors in the Matrix.h file to see if there is anything that obviously won't work on the teensy.
To be clear
-I am using a teensy 3.2
-sabertooth rx is connected to pin 8 (teensy TX3)
-quadrature encoders interface on pins 10,11,12 and 14,15,16
I don't think there is any wiring / hardware issue as I have been able to command the sabertooth to constant power and then acquire encoder data.
Also I have been able to use the PID controller class with out the teensy crashing.
thanks!
View attachment KalmanFilters.hView attachment Matrix.hView attachment motor_controller.inoView attachment PID_Cont.cppView attachment PID_Cont.h
I am certain that I am not using the best technique for decoding the encoders but what I have has been working fine.
Before implementing the control I would like to implement an EKF but the code I have written (which works fine on my windows computer) crashes after about 7 seconds on the teensy.
I know that the issue must be something to do with the KalmanFilters.h or the Matrix.h file I recently added since all the code was previously working without crashing.
I know very little about embedded systems and I was wondering if someone could take a look at my class constructors and destructors in the Matrix.h file to see if there is anything that obviously won't work on the teensy.
To be clear
-I am using a teensy 3.2
-sabertooth rx is connected to pin 8 (teensy TX3)
-quadrature encoders interface on pins 10,11,12 and 14,15,16
I don't think there is any wiring / hardware issue as I have been able to command the sabertooth to constant power and then acquire encoder data.
Also I have been able to use the PID controller class with out the teensy crashing.
thanks!
View attachment KalmanFilters.hView attachment Matrix.hView attachment motor_controller.inoView attachment PID_Cont.cppView attachment PID_Cont.h
Last edited: