This commit is contained in:
Zelina 2024-04-05 16:34:31 +02:00
parent 1578ee9c3e
commit 4d56bd4dfa

View file

@ -38,9 +38,8 @@ public class FTC2024WeRobotControl {
* the width size of the tiles on the ground in metres * the width size of the tiles on the ground in metres
*/ */
private final double ground_tiles_width = 61.0e-2; // metres private final double ground_tiles_width = 61.0e-2; // metres
// //
private final double defaultspeed = 0.6; private final double defaultspeed = 0.6;
private final double defaultanglespeed = 0.4;
private ElapsedTime timer; private ElapsedTime timer;
@ -65,6 +64,16 @@ public class FTC2024WeRobotControl {
* @param motor_speed = (optional) double between 0 and 1; motor power; default * @param motor_speed = (optional) double between 0 and 1; motor power; default
* to 1 * to 1
*/ */
public void boxElv(){
Parent.lmelevator.setVelocity(600);
Parent.rmelevator.setVelocity(600);
Parent.lmelevator.setTargetPosition(90);
Parent.rmelevator.setTargetPosition(90);
Parent.lmelevator.setMode(DcMotor.RunMode.RUN_TO_POSITION);
Parent.rmelevator.setMode(DcMotor.RunMode.RUN_TO_POSITION);
}
public double getSpeedFromMotorSpeed(double motor_speed) { public double getSpeedFromMotorSpeed(double motor_speed) {
double speed_tour_par_minutes = this.tour_par_minutes * motor_speed; double speed_tour_par_minutes = this.tour_par_minutes * motor_speed;
double speed = (speed_tour_par_minutes / 60) * this.wheel_perimeter; double speed = (speed_tour_par_minutes / 60) * this.wheel_perimeter;
@ -135,7 +144,7 @@ public class FTC2024WeRobotControl {
Parent.harvestmotor.setPower(motor_speed); Parent.harvestmotor.setPower(motor_speed);
} }
public void harvest() { public void harvest() {
this.harvest(1.0); this.harvest(1.0);
} }
/* /*
@ -154,9 +163,9 @@ public class FTC2024WeRobotControl {
double left_multiplier = -((double) Math.signum(angle)); double left_multiplier = -((double) Math.signum(angle));
double right_multiplier = ((double) Math.signum(angle)); double right_multiplier = ((double) Math.signum(angle));
double m_power = motor_speed; double m_power = motor_speed;
if(Math.abs(angle)==180){ if(Math.abs(angle)==180){
angle = (double) ( ( (double) Math.signum(angle) ) * 179.9 ); angle = (double) ( ( (double) Math.signum(angle) ) * 179.9 );
} }
while(Parent.opModeIsActive() && (Math.abs(robotOrientation.getYaw(AngleUnit.DEGREES) - start_yaw) < Math.abs(angle))){ while(Parent.opModeIsActive() && (Math.abs(robotOrientation.getYaw(AngleUnit.DEGREES) - start_yaw) < Math.abs(angle))){
robotOrientation = Parent.imu.getRobotYawPitchRollAngles(); robotOrientation = Parent.imu.getRobotYawPitchRollAngles();
double yaw = robotOrientation.getYaw(AngleUnit.DEGREES); double yaw = robotOrientation.getYaw(AngleUnit.DEGREES);
@ -170,7 +179,7 @@ public class FTC2024WeRobotControl {
Parent.rm.setPower(0); Parent.rm.setPower(0);
} }
public void rotate(double angle){ public void rotate(double angle){
this.rotate(angle,this.defaultanglespeed); this.rotate(angle,this.defaultspeed);
} }
public void test_forward_10_and_rotate_20deg(){ public void test_forward_10_and_rotate_20deg(){