-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDriveTrain.java
More file actions
63 lines (32 loc) · 1.36 KB
/
Copy pathDriveTrain.java
File metadata and controls
63 lines (32 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
package frc.robot.subsystems;
import edu.wpi.first.math.kinematics.DifferentialDriveWheelSpeeds;
import edu.wpi.first.wpilibj.drive.DifferentialDrive;
import edu.wpi.first.wpilibj.motorcontrol.MotorController;
import edu.wpi.first.wpilibj.motorcontrol.MotorControllerGroup;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
import frc.robot.Constants;
import com.ctre.phoenix6.hardware.TalonFX;
public class DriveTrain extends SubsystemBase {
TalonFX m_leftrear;
TalonFX m_rightrear;
TalonFX m_leftfront;
TalonFX m_rightfront;
MotorControllerGroup m_left;
MotorControllerGroup m_right;
DifferentialDrive m_drive;
E
public DriveTrain() {
m_leftrear = new TalonFX(Constants.k_leftrearPort);
m_rightrear= new TalonFX(Constants.k_rightrearPort);
m_leftfront = new TalonFX(Constants.k_leftfrontPort);
m_rightfront = new TalonFX(Constants.k_rightfrontPort);
m_right = new MotorControllerGroup(m_rightfront, m_rightrear);
m_left = new MotorControllerGroup(m_leftfront, m_leftrear);
m_drive = new DifferentialDrive(m_right, m_left);
}
public void move(double x , double y){
m_drive.arcadeDrive(x,y);
}