Stormworks: Build and Rescue

Stormworks: Build and Rescue

Depth Sounder
5 Comments
Neottious 14 May, 2021 @ 5:27am 
Tilt sensors don't actually measure pitch and roll, but they measure distance from the horizon. This is why you can get pitch from a tilt sensor just fine. The problem comes when you try to measure roll, though. It will not give you correct roll data.

To get accurate roll data, you need a leftward-facing and an upward-facing sensor. Use 2 input arctangent here, like "atan2(left,up)". Output will be in radian, input can be direct from tilt sensor.

Lua's math.atan function can take 2 arguments just like the atan2 function in the function blocks.
Brygun 24 Feb, 2021 @ 4:57pm 
Thanks. In trying that I was realizing your probably already accounted for the pointing question as you already had roll left/right and up/down.
Looks good on boat feeding a gauge turned vertical with a constant number to the second red line as a warning that its time to worry about touching bottom.
draeath  [author] 24 Feb, 2021 @ 3:12pm 
Actually, I'm pretty sure you can mix up pitch/roll and get the same result.
draeath  [author] 24 Feb, 2021 @ 3:11pm 
I have my sensors arranged like this [i.imgur.com], where the roll sensor is pointing to port and the pitch sensor is pointing aft.

However, it shouldn't matter if these are pointing left/right or forward/backwards for this, as a 15 degree left roll and a 15 degree right roll have the same effect. Likewise for pitch.

(for completeness, I have the altimeter next to the laser emitter)
Brygun 23 Feb, 2021 @ 7:39pm 
Which way should the sensors be pointing? I use a tilt sensor facing right other left (as well as just about everyone having one facing front)