'Realistic' Spaceship Control
Realistic spaceship controls are often criticized for their difficulty and non-intuitiveness- people are wired to expect more resistance to movement. For tacticalspace, the key is to not have real-time control at all, but rather just the setting of targets and waypoints. However, the spaceships need to move of their own accord in a way that might resemble how a real physical object moves.


Here's a control scheme I generated in dia

The above diagram ignores sensor noise, which would be added to 'New Current State' before entry into the controller.

The controller currently is a simple scaled error- the target state minus the current state is the error signal, and that is converted into motor inputs.

The propulsion/motor is given a more realistic feel by filtering it. A low-pass filter prevents instantaneous changes- even the fictional propulsion devices here cannot go to full throttle in one time step, they have to ramp up.

The Physics simulation I am using is ODE. The outputs from that sim have a delta-t equal to the amount I specify for ODE, currently around .02 seconds.

Because the ships in tacticalspace have 6DOF, it's difficult to rapidly simulate different control gains and see if the principles are sound behind all the boxes in the above diagram. I've started some octave/matlab files to help run 1-D sims (6-D would be possible, but more work than I care to undertake currently).

gnuplot output of 'target.m'. Upper left is position versus time, upper right is velocity, lower left is acceleration, and right is a fft of the acceleration signals. The light blue is the full iterative sim with control output filtering, while the green line is the lsode solved differential equation- haven't figured out how to translate the filter into a form the diff-eq will handle.

In the above example the red lines are the target position and target velocity. It looks like that target was achieved at t=20, and after that the system damps down into a steady state. Obviously it's impossible to maintain a position and a non-zero velocity for more than a instant, and after that one could only hope to bounce back to it.

Note how the light-blue line is smoothed in the accel graph, that's the filtering action. It represents the throttle being slammed to the stop, but the actual response in thrust following seconds later.

main