I could use just a little guidance

The Rocketry Forum

Help Support The Rocketry Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.
You can reduce oscillation by including an angular velocity term in your control loop. If the rocket is moving away from vertical, the angular velocity term would increase the angle of the canard, and if the rocket is moving toward vertical it would decrease the angle. This introduces a damping factor. So the canard angle would be given by "Angle[canard] = A*Angle[gyro] + B*Velocity[gyro]".

I think you are talking along the lines of P.I.D. (proportional-integral-derivative). Here is a Wiki:

https://en.wikipedia.org/wiki/PID_controller

And this very useful page about tuning PID for multicopters, which are not rockets but use the same kind of Flight controller and PID can be tuned:

https://blog.oscarliang.net/quadcopter-pid-explained-tuning/

This part briefly explains the Derivative:
• Derivative Gain*coefficient -*this coefficient allows the quadcopter to reach more quickly the desired attitude. Some people call it the accelerator parameter because it amplifies the user input. It also decrease control action fast when the error is decreasing fast. In practice it will increase the reaction speed and in certain cases an increase the effect of the P gain.

The bold part may be more like you are talking about, or perhaps all of PID is and the bold part shows how useful it can be to reduce the control action as the model nears zero error so it will not tend to overshoot as much. Kerbal Space Program used to have a pretty poor PID, a lot of overshooting wobble, it was a way too long time before they finally fixed it.

I am working on a project using a NAZE 32 flight controller and Cleanflight. The PID values can be tuned. For now, I am using it as a 2D "horizon mode" NAZE 32 version of the Eagle Tree Guardian. The servos were twitching like crazy when the controller was being rotated in any way, so I reduced the Proportional gain a good bit , and some derivative till the twitching went away. I have not done much else with the PID, still learning.

This afternoon I did complete a very nice test flight of an R/C electric plane, an Easy Star, with the NAZE 32 working like a Guardian in 2D horizon mode. It was to confirm to me that it indeed behaved like the Guardian in 2D mode, and it did. Then I flipped the toggle switch to "angle" mode which I had pre-set it to not "tilt" more than 10 degrees. So flying along horizontally, when I wanted to turn left, I gave full left, but it slowly turned left because it did not let it bank more than 10 degrees. And in level flight, if I gave full up, it would climb gradually, not allowed to pitch up more than 10 degrees. Same for down, it would not pitch nose down more than 10 degrees. If I was in manual mode and put it into a vertical dive, then let go of the stick and flipped to horizon or angle mode, it pulled out immediately into level flight, without zooming up into a stall (this is how the Guardian behaves too, except it does not have an Angle mode, only horizon mode). So, this is like a Guardian, except it can be programmed in so many other ways, including PID rather than a blunt gain adjustment

When I flipped to angle mode and was flying fast, the plane did wobble a bit in yaw. This is because the rudder has a pretty strong response to only a few degrees of banking left or right. I've seen that before with the Guardian, needed to reduce the gain a little bit. I need to study the above linked pages some more and figure out which part of the PID to focus on, or just reduce them all by some percentage. Then fly some more and see the result. But when its not as windy and not as cold. Today was a sanity check to make sure it really did work in the air, ground testing is critical but I'd done what I could and needed to get it in the air to see if it behaved right. Indeed the only way to see the Angle mode do its thing is in the air, on the ground the angle mode and horizon mode test the same.

OK, I'm convinced - more gain on the next flight. And two cameras, one pointing up to see the canards and one pointing down to see spin more easily.

It would most useful if the camera was pointing down to show the canards and the ground at the same time. Otherwise, with the two, if you have them inline with each other, or 180 degrees apart, and can do a time-synced side by side video, that would show the canard movements and the flight path movement of the ground below (might need to do a mirror image flip in the video editing). Of course if video editing is not your thing, and you don't know anyone who could do it that might like to tackle it, then that's not too viable. I could do it in iMovie but i've got too much else going on (couple of projects having problems, dragging out)

- George Gassaway
 
Last edited:
I think you are talking along the lines of P.I.D. (proportional-integral-derivative).

