Hello there coders I have a question. how would you convert moving forward in inches to moving forward for an amount of time. I have a 4 motor blue cartridge 1:2 gear ratio drive base if that helps.
You would code like this…
(Insert Motor Name Here).spinFor(forward, 15 ,seconds);
yes I know that how for i transfer this to that and get the time correct
drivetrain.FORWARD(24, INCHES)
Speed (in/sec) * time (sec) = distance
What cartridge motors are you using?
blue cardridige with a 2:1 gear ratio drivebase
Here is the formula to get in/sec from motor speed and wheel diameter:
( {Motor RPM} * {Gear ratio} ) * (wheel diameter*3.141) = Inches/second
For a 300 rpm drivebase, it’s either going 43 in/sec (2.75 in omnis), 51 in/sec (3.25 in omnis), or 63 in/sec (4 in omnis). I would recommend you redo these calculations to check my answers and to possible get some decimal places in there for more accuracy
After you’ve found your inches/second, here is the formula to get the time for a certain distance:
Time (seconds) = Distance(Inches) / Speed (Inches/second)
The formulas however will never produce the exact same distance as you plan it to due to external factors (wheel slippage, drive drift, shaft/screw/gear friction, etc.)
Note - this assumes instantaneous acceleration and (presumably) deceleration (assuming the OP wants the robot to stop after it moves the distance). This is a reasonable explanation for deriving the distance and time equations assuming constant acceleration: