4

I've programmed a spaceship with thrusters, and an attitude control system with a PID controller for each axis.

Although my spaceship movement is visually fine, my ship rotates to the target attitude or follows set attitude rates but rarely stops outputting. The thrusters fire small amounts at high frequency as my pid output oscillates slightly around the setpoint.

One thing that may disturb the system is that the thrusters are not perfect, and don't align exactly through the center of mass. So when one pid controller corrects one axis, it introduces small movements on the other axes.

How can I add an acceptable deadband, where the pids don't attempt to eliminate error completely, but try to keep the output within the deadbands with as little controlling as possible? i.e. I want to conserve the fuel used by the thrusters.

I'm not very good at math, so a useful answer would discuss general damping ideas, filtering, or deadband methods while avoiding getting too far into equations. I'm also not looking for a rigorous scientific explanation, just some easy to implement ideas which may help improve my simulation somewhat.

Innovine
  • 4,625
  • 18
  • 34
  • An easy to implement idea might be bang-bang Instances here: 1, 2, 3, 4 – uhoh Jul 08 '21 at 10:35
  • 4
    Have you implemented a phase-plane controller? It's well described here: https://space.stackexchange.com/a/51945/6944 – Organic Marble Jul 08 '21 at 11:20
  • 1
    #1) don't adjust orientation for where you are now but where you will be in X milliseconds. With the consideration that "not there yet but heading towards it" might be good enough and #2) decide how much deviation from desired reading is allowed before any corrective action is applied. ... This will give you a system that responds a bit more sluggishly, and will oscillate a bit, but uses a magnitude less control. – CuteKItty_pleaseStopBArking Jul 08 '21 at 11:21
  • 1
    @PcMan Your #1 can be accomplished by tuning the D term in a PID controller. – Charles Staats Jul 08 '21 at 11:58
  • "the thrusters are not perfect, and don't align exactly through the center of mass". Is the out-of-alignment a well known measured value or is it random and unknown ? If it is known or if it can be estimated, it can be corrected for. Please add a detailed block dagram of the system and a schematic showing the thruster locations illustrating the out-of-alignment distances/angles. – AJN Jul 08 '21 at 14:41
  • 1
    People coming from a non-GNC control theory background tend to want to use the tools they were taught in college / used in industry -- PID or PD. For thrusters that can only be commanded on or off and that point in a fixed body-fixed direction, phase plane control is demonstrably better than PID or PD. – David Hammen Jul 08 '21 at 16:01
  • I'm not familiar with phase-plane, I'll have a look. My thrusters are not just on-off though, they ramp up to a thrust level and fall back to zero. the mis-alignment is not known, and dynamic (as the astronaut weight moves around, and the tanks empty the center of mass moves) – Innovine Jul 08 '21 at 19:56
  • Regarding the phase plane diagram, if the point is outside the drift and deadzones, do the thrusters fire at max strength until the system enters the drift, or is there some strength proportional to the error sizes? – Innovine Jul 09 '21 at 13:55
  • 2
    @Innovine Thrusters that are not throttleable are called on-off thrusters. The valves that control propellant flow to such thrusters are either commanded to be open or to be closed. These will inevitably have a build-in and trail-off time period. I would suggest not modeling that at first. I would also suggest not modeling navigation errors at first. The first step in designing a vehicle with a simulation is to start simple: A vehicle with perfectly behaving simple thrusters, perfect navigation, perfect knowledge of vehicle mass properties. If you can't handle that, back to the drawing board. – David Hammen Jul 09 '21 at 13:57
  • Only then do you start adding things like misalignment, build-up and trail-off, imperfect sensors, nav errors, ... That too will send you back to the drawing board, but at least you have a starting point. – David Hammen Jul 09 '21 at 13:59
  • I have a decent physics engine which can handle all of that already. Modelling is no problem. I can go back to on-off thrusters with or without ramp times, that's also fine. I'm a competent programmer, I just don't understand these control systems or much of the maths involved. – Innovine Jul 09 '21 at 14:03
  • 1
    @Innovine Regarding your last question about behavior well away from the drift zones and deadzones, that's a debated issue. Some attitude controls experts don't like the idea of firing at full thrust (100% on-time), ever. To them, needing to do so is a sign the vehicle is out of control. Those people typically design systems to have a maximum on-time as well as a minimum on-time. Others don't see a problem with firing thrusters at 100% on-time when a vehicle is commanded to make a large change in attitude. – David Hammen Jul 09 '21 at 14:04
  • Adding misalignment is as easy as aligning it, there's just a thrust vector and a position to specify. This perhaps complicates the control logic, but I'm not looking for rocket science here. Just a rough approximation of a control system is ok for me, and I leave the detailed physics modelling to an engine. – Innovine Jul 09 '21 at 14:06

0 Answers0