Here you can find the source of timeToDriveDistanceDeadReckoning(double distance, double robotMaxSpeed, double targetSpeed)
Parameter | Description |
---|---|
distance | The distance to drive. |
robotMaxSpeed | The max speed of the robot. |
targetSpeed | The max speed to drive this distance from 0 to 1 inclusive. |
public static double timeToDriveDistanceDeadReckoning(double distance, double robotMaxSpeed, double targetSpeed)
//package com.java2s; //License from project: Open Source License public class Main { /**//ww w. j a va 2s. c o m * Return the time to drive a given distance. * * @param distance The distance to drive. * @param robotMaxSpeed The max speed of the robot. * @param targetSpeed The max speed to drive this distance from 0 to 1 inclusive. * @return The time to drive a given distance. */ public static double timeToDriveDistanceDeadReckoning(double distance, double robotMaxSpeed, double targetSpeed) { double distancePerSecond = robotMaxSpeed * targetSpeed; return distance / distancePerSecond; } }