Stormworks: Build and Rescue

Stormworks: Build and Rescue

42 ratings
Heading Hold Microcontroller
   
Award
Favorite
Favorited
Unfavorite
Vehicles: Sea
Tags: v1.15.5
File Size
Posted
Updated
27.753 KB
22 Jul, 2019 @ 8:22am
6 Nov @ 10:30am
7 Change Notes ( view )

Subscribe to download
Heading Hold Microcontroller

Description
Given a current heading, and a desired heading, output rudder commands to keep vessel pointed towards desired heading.

Currently it is setup to support a "Toggle and Go" setup whereby when a toggle button is enabled, the current heading is set to the desired heading. The microcontroller will then output rudder commands to hold the heading that the vessel was pointing towards when the toggle button was enabled. By using the Heading adjust left/right input nodes, you can bind physical buttons to slightly tweak the desired heading in one direction or the other. It also allows the player to manually manipulate the vessel temporarily to avoid obstacles or adjust approaches. When no further player input is detected, the controller will resume heading hold.

To disable the system, simply toggle the button off. When a new heading is desired, simply re-toggle the button and again, the current heading will be set as the new desired heading hold.

Node Descriptions

System Enabled (Input): Whether or not the system is enabled. This should be bound to the toggle button on your vessel that you will use to enable and disable the heading hold system.

Current Heading (Input): This will come directly from the Compass Sensor on your vessel. This controller handles all the conversions for you, it just accepts the raw input from the sensor.

Heading Adjust Left (Input): Allows you to adjust the desired heading by one degree to the left. Best if bound to a pilot seat hotkey or a Standard (not toggle) button.

Heading Adjust Right (Input): Allows you to adjust the desired heading by one degree to the right. Best if bound to a pilot seat hotkey or a Standard (not toggle) button.

Rudder Player Input (Input): This should come from your control seat. This allows the pilot player to manipulate the vessel manually (to avoid obstacles, adjust approach, etc.) temporarily. Once input is no longer detected, the heading hold system will re-engage automatically.

Rudder Output (Output): This is the output commands that will be sent to your rudder control surface(s). This is what actually turns the vessel to hold the desired heading.

Stored Heading (Output) (Optional): This is an optional output that simply outputs the heading that the controller is attempting to hold. It will be the heading that was the vessel's current heading when the system was toggled on.

Current Heading Output Degrees (Output) (Optional): An optional output that simply outputs the current world heading in degrees. This allows you to not worry about converting the current heading into degrees from the compass' -0.5 to 0.5 scale.
106 Comments
Captain 10 Nov @ 3:24am 
Great update 👍
Mr. Leonard  [author] 6 Nov @ 10:32am 
I just updated this micro-controller which should fix the original issue. Let me know if you still are seeing problems after updating it in your crafts. Thanks all.
tomatosoup 4 Nov @ 9:14am 
leonard atp just turn off comments
Grimbo 3 Nov @ 2:09am 
I didn't think people had arguments on workshop comment sections
C4V Engineering 1 Nov @ 10:14pm 
Im at a lost as to whats happening anymore.
Kezrah 1 Nov @ 10:03pm 
well said tomato
tomatosoup 1 Nov @ 9:04pm 
guys what the ♥♥♥♥
tomatosoup 1 Nov @ 1:46pm 
guys you are just arguing over nothing. there are two proposed fixes, just do one of them. neither of yall are gonna "win" this argument. its not this deep
C4V Engineering 1 Nov @ 12:47pm 
Hey Leonard, I feel bad for you so heres the function I use for heading holds.

((-x/360 - y)%1+1.5)%1-0.5
X is keypad 0-360
Y is the compass

I dont know how yours work but it sounds like its broken. You can try this function. If it doesnt work then ill write up a new one for you with trigonometry or see where the issue is on yours.
tomatosoup 31 Oct @ 1:51pm 
guys its just a heading hold controller calm down