It would most useful if the camera was pointing down to show the canards and the ground at the same time.

- George Gassaway

The UDB5 can do whatever PID control is desired. I would like to consider integral control in the case of an offset in tilt or roll. We think it will be necessary to have roll under control for this to work.

I don't think there is room for a camera above the canards without interfering with the air flow past them. There's only 6 inches or so of straight airframe above them. Let me check if the angle of the camera view is wide enough to mount a camera between the canards (but this probably won't be a very effective view).

Jim
 
Last edited:
I think you are talking along the lines of P.I.D. (proportional-integral-derivative).

The attitude is derived from integrating the gyro signals so using "I" on an already integrated value is not that elegant.

If possible PI control on the angular rates would be easier, then derivative action (messy) would probably wouldn't be necessary. Control the rates to 0 should be result in verticality. Simpler control law I think. Does the software running on the UDB5 allow for controlling on the rates?
 
Last edited:
The attitude is derived from integrating the gyro signals so using "I" on an already integrated value is not that elegant.

If possible PI control on the angular rates would be easier, then derivative action (messy) would probably wouldn't be necessary. Control the rates to 0 should be result in verticality. Simpler control law I think. Does the software running on the UDB5 allow for controlling on the rates?

The current configuration is proportional control on X and Z axis tilt and Y axis roll rate (but not roll orientation).

Jim
 
The control method I described in my previous post is only PD, it does not use an integral term. Rate gyros sense angular velocity, and the angle is obtained by integrating the velocity. However, the primary variable that is being controlled is the angle, so this is the P term. The angular velocity is the derivative of the angle, so it is the D term.

I wrote a quick 24-line simulation program to show the result of using the D term. It produced the result shown in the attached graph. As you can see, the oscillation damps out after a few cycles.

sim.jpg

The simulation program is as follows:
Code:
#include <stdio.h>

#define Kp   1.0   // Proportional Control Constant
#define Kd   0.1   // Differential Control Constant
#define Ka -10.0   // Fin angle to acceleration Constant

int main(int argc, char **argv)
{
    double Time, DeltaTime;
    double FinAngle, RocketAngle, AngularVelocity, AngularAcceleration;

    DeltaTime = 0.01;
    AngularVelocity = 0.0;
    RocketAngle = 30.0;
    for (Time = 0.0; Time < 10.0; Time += DeltaTime)
    {
        printf("%5.2f %f\n", Time, RocketAngle);
        FinAngle = Kp * RocketAngle + Kd * AngularVelocity;
        AngularAcceleration = Ka * FinAngle;
        AngularVelocity += AngularAcceleration * DeltaTime;
        RocketAngle += AngularVelocity * DeltaTime;
    }
    return 0;
}
 
Last edited:
The control method I described in my previous post is only PD, it does not use an integral term. Rate gyros sense angular velocity, and the angle is obtained by integrating the velocity. However, the primary variable that is being controlled is the angle, so this is the P term. The angular velocity is the derivative of the angle, so it is the D term.

What is currently programmed is proportional control of the roll rate. That is, we're controlling the roll rate to zero, and not the angle to some fixed angle. If I understand the programming correctly (and I may not), the maximum canard angle assigned to roll control will be 1/3 of the total servo response, and this maximum response will be acheived when the roll rate is 1 Hz (or above). Derivative control would address the rate of change in the roll rate, but we don't have that programmed for now. My belief is that if the canards don't physically provide a zero roll rate when the control system is asking for that, then the result will be a slow roll at equilibrium (i.e., an offset). I think adding integral control at that point would be needed to work the roll rate to zero (but the objective of this would still not be to achieve a specific orientation).

The Guardian does this differently. The proportional part of the heading hold wants to return to a specific orientation. So, the maximum canard deflection occurs when the orientation is at 179 degrees away from the desired orientation set point. If the actual angle reaches >180 degrees, the canards flip and then are working in a way that accelerates the roll rate back towards the set point. I don't much care for that approach, and I can see it becoming unstable (good for planes but not so much for rockets).

If the UDB5 approach can resist and slow any natural roll, then the tilt control should work better.

Jim
 
OK, I was thinking more about attitude control rather than roll control. For roll control it makes sense to just achieve zero angular velocity instead of trying to achieve a specific angle. Also, damping isn't as important if the range of oscillation is small. Without damping, the control system will oscillate back-and-forth between the two extremes, but if the initial error is small it doesn't matter much.
 
PD control is very unusual because the D term is very sensitive to measurement noise, especially with high-frequency measurements. Typical systems I've seen or heard about use either PI or PID control. I think of integral term as helping overcome the inertia built into the system you're controlling. You have to be careful with integrating the error if you think you'll hit the limit of actuating the controls. Otherwise you'll end up with integral windup problems.
 
Since it's hard to describe what the control system response is in words, here's a short video showing how the system responds to tilt and roll. Opposing sets of canards respond to tilt, and all four canards are mixed to also provide proportional control of the roll rate.

The third test flight will hopefully be this weekend. I have a K1200 for that flight (I wish I had something a bit bigger, but I don't).

Jim

https://youtu.be/7H_ffM-egdM
 
Nice to see the video in action.

In the roll control response, it seems to me to be too slow (sluggish?) and/or to be producing a lot more roll control for the rate than I would expect.

On the flip side I still think the actual pitch/yaw control is way too little for the size of the canards.

I think you have too much where you need little (roll) and too little where you need much (pitch/yaw).

But at least you should be able to find out a lot with the next flight. I won;t be surprised if in roll it "hunts" back and forth unable to smooth itself out until it gets too slow to over control (unless it is built so well and has such a smooth liftoff from the launch that it has little roll to try to correct to begin with). While you might not see much pitch/yaw control response.

- George Gassaway
 
Nice to see the video in action.

In the roll control response, it seems to me to be too slow (sluggish?) and/or to be producing a lot more roll control for the rate than I would expect.

On the flip side I still think the actual pitch/yaw control is way too little for the size of the canards.

I think you have too much where you need little (roll) and too little where you need much (pitch/yaw).

But at least you should be able to find out a lot with the next flight. I won;t be surprised if in roll it "hunts" back and forth unable to smooth itself out until it gets too slow to over control (unless it is built so well and has such a smooth liftoff from the launch that it has little roll to try to correct to begin with). While you might not see much pitch/yaw control response.

- George Gassaway

I think the sluggish looking response is more related to the type of control. When I turn the rocket, I accelerate it and then decelerate it for any given turn. The system is responding to those rate changes, and it makes it look sluggish (but it's not).

On the other two counts, you may be right. For the roll, we actually turned it down by a factor of three over our initial guess. It still might be too much, but I'd like to see a little of that back and forth motion so that we have some data to tune with. On the tilt, we'll just have to see. It's set at 1° of correction for 2° of tilt. The first flight showed a pretty abrupt change in direction when the control kicked in. The canards are smaller now, but remember that my objective is to slowly return to vertical. We'll see.

I did manage to mount a camera above the canards. The pic is about what the view should look like. It will be 720 at 60 fps.

Jim

Snapshot_12.jpg
 
Did the third test flight today. I wish I had a bigger motor for the flight (only got 4K feet on this). Pretty good control I think, but we're still looking at the data. After a long day at the field, cosines, tilt angles and vectors are starting to mess with my head.

This day was pretty windy, as can be seen from the descent of the rocket.

Jim

https://youtu.be/vuaY_lfLHzA

Hutto stabilized third 032815.jpg

Hutto stabilized third P2 032815.jpg
 
Did the third test flight today. I wish I had a bigger motor for the flight (only got 4K feet on this). Pretty good control I think, but we're still looking at the data. After a long day at the field, cosines, tilt angles and vectors are starting to mess with my head.

This day was pretty windy, as can be seen from the descent of the rocket.

Jim

https://youtu.be/vuaY_lfLHzA


Great video! Is it possible for you to configure your system so that it inputs an intentional offset into the roll rate and then also removes it a short time later? In other words, let it control to zero roll rate and stay there for a short time. Then automatically command a small roll in one direction and then have it set it self back to a target rate of zero. This would demonstrate positive control and show how the system responds and whether it overshoots or oscillates. Which then tells you if the gain is too high or too low. (etc). Eventually the same thing could be done with the pitch control loop too but I would start with roll since it is less risky to run the experiment. Impulses and/or step function offsets are very commonly used for testing control systems.
 
Great video! Is it possible for you to configure your system so that it inputs an intentional offset into the roll rate and then also removes it a short time later? In other words, let it control to zero roll rate and stay there for a short time. Then automatically command a small roll in one direction and then have it set it self back to a target rate of zero. This would demonstrate positive control and show how the system responds and whether it overshoots or oscillates. Which then tells you if the gain is too high or too low. (etc). Eventually the same thing could be done with the pitch control loop too but I would start with roll since it is less risky to run the experiment. Impulses and/or step function offsets are very commonly used for testing control systems.

Interesting idea. As it stands now, the system can be switched from controlling mode to a fixed center position. This is to turn the system on or off using the Raven. The flight today was using control from the start, and I think that'll be the default from now on. So, if the center position was changed to instead provide some roll, I believe the Raven could be configured using the timer or other capabilities to switch to the center mode for a moment and then back.

I suspect if we tried that, that instead, we'd just program the UDB5 to recognize launch, and then make whatever changes in the settings that we want.

Jim
 
Cool, stared at the canards and could see the "leetle" movements they make for stabilization. Really neat. I know that was just a test for bigger and better but that is quite an accomplishment Jim. Especially for what you have planned for the future. Kurt
 
Cool, stared at the canards and could see the "leetle" movements they make for stabilization. Really neat. I know that was just a test for bigger and better but that is quite an accomplishment Jim. Especially for what you have planned for the future. Kurt

Not sure about accomplishments just yet, but on this flight, we got almost complete data capture. There is a ton of information available.

One thing about this flight is that there was a strong wind nearly all of the way up. You can see that from the gps path of the falling rocket. As it turns out, the rocket flew directly into the wind (about 30 mph most of the way up). The flight path going up was about 4 degrees into the wind. The actual tilt of the rocket, however, was about 13-14 degrees. In the absence of stabilization, the rocket would have weathercocked severely into the wind. It didn't - it reached an angle of 13 degrees. At the other end of the spectrum, with very large canards, the rocket would have been vertical and drifted downwind instead of upwind. So, the flight path that it actually took is a balance of those effects.

The little canards on that flight had a lot to deal with. The rocket is significantly over stable, and the lever arm from the canards to the CG is only about 2 feet. And, they are small and we limited the traverse. Finally, the flight was pretty slow (maximum velocity of just under 600 ft/s). So, George, you were right that there was not enough movement/size of the canards, for this particular flight anyway, but we will still learn a lot from the flight. And I think the canards provided a lot of stabilization relative to what the flight would have been without them.

Attached is the ground path of the rocket from the gps, with most of the altitude from point 1 to point 2. This path was directly into the wind. It is hard to see this direction from the video - sort of an optical illusion.

Jim

Hutto Third Ground Path.jpg
 
Looking good Jim. I will make it back out to a launch one of these days to take a look.


Sent from my iPad using Rocketry Forum
 
Here's a little data from the flight last weekend.

The first graph is acceleration. Launch is at 4 seconds on the graph. Upward acceleration is negative, so you can see the burn period and then the deceleration that starts at about 6 seconds. The oscillation before launch is due to something called a limit cycle. It has been eliminated.

Second graph is the gyros. The y-axis gyro value is positive for CCW rotation viewed from above. I integrated the y-axis gyro though about 6 seconds and got about 90°. You can see the 90° turn in the video.

Third graph is the tilt vectors and the net tilt from vertical. Shortly after launch, the rocket went to about a 14° angle and stayed at that point for the next 6 seconds.

Fourth graph is the control signals sent to the servos. For a given pair (1 and 3 for example), they move in the same direction when controlling spin and in opposite directions when controlling tilt. You can see the spin correction shortly after launch. Later, there is a consistent servo signal for both pairs of servos. Basically, the servos were in a non-neutral position, but couldn't bring the rocket vertical due to a pretty stiff cross wind.

Here's a fresh link to the video if you'd like to compare the video to the flight data.

https://youtu.be/vuaY_lfLHzA

Also attached below is the Raven flight data (for the up part of the flight).

I have started construction of the booster and the lower stabilization section, which will be the stabilization package that I hope to use at Balls. The canards will be larger as will the lever arm of the rocket. This construction will take a while, so I don't expect the next flight to be until the end of May. I'll post a bit of information on the design and build in the meantime.

Also, the UDB5 is being programmed to have the capability to fly at a non-vertical angle. I plan to use that capability on the next test flight to measure the dynamic response of the rocket. So, at a specified point, I'll tell the rocket to fly at 5° or maybe 10° from vertical for a few seconds, and then go back to vertical. I think this will be a great way to do a measured change and then see what the response is.

Jim

Accel.png

Gyros.png

Tilt.png

Servo outputs.png

Hutto stabilized graph.jpg
 
Jim, when you did your last Balls shot what was the angular limit you used for the staging inhibit?

I doubt they, FAA/AST, allow you to fly straight vertical, right?

Assuming I understand the above correctly, would it make sense to fly the rocket at the FAA prescribed angle from vertical all the while minimizing roll?
 
Jim

Great data. I think you are making great progress, and now you can measure the effects of the control system with instrumentation and even deconvolute pitch and roll information.

As I look at the tilt plot, I see ~1/2 second delay in the beginning of the tilt, followed by a sharp linear rise in angle for another !~1/2 second, followed by rapid reduction in tilt of about 3 degrees over ~0.3 second and then followed with a gradual increase to about 14 degrees over about 2 seconds and then a constant angle until the velocity drops near apogee.

I have a few questions:

1. What is the time constant for your correction routine. It looks a bit long perhaps a second or so.

2. What was the rod clearance time. It look like the initial rapid tilt increase was a tip off due to the crosswind.

3. The decrease in angle appears to be the correction but it is short lived, and not effective enough to bring the rocket vertical. I would have thought the rocket should have continued to try to get to zero vertical angle and it didn't. Instead of having the fins moving 1 degree per angle of tilt, it might be necessary to increase the rate to something like 1.2 times the tilt angle to gain more lift and thus more control authority.

4. Can you add the total velocity from the Raven to the tilt plot? It might give some insight as the minimum effective velocity of the fins.

Bob
 
awesome work Jim

Ryan, it's not me. I just made a rocket with moving fins that don't really work yet. Dr. Premerlani is making the control unit sing. You take someone who knows microprocessors, sensors, servos and flight navigation, and teach him a bit about rockets, and some pretty interesting things are going to happen.

Jim
 
Jim, when you did your last Balls shot what was the angular limit you used for the staging inhibit?

I doubt they, FAA/AST, allow you to fly straight vertical, right?

Assuming I understand the above correctly, would it make sense to fly the rocket at the FAA prescribed angle from vertical all the while minimizing roll?

I used 15% on the tiltometer. I stay a few Ns below the FAA threshold, and I launch straight up. Remember that the tilt values that are available on the rocket are for the angle of the rocket only and not the flight path. As I understand it (and I may not), there are three levels of the tilt capability. One is to fly at an angle to vertical, recognizing that the rocket could cone if it rolls. The second is to fly at a fixed tilt for a prolonged period even if the rocket rolls, and the third is to fly at a specific tilt (i.e., north). The goal for now is the first and second.

Jim
 
Jim

Great data. I think you are making great progress, and now you can measure the effects of the control system with instrumentation and even deconvolute pitch and roll information.

As I look at the tilt plot, I see ~1/2 second delay in the beginning of the tilt, followed by a sharp linear rise in angle for another !~1/2 second, followed by rapid reduction in tilt of about 3 degrees over ~0.3 second and then followed with a gradual increase to about 14 degrees over about 2 seconds and then a constant angle until the velocity drops near apogee.

I have a few questions:

1. What is the time constant for your correction routine. It looks a bit long perhaps a second or so.

2. What was the rod clearance time. It look like the initial rapid tilt increase was a tip off due to the crosswind.

3. The decrease in angle appears to be the correction but it is short lived, and not effective enough to bring the rocket vertical. I would have thought the rocket should have continued to try to get to zero vertical angle and it didn't. Instead of having the fins moving 1 degree per angle of tilt, it might be necessary to increase the rate to something like 1.2 times the tilt angle to gain more lift and thus more control authority.

4. Can you add the total velocity from the Raven to the tilt plot? It might give some insight as the minimum effective velocity of the fins.

Bob

There is no intentional time constant for correction. It is an quick as the processor and servos can make it.

There was a pretty good cross wind at launch. Maybe 15 mph? I'd say tipoff. The wind velocity was supposed to be 30 mph according to the FAA tower, and the descent data suggests about that velocity. I think the slower increase to 14 degrees was an increase in wind velocity with altitude.

The attached figure is my crude attempt to show how the flight path and rocket angle might have changed with varying degrees of control. We think we were on the middle path, conceptually.

It will be a while before the lower stabilization equipment is ready to go, but if the launch was tomorrow, the approach would be the same movement of the canards, but with an area about 2.5 times larger than the last flight with a lever arm that will be about twice as long. The larger canard size is required just for stability of the three stage rocket, and this cannot be easily changed. So, for the test rocket, the effective gain increase will be about a factor of 4 to 5, depending on how things actually come out. The plan could change, but that's what I'd do if the flight were tomorrow.

I can add the Raven data, but I can't remember how to export it. If someone can remind me how to do that, I will. It looks like the tilt started to increase at about 8 seconds into the flight. The Raven velocity at that point is 285 ft/s.

Jim

Path.jpg
 
I used 15% on the tiltometer. I stay a few Ns below the FAA threshold, and I launch straight up. Remember that the tilt values that are available on the rocket are for the angle of the rocket only and not the flight path. As I understand it (and I may not), there are three levels of the tilt capability. One is to fly at an angle to vertical, recognizing that the rocket could cone if it rolls. The second is to fly at a fixed tilt for a prolonged period even if the rocket rolls, and the third is to fly at a specific tilt (i.e., north). The goal for now is the first and second.

Jim

Ok, so you are staying below a p so the FAA is not involved beyond normal waiver stuff. The waiver at Black Rock is really high so no worry.

I was just thinking along the lines of not only vertical guidance but dispersion/splash are control. Having done the sims for a couple class three rockets that was where my brain was taking me.

Have you flown this through mach yet? Curious if you have not how the canards will handle the shock wave going through mach. Not only the structure itself but the servo's.
 
Ok, so you are staying below a p so the FAA is not involved beyond normal waiver stuff. The waiver at Black Rock is really high so no worry.

I was just thinking along the lines of not only vertical guidance but dispersion/splash are control. Having done the sims for a couple class three rockets that was where my brain was taking me.

Have you flown this through mach yet? Curious if you have not how the canards will handle the shock wave going through mach. Not only the structure itself but the servo's.

I believe I'm as close to a "P" as I can get, and I'm thinking about dispersion too!

The current flight profile for the three stage flight is a maximum velocity of the first stage to about 1100 ft/s with the second stage motor lighting at about 600 ft/s. At least it's not Mach 2 of something like that.

Jim
 
I believe I'm as close to a "P" as I can get, and I'm thinking about dispersion too!

The current flight profile for the three stage flight is a maximum velocity of the first stage to about 1100 ft/s with the second stage motor lighting at about 600 ft/s. At least it's not Mach 2 of something like that.

Jim

Jim, I think you should fire your test vehicle up to Mach 1.5 or so to see how things go.
 
I can add the Raven data, but I can't remember how to export it.
IIRC, you right-click in the parameter window (the one that allows you to select what gets graphed.) It's not the most intuitive interface.
 
Back
Top