mirror of
https://github.com/trc492/FtcTemplate.git
synced 2025-07-02 21:41:24 -07:00
Updated trclib.
Updated ftclib. Added support for SparkFun OTOS odometry sensor.
This commit is contained in:
Submodule TeamCode/src/main/java/ftclib updated: 82c7841751...08bc2787ee
@ -31,7 +31,9 @@ import org.openftc.easyopencv.OpenCvCameraRotation;
|
|||||||
import ftclib.drivebase.FtcRobotDrive;
|
import ftclib.drivebase.FtcRobotDrive;
|
||||||
import ftclib.drivebase.FtcSwerveDrive;
|
import ftclib.drivebase.FtcSwerveDrive;
|
||||||
import ftclib.motor.FtcMotorActuator.MotorType;
|
import ftclib.motor.FtcMotorActuator.MotorType;
|
||||||
|
import ftclib.sensor.FtcSparkFunOtos;
|
||||||
import trclib.dataprocessor.TrcUtil;
|
import trclib.dataprocessor.TrcUtil;
|
||||||
|
import trclib.drivebase.TrcDriveBase;
|
||||||
import trclib.drivebase.TrcDriveBase.DriveOrientation;
|
import trclib.drivebase.TrcDriveBase.DriveOrientation;
|
||||||
import trclib.driverio.TrcGameController.DriveMode;
|
import trclib.driverio.TrcGameController.DriveMode;
|
||||||
import trclib.pathdrive.TrcPose2D;
|
import trclib.pathdrive.TrcPose2D;
|
||||||
@ -152,7 +154,6 @@ public class RobotParams
|
|||||||
public static final boolean showVisionStat = false;
|
public static final boolean showVisionStat = false;
|
||||||
// Drive Base
|
// Drive Base
|
||||||
public static final boolean useDriveBase = false;
|
public static final boolean useDriveBase = false;
|
||||||
public static final boolean useExternalOdometry = false;
|
|
||||||
// Subsystems
|
// Subsystems
|
||||||
public static final boolean useSubsystems = false;
|
public static final boolean useSubsystems = false;
|
||||||
} //class Preferences
|
} //class Preferences
|
||||||
@ -295,6 +296,7 @@ public class RobotParams
|
|||||||
driveMotorType = MotorType.DcMotor;
|
driveMotorType = MotorType.DcMotor;
|
||||||
driveMotorNames = new String[] {"lfDriveMotor", "rfDriveMotor"};
|
driveMotorNames = new String[] {"lfDriveMotor", "rfDriveMotor"};
|
||||||
driveMotorInverted = new boolean[] {true, false};
|
driveMotorInverted = new boolean[] {true, false};
|
||||||
|
odometryType = TrcDriveBase.OdometryType.MotorOdometry;
|
||||||
// Odometry Wheels
|
// Odometry Wheels
|
||||||
odWheelXScale = odWheelYScale = Math.PI * ODWHEEL_DIAMETER / ODWHEEL_CPR;
|
odWheelXScale = odWheelYScale = Math.PI * ODWHEEL_DIAMETER / ODWHEEL_CPR;
|
||||||
xOdWheelIndices = new int[] {FtcRobotDrive.INDEX_RIGHT_BACK};
|
xOdWheelIndices = new int[] {FtcRobotDrive.INDEX_RIGHT_BACK};
|
||||||
@ -303,6 +305,8 @@ public class RobotParams
|
|||||||
yOdWheelIndices = new int[] {FtcRobotDrive.INDEX_LEFT_FRONT, FtcRobotDrive.INDEX_RIGHT_FRONT};
|
yOdWheelIndices = new int[] {FtcRobotDrive.INDEX_LEFT_FRONT, FtcRobotDrive.INDEX_RIGHT_FRONT};
|
||||||
yOdWheelXOffsets = new double[] {-144.0 * TrcUtil.INCHES_PER_MM, -12.0 * TrcUtil.INCHES_PER_MM};
|
yOdWheelXOffsets = new double[] {-144.0 * TrcUtil.INCHES_PER_MM, -12.0 * TrcUtil.INCHES_PER_MM};
|
||||||
yOdWheelYOffsets = new double[] {144.0 * TrcUtil.INCHES_PER_MM, -12.0 * TrcUtil.INCHES_PER_MM};
|
yOdWheelYOffsets = new double[] {144.0 * TrcUtil.INCHES_PER_MM, -12.0 * TrcUtil.INCHES_PER_MM};
|
||||||
|
// Absolute Odometry
|
||||||
|
absoluteOdometry = null;
|
||||||
// Drive Motor Odometry
|
// Drive Motor Odometry
|
||||||
yDrivePosScale = 0.02166184604662450653409090909091; // in/count
|
yDrivePosScale = 0.02166184604662450653409090909091; // in/count
|
||||||
// Robot Drive Characteristics
|
// Robot Drive Characteristics
|
||||||
@ -360,6 +364,7 @@ public class RobotParams
|
|||||||
driveMotorType = MotorType.DcMotor;
|
driveMotorType = MotorType.DcMotor;
|
||||||
driveMotorNames = new String[] {"lfDriveMotor", "rfDriveMotor", "lbDriveMotor", "rbDriveMotor"};
|
driveMotorNames = new String[] {"lfDriveMotor", "rfDriveMotor", "lbDriveMotor", "rbDriveMotor"};
|
||||||
driveMotorInverted = new boolean[] {true, false, true, false};
|
driveMotorInverted = new boolean[] {true, false, true, false};
|
||||||
|
odometryType = TrcDriveBase.OdometryType.AbsoluteOdometry;
|
||||||
// Odometry Wheels
|
// Odometry Wheels
|
||||||
odWheelXScale = odWheelYScale = Math.PI * ODWHEEL_DIAMETER / ODWHEEL_CPR;
|
odWheelXScale = odWheelYScale = Math.PI * ODWHEEL_DIAMETER / ODWHEEL_CPR;
|
||||||
xOdWheelIndices = new int[] {FtcRobotDrive.INDEX_RIGHT_BACK};
|
xOdWheelIndices = new int[] {FtcRobotDrive.INDEX_RIGHT_BACK};
|
||||||
@ -368,6 +373,18 @@ public class RobotParams
|
|||||||
yOdWheelIndices = new int[] {FtcRobotDrive.INDEX_LEFT_FRONT, FtcRobotDrive.INDEX_RIGHT_FRONT};
|
yOdWheelIndices = new int[] {FtcRobotDrive.INDEX_LEFT_FRONT, FtcRobotDrive.INDEX_RIGHT_FRONT};
|
||||||
yOdWheelXOffsets = new double[] {-144.0 * TrcUtil.INCHES_PER_MM, -12.0 * TrcUtil.INCHES_PER_MM};
|
yOdWheelXOffsets = new double[] {-144.0 * TrcUtil.INCHES_PER_MM, -12.0 * TrcUtil.INCHES_PER_MM};
|
||||||
yOdWheelYOffsets = new double[] {144.0 * TrcUtil.INCHES_PER_MM, -12.0 * TrcUtil.INCHES_PER_MM};
|
yOdWheelYOffsets = new double[] {144.0 * TrcUtil.INCHES_PER_MM, -12.0 * TrcUtil.INCHES_PER_MM};
|
||||||
|
// Absolute Odometry
|
||||||
|
if (odometryType == TrcDriveBase.OdometryType.AbsoluteOdometry)
|
||||||
|
{
|
||||||
|
FtcSparkFunOtos.Config otosConfig = new FtcSparkFunOtos.Config()
|
||||||
|
.setOffset(0.0, 0.0, 0.0)
|
||||||
|
.setScale(1.0, 1.0);
|
||||||
|
absoluteOdometry = new FtcSparkFunOtos("SparkfunOtos", otosConfig);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
absoluteOdometry = null;
|
||||||
|
}
|
||||||
// Drive Motor Odometry
|
// Drive Motor Odometry
|
||||||
xDrivePosScale = 0.01924724265461924299065420560748; // in/count
|
xDrivePosScale = 0.01924724265461924299065420560748; // in/count
|
||||||
yDrivePosScale = 0.02166184604662450653409090909091; // in/count
|
yDrivePosScale = 0.02166184604662450653409090909091; // in/count
|
||||||
@ -429,6 +446,7 @@ public class RobotParams
|
|||||||
driveMotorType = MotorType.DcMotor;
|
driveMotorType = MotorType.DcMotor;
|
||||||
driveMotorNames = new String[] {"lfDriveMotor", "rfDriveMotor", "lbDriveMotor", "rbDriveMotor"};
|
driveMotorNames = new String[] {"lfDriveMotor", "rfDriveMotor", "lbDriveMotor", "rbDriveMotor"};
|
||||||
driveMotorInverted = new boolean[] {true, false, true, false};
|
driveMotorInverted = new boolean[] {true, false, true, false};
|
||||||
|
odometryType = TrcDriveBase.OdometryType.OdometryWheels;
|
||||||
// Odometry Wheels
|
// Odometry Wheels
|
||||||
odWheelXScale = odWheelYScale = Math.PI * ODWHEEL_DIAMETER / ODWHEEL_CPR;
|
odWheelXScale = odWheelYScale = Math.PI * ODWHEEL_DIAMETER / ODWHEEL_CPR;
|
||||||
xOdWheelIndices = new int[] {FtcRobotDrive.INDEX_RIGHT_BACK};
|
xOdWheelIndices = new int[] {FtcRobotDrive.INDEX_RIGHT_BACK};
|
||||||
@ -437,6 +455,8 @@ public class RobotParams
|
|||||||
yOdWheelIndices = new int[] {FtcRobotDrive.INDEX_LEFT_FRONT, FtcRobotDrive.INDEX_RIGHT_FRONT};
|
yOdWheelIndices = new int[] {FtcRobotDrive.INDEX_LEFT_FRONT, FtcRobotDrive.INDEX_RIGHT_FRONT};
|
||||||
yOdWheelXOffsets = new double[] {-144.0 * TrcUtil.INCHES_PER_MM, -12.0 * TrcUtil.INCHES_PER_MM};
|
yOdWheelXOffsets = new double[] {-144.0 * TrcUtil.INCHES_PER_MM, -12.0 * TrcUtil.INCHES_PER_MM};
|
||||||
yOdWheelYOffsets = new double[] {144.0 * TrcUtil.INCHES_PER_MM, -12.0 * TrcUtil.INCHES_PER_MM};
|
yOdWheelYOffsets = new double[] {144.0 * TrcUtil.INCHES_PER_MM, -12.0 * TrcUtil.INCHES_PER_MM};
|
||||||
|
// Absolute Odometry
|
||||||
|
absoluteOdometry = null;
|
||||||
// Drive Motor Odometry
|
// Drive Motor Odometry
|
||||||
xDrivePosScale = 0.01924724265461924299065420560748; // in/count
|
xDrivePosScale = 0.01924724265461924299065420560748; // in/count
|
||||||
yDrivePosScale = 0.01924724265461924299065420560748; // in/count
|
yDrivePosScale = 0.01924724265461924299065420560748; // in/count
|
||||||
|
@ -50,21 +50,18 @@ public class RobotBase
|
|||||||
|
|
||||||
case DifferentialRobot:
|
case DifferentialRobot:
|
||||||
robotInfo = new RobotParams.DifferentialParams();
|
robotInfo = new RobotParams.DifferentialParams();
|
||||||
robotDrive = RobotParams.Preferences.useDriveBase?
|
robotDrive = RobotParams.Preferences.useDriveBase? new FtcDifferentialDrive(robotInfo): null;
|
||||||
new FtcDifferentialDrive(robotInfo, RobotParams.Preferences.useExternalOdometry): null;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MecanumRobot:
|
case MecanumRobot:
|
||||||
robotInfo = new RobotParams.MecanumParams();
|
robotInfo = new RobotParams.MecanumParams();
|
||||||
robotDrive = RobotParams.Preferences.useDriveBase?
|
robotDrive = RobotParams.Preferences.useDriveBase? new FtcMecanumDrive(robotInfo): null;
|
||||||
new FtcMecanumDrive(robotInfo, RobotParams.Preferences.useExternalOdometry): null;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SwerveRobot:
|
case SwerveRobot:
|
||||||
robotInfo = new RobotParams.SwerveParams();
|
robotInfo = new RobotParams.SwerveParams();
|
||||||
robotDrive = RobotParams.Preferences.useDriveBase?
|
robotDrive = RobotParams.Preferences.useDriveBase?
|
||||||
new FtcSwerveDrive(
|
new FtcSwerveDrive((RobotParams.SwerveParams) robotInfo): null;
|
||||||
(RobotParams.SwerveParams) robotInfo, RobotParams.Preferences.useExternalOdometry): null;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
Submodule TeamCode/src/main/java/trclib updated: 9413c20e34...315029e439
Reference in New Issue
Block a user