Stormworks: Build and Rescue

Stormworks: Build and Rescue

Not enough ratings
Basic Plane Autopilot (3x3)
   
Award
Favorite
Favorited
Unfavorite
Vehicles: Air
Tags: v0.10.12
File Size
Posted
Updated
39.707 KB
18 Feb, 2020 @ 5:02am
4 Apr, 2020 @ 4:14am
2 Change Notes ( view )

Subscribe to download
Basic Plane Autopilot (3x3)

In 1 collection by Jackmino
My Stuff
11 items
Description
A simple autopilot micro-controller designed to be easy to set up. Takes 2 inputs (preferably from a keyboard) for desired heading (in degrees) and altitude (in meters)

Installation instructions:

- Place this along with 3 numerical switch-boxes (for pitch, roll and yaw), a keyboard (or 2 keypads) and a toggle button of some kind. Also place a compass sensor, an altimeter and 2 tilt sensors (facing forward and left)

- Connect the 3 switch-box's outputs to the respective control surfaces (or controllers, such as gyros) Gyro Recomended for this

- Connect the 3 outputs of the micro-controller to their respective switch-box's ON inputs

- Connect the conventional controller (such as a pilot seat) to their respective switch-box's OFF inputs

- Connect the switch-box's toggle to the output of the button

- Connect the output of the keyboard/keypad to the respective "desired heading" and "desired altitude"

- Connect the tilt sensors to the respective "current pitch" and "current roll", also connect the altimeter to "current altitude"

Explanation

This should now act as a basic autopilot system. The altitude hold works by taking the difference between the target and current altitude and outputting that as a target pitch. The difference between the target and current pitch is then output to the control surfaces (if the autopilot button is on). This causes it to pitch (within set limits) to the current altitude and compensates for lack, or abundance, of lift.

The heading hold is a bit more complicated, but follows a similar principle. First, because the reading from the compass sensor a stupid (0 representing north, 0.25 representing east, + or - 0.5 representing south and -0.25 representing west), it corrects it so that north is 0 or 1, and south is 0.5. It then plugs that value into a tangential equation using the target heading as a set point: tan((target - current)/2), and outputs that as a desired roll (clamped by the roll limiter). This is also used to directly control the rudder, making turns faster. The desired roll is then output to a similar equation as the pitch, and then output to the control surfaces.

The roll and pitch are limited to 30 degrees, however this can be changed within the micro-controller

If the controls are inverted (pitching down when your below the target, turning left when you need to turn right etc.) then you need to go into the micro-controller and change the gain of the pitch and roll outputs to be positive or negative respectively. So far my control surface setup is as follows:

-Elevators have negative value at the top

-Rudder has negative value on the left

-Ailerons have negative value at the top on the left, and at the bottom on the right

This configuration shouldn't require any adjustment to the micro-controller (besides reducing gains and such)

This would actually work for land vehicles, if you just set the yaw output to steering
26 Comments
Jackmino  [author] 23 Apr @ 10:51am 
This is basic and ancient
qbzephyr 23 Apr @ 7:42am 
use property thingies
Jackmino  [author] 27 Dec, 2024 @ 4:04pm 
Huh? This doesn't concern electric connections, it's a controller for the fins. It should still work but I will eventually upload a better one
Wolves Hero 27 Dec, 2024 @ 3:42pm 
This is wrong, all pitch roll yaw don't worked already with electric because without connection to seat for controller pitch roll yaw
Deyno8 19 Aug, 2024 @ 11:09am 
Works like a charm, thanks!
Jackmino  [author] 4 Apr, 2023 @ 6:54am 
Yes Simyon, it does. The idea is that you'd use a keyboard to set the desired heading. I may allow you to switch between using Degrees, Radians, and the default compass outputs (0.5 = 180, 0 = 360 etc)
Simyon 4 Apr, 2023 @ 5:30am 
Does the Target Heading need to be in a 360 Degree format?
Jackmino  [author] 6 Oct, 2020 @ 6:54am 
The desired heading is from a keypad, it is the direction you want the autopilot to take you, a heading in degrees from north. The output from the stupid in game compass sensor goes to the current heading input. I've mapped the compass sensor's value to a heading in degrees from north, and then uses a P controller to control yaw/roll
Tolo 6 Oct, 2020 @ 6:42am 
What do you put into the desired heading input, is it the stupid ingame compass numbers or the system the controller is using internally?
Jackmino  [author] 30 Sep, 2020 @ 1:43am 
It does use PIDs, but only the first part, Proportional control. Reducing the gain or reducing the output to the control surfaces would hopefully stop that. Normally it only wobbles as the aircraft becomes faster, but using 3 functions you could scale the output with speed to prevent wobbling