Stormworks: Build and Rescue

Stormworks: Build and Rescue

Heading Hold Microcontroller
82 Comments
tomatosoup Jan 7 @ 4:53pm 
I did some weird math that converted the heading that comes from the keypad, to the number the heading hold PID wants.
360*(1 - (floor((keypadHeading - 1) / 360) + (keypadHeading - 1) / 360))=desiredHeading
Mr. Leonard  [author] Jan 7 @ 7:30am 
Hey tomato, thanks for bringing that to my attention. You are right, there is definitely an error in the heading output value not matching up with the world heading. I don't have a lot of time today to work on it, but it looks like the displayed output heading is showing 180 when the vessel is facing north. See this image:

https://imgur.com/a/5LRVrNE

So it seems it is off by 180 degrees. I will get this fixed as soon as I have time and re-upload. Until then, the hold functionality does still work as expected.
tomatosoup Jan 6 @ 9:26pm 
hi leonard, i added a keypad to this microcontroller but noticed there was some issues. i checked with tooltips and realized the heading thats being used is.. not really whats normally considered heading.
For further reference you can use this function to convert compass to heading, where X=compass.
ceil(((1-x)%1)*360)
How are you using the compass? I need to get my keypad to output desiredheading to the logic. Ie; when I was going heading 240 (actual) the script was saying heading was 122 or something in that range.
Mr. Leonard  [author] Nov 10, 2024 @ 9:02am 
@Ozruul, are you wanting to override the set heading with a number input? If so, you'll have to modify it to add a new input node that allows you to set the heading from a number input. As it is currently, the only way to modify the set heading is to toggle it on (which will set the heading hold to your current vehicle's heading), or by adjusting it left/right with the momentary inputs (Heading Adjust Left and Right inputs).
Ozruul Nov 10, 2024 @ 8:08am 
how do i make it passive? so it'll always hold heading but i can override with my own commands
Oranje Jul 30, 2024 @ 7:35pm 
ok ty :D
Mr. Leonard  [author] Jul 30, 2024 @ 5:46pm 
It should yes. Some users have told me they have added it to their helis
Oranje Jul 30, 2024 @ 1:10pm 
does this work for helicopters
Mr. Leonard  [author] Jul 15, 2024 @ 6:16pm 
This one is a bit different from your typical keypad heading set system. Basically you point your vehicle in the direction you want to hold heading, then activate the System Enabled input via a button or other toggle input. The MC then automatically sets your current heading to the held heading. Then you can use the adjust left or right to fine-tune the direction you want to travel. If you would rather input a heading in any direction from a keypad, this may not be the most optimized for your use, however, it would not be difficult to add an additional input to this MC that serves as the "held" heading, while keeping the rest of the logic the same.
SpeedKiller.txt Jun 16, 2024 @ 4:25pm 
Why dont you have a number input for the heading?
[Server] Dec 8, 2023 @ 8:53pm 
Where do i connect everything
doeydobar Aug 9, 2023 @ 1:25pm 
Great, thanks. Wont be done for another few weeks
Mr. Leonard  [author] Aug 8, 2023 @ 8:10pm 
Yea for sure. Let me know when you upload it. I'd like to check it out.
doeydobar Aug 8, 2023 @ 4:49pm 
Can I use this in a future workshop submission? You will be credited in big blue letters
Nick Name Dec 13, 2022 @ 1:05pm 
Oki thanks !
Mr. Leonard  [author] Dec 10, 2022 @ 8:07am 
Hmm I do not but this is a good variation I should probably try to post. I can see how using a number input block to set the desired heading would be useful.
Nick Name Dec 9, 2022 @ 7:09am 
Do you have a version that could take in a value from 0 - 360 for the desired heading, tryna make a ww2 torpedo for my u-boat
Mr. Leonard  [author] May 20, 2022 @ 7:31am 
You can hook it up to a display so you can see what heading the microcontroller will be trying to hold. It is not required to use, just nice to be able to see what heading that is set.
TodayOnBottomGear May 19, 2022 @ 9:52am 
Where I plug in current heading output degrees
Mr. Leonard  [author] Dec 21, 2021 @ 10:38pm 
You don't actually have to connect that to anything if you don't want. It is just an output there in case you wanted to show the stored heading on a gauge or screen in your vehicle's cockpit.
birb Dec 21, 2021 @ 10:07pm 
where do i connect the stored heading??
ecwskier Jul 31, 2021 @ 8:28pm 
ok :steamthumbsup:
Mr. Leonard  [author] Jul 30, 2021 @ 4:40pm 
I'm not the best at PID tuning myself but there are lots of good guides out there.
ecwskier Jul 29, 2021 @ 10:16pm 
how do you think i should tune it
Mr. Leonard  [author] Jul 29, 2021 @ 8:56pm 
It drifts a bit for me but it does eventually re-correct itself. Try tuning the PID inside the MC a little more to your craft. That will hopefully help it perform a little less sluggish.
ecwskier Jul 28, 2021 @ 5:44pm 
ok:steamthumbsup:
Mr. Leonard  [author] Jul 28, 2021 @ 5:19pm 
Cool I'll try and take a look at it tonight
ecwskier Jul 28, 2021 @ 3:44pm 
here i was ganna put it on the workshop anyways
ecwskier Jul 28, 2021 @ 3:18pm 
i cant message you without friending you friend me temporarily
ecwskier Jul 28, 2021 @ 3:14pm 
ok :steamthumbsup:
Mr. Leonard  [author] Jul 28, 2021 @ 1:52pm 
Might have to just upload it to the workshop as unlisted and send me a pm with the workshop link. You can take it down after I have a chance to save it for testing.

