Eagan Robotics (26869, 26870, 26871, 26872) Progress Updates #253
Replies: 3 comments 14 replies
-
|
Task 2: We were pleasantly surprised by how easy this was to extend from just the Mecanum example. The Systemcore built in IMU orientations were also a little confusing at first, but overall it was pretty straightforward. Below is the entirety of our robot code for that-- not too bad! package first.robot;
import org.wpilib.drive.MecanumDrive;
import org.wpilib.driverstation.DefaultUserControls;
import org.wpilib.framework.TimedRobot;
import org.wpilib.hardware.expansionhub.ExpansionHubMotor;
import org.wpilib.hardware.imu.OnboardIMU;
public class Robot extends TimedRobot {
public final ExpansionHubMotor rearRight = new ExpansionHubMotor(0, 0);
public final ExpansionHubMotor rearLeft = new ExpansionHubMotor(0, 1);
public final ExpansionHubMotor frontRight = new ExpansionHubMotor(0, 2);
public final ExpansionHubMotor frontLeft = new ExpansionHubMotor(0, 3);
private static final OnboardIMU.MountOrientation kIMUMountOrientation =
OnboardIMU.MountOrientation.LANDSCAPE;
private final MecanumDrive robotDrive;
private final OnboardIMU imu = new OnboardIMU(kIMUMountOrientation);
private final DefaultUserControls controls = new DefaultUserControls();
public Robot() {
frontLeft.setReversed(true);
rearLeft.setReversed(true);
imu.resetYaw();
robotDrive =
new MecanumDrive(
frontLeft::setThrottle,
rearLeft::setThrottle,
frontRight::setThrottle,
rearRight::setThrottle);
}
@Override
public void teleopPeriodic() {
robotDrive.driveCartesian(
-controls.getGamepad(0).getLeftY(),
controls.getGamepad(0).getLeftX(),
controls.getGamepad(0).getRightX(),
imu.getRotation2d());
}
}Additional things we plan to explore in the near future:
|
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.











Uh oh!
There was an error while loading. Please reload this page.
-
Hi all!
We were really excited to start working so we got started with things as they currently are.
Task 1:
Feedback:
We'll be repeating some of this setup as students become available (most are currently busy with standardized tests).
Here's our test chassis:

Beta Was this translation helpful? Give feedback.
All reactions