diff --git a/FTC2024WeRobotControl.java b/FTC2024WeRobotControl.java index 88a5c96..95251d8 100644 --- a/FTC2024WeRobotControl.java +++ b/FTC2024WeRobotControl.java @@ -39,81 +39,112 @@ public class FTC2024WeRobotControl { */ private final double ground_tiles_width = 61.0e-2; // metres /* - * construct the FTC2024WeRobotControl class, the WeRobot Robot Controller Class for the FTC2024 - * @param Parent = the parent class, use the "this" keyword if you are constructing the class directly in + * construct the FTC2024WeRobotControl class, the WeRobot Robot Controller Class + * for the FTC2024 + * + * @param Parent = the parent class, use the "this" keyword if you are + * constructing the class directly in */ - public FTC2024WeRobotControl(YawPitchhRollAngle Parent){ - this.Parent = Parent; + + public FTC2024WeRobotControl(YawPitchhRollAngle Parent) { + this.Parent = Parent; } + /* * return a metre/sec speed - * @param motor_speed = (optional) double between 0 and 1; motor power; default to 1 + * + * @param motor_speed = (optional) double between 0 and 1; motor power; default + * to 1 */ - public double getSpeedFromMotorSpeed(double motor_speed = 1.0){ - double speed_tour_par_minutes = this.tour_par_minutes*motor_speed; - double speed = (speed_tour_par_minutes/60)*this.wheel_perimeter; - return speed; + public double getSpeedFromMotorSpeed(double motor_speed) { + double speed_tour_par_minutes = this.tour_par_minutes * motor_speed; + double speed = (speed_tour_par_minutes / 60) * this.wheel_perimeter; + return speed; } + /* * return the needed time for a distance + * * @param dist = distance in metre - * @param motor_speed = (optional) double between 0 and 1; motor power; default to 1 + * + * @param motor_speed = (optional) double between 0 and 1; motor power; default + * to 1 */ - public double time_for_dist(double dist, double motor_speed=1.0){ - double speed = getSpeedFromMotorSpeed(motor_speed); - return (dist/speed); + public double time_for_dist(double dist, double motor_speed) { + double speed = getSpeedFromMotorSpeed(motor_speed); + return (dist / speed); } + /* * go forward - * @param n_tiles = the number of tiles (a double because it can be 0.5 or 1.5 etc.) - * @param motor_speed = (optional) double between 0 and 1; motor power; default to 1 + * + * @param n_tiles = the number of tiles (a double because it can be 0.5 or 1.5 + * etc.) + * + * @param motor_speed = (optional) double between 0 and 1; motor power; default + * to 1 */ - public void forward(double n_tiles, double motor_speed = 1.0){ - double total_time = time_for_dist(n_tiles*ground_tiles_width, motor_speed); - double start_time = Parent.runtime.seconds(); - while( Parent.opModeIsActive() && ((Parent.runtime.seconds()-start_time)