Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to calculate required MaxVelocity?

Asked by 8 years ago

How can I calculate the required Motor MaxVelocity to move 2 motors from 0 degrees and 0 degrees to 90 degrees and 37 degrees so they reach their target angle at the same time?

0
Any Code to show us what you're trying to do? GeezuzFusion 200 — 8y

1 answer

Log in to vote
1
Answered by 8 years ago

First you'll want to know how many radians the motors must move instead of degrees, you can calculate this with the math.rad function:

local a1 = math.rad(90)
local a2 = math.rad(37)

If you would use these values as each Motors' MaxVelocity then they could move 90 degrees and 37 degrees every 60th of a second, so if we divide them by 60 they would move 90 degrees and 37 degrees in one second:

motor1.MaxVelocity = math.rad(90)/60
motor2.MaxVelocity = math.rad(37)/60

You can multiply the 60 by the amount of seconds that you want the rotations to take if you want more or less than one second:

local seconds = 4
local steps = seconds*60
motor1.MaxVelocity = math.rad(90)/steps
motor2.MaxVelocity = math.rad(37)/steps
Ad

Answer this question