https://imgur.com/a/mDAEnUE
ecwskier Jul 28, 2021 @ 12:00pm 
somthing else is wrong with it though
ecwskier Jul 28, 2021 @ 11:28am 
i think i found out why, its because while the gyro is on the heli tilts left and right, i dont know why. do you know how to fix this
ecwskier Jul 27, 2021 @ 9:46pm 
how do you want me to do that
Mr. Leonard  [author] Jul 27, 2021 @ 7:58pm 
@ecwskier if you want to send me you creation privately I can open it up and see why it is not working.
ecwskier Jul 27, 2021 @ 6:34pm 
doesnt work to good with my helicopter it over corrects and slowly goes back like really slow
Mr. Leonard  [author] Mar 17, 2021 @ 8:30am 
Thanks for the link-back *****! Happy that this MC is helping so many creators out there.
***** Mar 17, 2021 @ 2:11am 
Thank you for your creation. Incorporated into my helicopter .
Brygun Mar 8, 2021 @ 1:19pm 
Simple, works and if all you want is a go-that way only needs one button on the space demanding dashboard. Thanks.
***** Feb 1, 2021 @ 11:21pm 
Nice controller. Works well in my helicopter.
The Big Fish Jan 21, 2021 @ 10:30pm 
This microcontroller is so useful, i have no complaints whatsoever
RedneckRepublic Nov 15, 2020 @ 1:09pm 
Best part was i took my survey chart for the ocean floor and it just merged perfectly with this. made it nearly fully automatic for surveying the bottom
Mr. Leonard  [author] Nov 15, 2020 @ 12:24pm 
Thank you Martin! I am glad it is useful
RedneckRepublic Nov 14, 2020 @ 6:52pm 
Thank you for making such a simplistic and easy controller that can be used in many different creations from subs to boats and maybe even planes! i just want to thank you for making an awesome controller, that ive used basicly since it came out
Canadagoose Oct 10, 2020 @ 11:08am 
Just found this controller and started using it for my submarines, works great!
Luchador Sep 22, 2020 @ 1:27pm 
My boat goes left and right when I turn heading hold on
Wivi2013 Aug 21, 2020 @ 11:41am 
The best stand-alone Heading-Hold I came across until now.
Easy to use and modify to my needs and effective in every aspect
MorosePlains705 Jul 21, 2020 @ 3:27pm 
When I Tested It The Stored Heading On That Was Connected To A Dial Continued To Say 0.
Jono2745 Jul 18, 2020 @ 3:53pm 
works amazingly, even though i'm using it for a helicopter. great job!