简体   繁体   English

这个计算如何工作?

[英]How works this calculation?

I am working with dmx that gives me values from 0 to 255 and the motor moves from -270 to 270. I need the calculation that this program uses.我正在使用 dmx,它给我的值从 0 到 255,电机从 -270 移动到 270。我需要这个程序使用的计算。

(i am using lua) (我正在使用lua)

Img 1图 1

Img 2图 2

Img 3图 3

Not an expert of your technology, but from your images, it seems that you have a linear function from [0, 255] -> [-270, 270]不是您的技术专家,但从您的图像来看,您似乎有一个来自 [0, 255] -> [-270, 270] 的线性 function

So I guess the value 129 gives you a motor value of 2,1 approximately.所以我猜值 129 给你的电机值大约为 2,1。

I let you check this and process the other values accordingly.我让您检查并相应地处理其他值。 If needed, draw a function graph to see the shape of your function.如果需要,请绘制 function 图以查看 function 的形状。

Luke100000 gave the following formulas: 1- dmx / 255 * 540 - 270 = motor 2- motor (x) = 9/138176 x ^ 2 + 290313/138176 x - 270 Luke100000 给出了以下公式: 1- dmx / 255 * 540 - 270 = 电机 2- 电机 (x) = 9/138176 x ^ 2 + 290313/138176 x - 270

the first if I get a value of 255 gives me 270 the second if I get a value of 255 it gives me 265.7724569868085第一个如果我得到 255 的值给我 270 第二个如果我得到一个 255 的值它给我 265.7724569868085

so the first would be the most accurate.所以第一个是最准确的。

Thanks for the help.谢谢您的帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM