Stormworks: Build and Rescue

Stormworks: Build and Rescue

评价数不足
Logic - Tilt sensor conversion
   
奖励
收藏
已收藏
取消收藏
标签: v0.3.6
文件大小
发表于
更新日期
25.556 KB
2018 年 8 月 20 日 上午 8:13
2018 年 8 月 20 日 上午 8:29
2 项改动说明 ( 查看 )

订阅以下载
Logic - Tilt sensor conversion

在 Tajin 的 1 个合集中
Logic Examples & Knowhow
54 件物品
描述
Tilt sensors have some limitations as they return only values from -0.25 to 0.25 turns. Meaning that when you do a full rotation, you get the same values twice.
This can be overcome by using two tilt sensors at a 90° angle and a bit of math.

So this example shows the setup and includes two functions for converting the tilt output into something more useful.


Display and function on the left convert the rotation into the -0.5 to 0.5 format (similar to how the compass works).
The function on the right converts it to a 0-1 value. In both cases 0 is pointing up (as indicated by the red triangle).
3 条留言
Tajin  [作者] 2022 年 4 月 4 日 上午 8:07 
@Grimper I've sent you a function block code on discord that you can use for that.
Grimper 2022 年 4 月 4 日 上午 2:04 
Any chance you could extend this so that it can be moved to specific angles like a robotic pivot? I tried doing it myself by just plugging the output of this into a velocity-to-robotic converter, and it kinda works....but has issues with violently flipping around when it passes 1 and goes back to 0.

I assume this is caused by converters expecting the CurrentRotation value of a velocity pivot to keep going up indefinitely rather than reverting back to 0 like yours does, but I don't have the mathematical expertise to fix it.
♛Succubus♛ 2020 年 10 月 25 日 下午 3:58 
can i take your tilt to build my stabilization system for missiles?