Yas! I'm looking forward to this. Seems I've missed quite a few posts, those rockets and the calibration look solid! How did you verify the rockets fly straight slash make sure the offsets are correct?
Right now, I have a version of the code that seems it will work just fine, but it doesn't use PID tuning (it uses my existing code but maps the angle of the servos to a much smaller range).
When I tried using the arduino PID library, I made a PID object with an input of the angle tilt in degrees, a setpoint angle of 90 degrees, and Kp of 0, Ki of 10, and Kd of 0.
What ends up happening is that the fins will move ALL the way over to the left or right when I tilt the body. If I wiggle it back and forth, the fins will "appear" to work, but when I stop moving it, instead of pointing straight up, the fins will continue on their merry way to the side they were approaching.
Also, the servo movement is very jumpy.
Were you able to figure out the correct PID gains for your controller? Generally, you will want to start with Kp>0, Ki=0 and Kd=0, then add in Kd and Ki as necessary to achieve your desired response. This will probably be difficult to do without a good system model, but I would highly recommend revisiting your controller setup. What you have described will lead to instability as the controller repeatedly overshoots the setpoint because the integral of error over time is lagging behind the current state.
Yas! I'm looking forward to this. Seems I've missed quite a few posts, those rockets and the calibration look solid! How did you verify the rockets fly straight slash make sure the offsets are correct?
As for the offsets, I use a tried and true method of grabbing 200 samples from all axes at startup, sorting them least to greatest, and then taking the median (NOT mean). This is my base offset.
The final code will actually use the offset Z axis for the calculations, not a live calculation because I found out that the high G's during launch will skew the math and cause the rocket to snap into the ground.
jonbush wrote:
Were you able to figure out the correct PID gains for your controller? Generally, you will want to start with Kp>0, Ki=0 and Kd=0, then add in Kd and Ki as necessary to achieve your desired response. This will probably be difficult to do without a good system model, but I would highly recommend revisiting your controller setup. What you have described will lead to instability as the controller repeatedly overshoots the setpoint because the integral of error over time is lagging behind the current state.
I'll try doing the PID tuning again in a day or two (school stuff came up). The issue isn't exactly the nature of the PID, its actually "Okay, I have the PID loop, now how do I use this resultant number to drive the servos". They constantly slam to the right because I don't know how the math worked out in the end and I was pretty tired at that point.
No, I did not end up launching the rocket last fall. There was just too much to tune and not enough time before the temperatures dropped and the snow fell. Then came working at the mountain on the weekends, and then an extremely important work trip (an aircraft carrier was involved) finally came to pass.
I've learned alot about microcontroller programming in the past few months, and I've learned alot about the 9250 IMU that I'm using. I just reopened the code tonight to see where I left off, and I think I'll do a complete rewrite.
I'm implementing hardware acceleration on the 9250 by using its Digital Motion Processor. This piece of silicon will do all the transforms and filtering for me, and it works an absolute dream. The data that comes out can be acceleration, rotation, magnetometer, euler, or even quaternion. It comes with a built in calibration tool for each sensor. This offloads a ton of code for me, and this leaves the possibility of fully utilizing the bluetooth module. I plan on adding in connectivity to trim the canards, input the weight and rotation moment for PIDs, and (possibly) GPS coordinates.
Much of this will be in software, but I'll keep this topic updated.
As I was coding last night, I found out that the dmp transforms WON'T work on the adafruit nrf52 feather. Its really weird, because its technically an ARM M0 or something and it was supposed to work. I'll poke some more at it, but the tl;dr is that any dmp call just hangs the board. I know the teensy works well with the dmp and I can get really small surface mount shields for it. I think a hardware rebuild may be necessary for the "final" version, but as of now I'm working on two versions: the teensy one and the current one that will be launched soon.
***ADDITION***
I found a great PID example for rocket stabilization that I plan to use. Its supposed to be for a thrust vector setup, but it shouldn't be too much trouble to adapt it for canards. The second version of this will POSSIBLY be thrust vectored. Stay tuned!
As I'm waiting for the final hardware to arrive (Parachute, shock cord, etc) I am designing an all in one flight computer with a teensy 3.6. I am currently editing/rewriting the Invesense DMP driver to work with different i2c busses other than the default Wire.
If anyone has any experience with this, it would be awesome.
***UPDATE***
I just got the driver working! The flight computer is a go.
Hello I just "landed" on this forum and I find your work very interesting.
I am doing a similar project with Canard fin control for a model rocket however I am using only two servos with shafts to control the 4 fins in the Pitch and Roll axis. I discovered that I could not use the Yaw measurements because my IMU does't have a magnetometer (6dof).
I was wondering if you have made a launch attempt and if so how it went?
I too am struggling with the PID tuning but I should have it under control shortly.
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum