Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
38a3d5b
Add arm.h w/ some IK math and arm length consts
PhyXTGears-1720 Jan 28, 2023
ab6549d
Add #include for cmath
PhyXTGears-1720 Jan 31, 2023
89b32c6
Make Point class take Z param; update 2D points
PhyXTGears-1720 Jan 31, 2023
a26cbf1
Rename "get*Pos" Functions to "calc*Pos" for clarity
PhyXTGears-1720 Jan 31, 2023
b1d6c12
Add .0 to arm consts to denote float type
PhyXTGears-1720 Jan 31, 2023
f4badca
Add empty functions for reading arm angles
PhyXTGears-1720 Feb 1, 2023
ca8bf50
Add functions for getting measured angles on arm
PhyXTGears-1720 Feb 1, 2023
3ee54bd
Add Boundary class for arm movement safety
PhyXTGears-1720 Feb 1, 2023
c89d6b1
Add empty set__Angle arm functions (and add diagram)
PhyXTGears-1720 Feb 7, 2023
037c033
Rename getWristAngle() to getWristRollAngle() for consistency
PhyXTGears-1720 Feb 7, 2023
e26986e
Add forgotten Pragma Once to arm custom classes
PhyXTGears-1720 Feb 7, 2023
083ce40
Factor in Turret in calcIKJointPoses()
PhyXTGears-1720 Feb 8, 2023
0a8c1c4
Update inverse kinematics for 3 dimensions
PhyXTGears-1720 Feb 11, 2023
a76d1fd
Merge branch 'master' into feature/arm
PhyXTGears-1720 Feb 18, 2023
23efaf1
Fix boundary code
PhyXTGears-1720 Feb 18, 2023
830a75b
Add constructor for NotBoundary
PhyXTGears-1720 Feb 18, 2023
950b6f3
Switched from floats to doubles
PhyXTGears-1720 Feb 18, 2023
77b2175
Fix constants prefix
PhyXTGears-1720 Feb 18, 2023
2d5d196
Fix arguments for calcElbowPos()
PhyXTGears-1720 Feb 18, 2023
458d3af
Switch m prefix to m_
PhyXTGears-1720 Feb 18, 2023
a726c28
Mass dump of arm subsystem updates
PhyXTGears-1720 Mar 4, 2023
e032a90
Convert Point to use double instead of float
PhyXTGears-1720 Mar 4, 2023
06d03b5
Fix headers
PhyXTGears-1720 Mar 7, 2023
08bbd47
Add incomplete implementation of motion path.
PhyXTGears-1720 Mar 7, 2023
fe4406c
Merge branch 'master' into feature/arm
PhyXTGears-1720 Mar 8, 2023
346aeea
Add config limits and setpoints for arm subsystem
PhyXTGears-1720 Mar 8, 2023
f798087
Apply conversion factors and zero offsets when reading sensors.
PhyXTGears-1720 Mar 8, 2023
162a946
Clamp values when adjust angles and distances.
PhyXTGears-1720 Mar 8, 2023
0340e64
Rename vars: Ang -> Angle
PhyXTGears-1720 Mar 8, 2023
543ec57
arm: Add method moveToPoint()
PhyXTGears-1720 Mar 8, 2023
a08751a
arm: Rename getWristPoint() to getGripPoint()
PhyXTGears-1720 Mar 8, 2023
8fe373a
Update constants for arm subsystem
PhyXTGears-1720 Mar 8, 2023
92f59ef
arm: Add comment specifying geometric conventions.
PhyXTGears-1720 Mar 8, 2023
51a1475
arm: Fix CylinderBoundary check for point isInside
PhyXTGears-1720 Mar 8, 2023
4f0dee7
arm: Update no go zones
PhyXTGears-1720 Mar 8, 2023
72fed28
arm: Add arm subsystem to robot
PhyXTGears-1720 Mar 9, 2023
056068f
Add Point + Vector -> Point overloaded operator
PhyXTGears-1720 Mar 9, 2023
4d104f3
test: Add tests for box and sphere boundaries
PhyXTGears-1720 Mar 9, 2023
38df1ee
arm: Set config values - calibration
PhyXTGears-1720 Mar 9, 2023
f80676f
arm: Report arm angles on dashboard in degrees
PhyXTGears-1720 Mar 9, 2023
e94e38c
Fix: M_2_PI != 2 * M_PI
PhyXTGears-1720 Mar 9, 2023
a9d5d16
arm: typo in forward kinematics
PhyXTGears-1720 Mar 9, 2023
c4f72cd
arm: Document and fix turrent angle convention
PhyXTGears-1720 Mar 9, 2023
02af6d2
util: replace float with double in Vector
PhyXTGears-1720 Mar 9, 2023
d3e2f38
arm: Remove duplicate Point class
PhyXTGears-1720 Mar 9, 2023
2a24e85
arm: Reapply desmos ik solver
PhyXTGears-1720 Mar 9, 2023
a01cc69
arm: Reapply desmos ik solver: pt 2
PhyXTGears-1720 Mar 9, 2023
90e34d8
arm: Reapply desmos ik solver: pt 3
PhyXTGears-1720 Mar 9, 2023
e86e93f
arm: adjust target z from floor to turret in ik solver
PhyXTGears-1720 Mar 9, 2023
3d559eb
Merge branch 'master' into feature/arm
PhyXTGears-1720 Mar 9, 2023
dd4dc4e
Refactor operator overloads in point.h and vector.h
PhyXTGears-1720 Mar 9, 2023
c679bed
arm: ik solver: move target pt from robot origin to turret origin
PhyXTGears-1720 Mar 9, 2023
5a6eb32
arm: ik solver: fix turret angle again... maybe
PhyXTGears-1720 Mar 9, 2023
ec66791
arm: ik solver: invert sign of constrained vector
PhyXTGears-1720 Mar 9, 2023
16d3b8a
arm: Add PID to shoulder motor to hold position
PhyXTGears-1720 Mar 9, 2023
716d710
Print exception cause when failing to parse config.toml
PhyXTGears-1720 Mar 9, 2023
3a24a58
Move RAD_2_DEG to util/math for others to use.
PhyXTGears-1720 Mar 9, 2023
b7c5e13
arm: ik solver: Fix reversed variables.
PhyXTGears-1720 Mar 10, 2023
ae5adde
arm: Fix typo: control shoulder motor with shoulder pid...
PhyXTGears-1720 Mar 10, 2023
662ce27
arm: Reverse shoulder motor direction
PhyXTGears-1720 Mar 10, 2023
14341b3
arm: Fix boundary limits for floor no-go zone.
PhyXTGears-1720 Mar 10, 2023
2cfbca9
arm: Adjust near zero tolerance for turret and elbow motors
PhyXTGears-1720 Mar 10, 2023
18642d0
arm: Replace bang-bang motor control with clamped linear velocity con…
PhyXTGears-1720 Mar 10, 2023
5c5bf95
arm: Convert limits from raw sensor value to degrees
PhyXTGears-1720 Mar 10, 2023
bae168b
arm: Calibrate shoulder pid and tolerance
PhyXTGears-1720 Mar 10, 2023
44c7c1c
add basic auto
nickquednow Mar 11, 2023
576021c
change compile mode to competition
nickquednow Mar 11, 2023
5510e45
Merge branch 'feature/arm' into competition/princeton
PhyXTGears-1720 Mar 11, 2023
03bf1cf
arm: Add arm teleop command
PhyXTGears-1720 Mar 11, 2023
6096d18
robot: Start arm teleop command in teleop
PhyXTGears-1720 Mar 11, 2023
36afb95
Merge branch 'feature/arm' into competition/princeton
PhyXTGears-1720 Mar 11, 2023
226f6de
Convert simple auto into single command.
PhyXTGears-1720 Mar 11, 2023
5a1d3bf
Merge branch 'auto/simple' into competition/princeton
PhyXTGears-1720 Mar 11, 2023
12de51d
dashboard: Disable reports for arm debug values
PhyXTGears-1720 Mar 11, 2023
4be56ec
dashboard: Report arm motor current
PhyXTGears-1720 Mar 11, 2023
6b708f7
arm: Limit max speed of shoulder motor
PhyXTGears-1720 Mar 10, 2023
ca005a3
arm: Add basic controls for wrist and grip
PhyXTGears-1720 Mar 10, 2023
5aa979b
Merge branch 'feature/arm' into competition/princeton
PhyXTGears-1720 Mar 11, 2023
75ae2ec
Disable simple auto
PhyXTGears-1720 Mar 11, 2023
ab33db5
Disable arm teleop command
PhyXTGears-1720 Mar 11, 2023
b6c94fe
Fix drivetrain rotation
PhyXTGears-1720 Mar 11, 2023
c8e3de6
Enable field oriented driving...
PhyXTGears-1720 Mar 11, 2023
8bab878
Report field oriented mode on dashboard
PhyXTGears-1720 Mar 11, 2023
b1ba987
Fix arm rotation speed constants
PhyXTGears-1720 Mar 11, 2023
a871339
Check input deadzone before squaring input
PhyXTGears-1720 Mar 11, 2023
08cbbf0
arm: Fix polar calculation for arm motion
PhyXTGears-1720 Mar 11, 2023
da39782
Fix drive orientation after zero'ing wheel cancoders
PhyXTGears-1720 Mar 11, 2023
765555d
Take off arm... amputate!
PhyXTGears-1720 Mar 12, 2023
7810e00
Reformat
PhyXTGears-1720 Mar 12, 2023
b3b1594
add basic cube auto
PhyXTGears-1720 Mar 12, 2023
e7cf4b6
drive: Increase teleop speed for eliminations rounds
PhyXTGears-1720 Mar 12, 2023
dea32f1
auto: simple auto scores one cube in hybrid
PhyXTGears-1720 Mar 12, 2023
9aeec2f
drive: Add lock movement to drive X button
PhyXTGears-1720 Mar 14, 2023
6c694a9
arm: Prevent arm movement by moving to current location
PhyXTGears-1720 Mar 14, 2023
749ac4d
arm: Fix arm teleop controls
PhyXTGears-1720 Mar 14, 2023
4c9a09f
arm: Add reset target method to arm teleop command
PhyXTGears-1720 Mar 14, 2023
e794f08
arm: Set current limits on arm motor
PhyXTGears-1720 Mar 14, 2023
1b56539
arm: Calibrate limits and zeroes
PhyXTGears-1720 Mar 14, 2023
d1b012c
remove smartdashboard debugging output
PhyXTGears-1720 Mar 14, 2023
f67f409
remove competition define headers for the simple auto
PhyXTGears-1720 Mar 14, 2023
0f4ec52
change code to align with coding guidelines
PhyXTGears-1720 Mar 14, 2023
a335343
Revert "change code to align with coding guidelines"
nickquednow Mar 22, 2023
fe571bf
change compile mode to debug
nickquednow Mar 22, 2023
d002d5f
remove unneeded headers in robot.h
nickquednow Mar 22, 2023
e5009ac
re-add driverstation field centric output
nickquednow Mar 22, 2023
2bbe6eb
rename c_simpleSuto to c_autoDumpCubeAndScore for clarity
nickquednow Mar 22, 2023
a907c65
Restore missing header import
PhyXTGears-1720 Mar 22, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
id "cpp"
id "google-test-test-suite"
id "edu.wpi.first.GradleRIO" version "2023.3.2"
id "edu.wpi.first.GradleRIO" version "2023.4.2"
}

// Define my targets (RoboRIO) and artifacts (deployable files)
Expand Down
57 changes: 52 additions & 5 deletions src/main/cpp/Robot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,20 @@

#include "external/cpptoml.h"

#include <frc/smartdashboard/SmartDashboard.h>

#include <frc2/command/SequentialCommandGroup.h>
#include <frc2/command/Command.h>
#include <frc/Timer.h>

void Robot::RobotInit() {
try{
c_toml = cpptoml::parse_file(frc::filesystem::GetDeployDirectory()+"/config.toml");
} catch (cpptoml::parse_exception & ex){
std::cerr << "Unable to open file: config.toml" << std::endl;
std::cerr << "Unable to open file: config.toml"
<< std::endl
<< ex.what()
<< std::endl;
exit(1);
}

Expand All @@ -31,11 +40,36 @@ void Robot::RobotInit() {
c_operatorController = new frc::XboxController(Interfaces::k_operatorXboxController);

//Subsystems
c_drivetrain = new Drivetrain(false);
c_drivetrain = new Drivetrain(true);
c_odometry = new Odometry(c_drivetrain);
//c_arm = new ArmSubsystem(c_toml->get_table("arm"));

//Commands
//c_armTeleopCommand = new ArmTeleopCommand(c_arm, c_operatorController);
c_driveTeleopCommand = new DriveTeleopCommand(c_drivetrain, c_driverController);

auto orientWheels = frc2::StartEndCommand{
//dump cube and move auto
[&] () { c_drivetrain->setMotion(0,0.05,0); },
[&] () { c_drivetrain->setMotion(0,0,0); },
{ c_drivetrain }
}.ToPtr();
auto forceOffCube = frc2::StartEndCommand{
[&] () { c_drivetrain->setMotion(0,0.5,0); },
[&] () { c_drivetrain->setMotion(0,0,0); },
{ c_drivetrain }
}.ToPtr();

auto putCubeIntoStation = frc2::StartEndCommand{
[&] () { c_drivetrain->setMotion(0,-0.15,0); },
[&] () { c_drivetrain->setMotion(0,0,0); },
{c_drivetrain}
}.ToPtr();

c_autoDumpCubeAndScore = std::move(orientWheels).WithTimeout(0.5_s)
.AndThen(std::move(forceOffCube).WithTimeout(0.3_s))
.AndThen(std::move(putCubeIntoStation).WithTimeout(2.0_s))
.Unwrap();
}

/**
Expand All @@ -48,6 +82,8 @@ void Robot::RobotInit() {
*/
void Robot::RobotPeriodic() {
frc2::CommandScheduler::GetInstance().Run();

frc::SmartDashboard::PutBoolean("Field Centric Enabled",c_drivetrain->getFieldCentric());
}

/**
Expand All @@ -64,16 +100,23 @@ void Robot::DisabledPeriodic() {}
* RobotContainer} class.
*/
void Robot::AutonomousInit() {
c_autoDumpCubeAndScore->Schedule();
// TODO: Make sure to cancel autonomous command in teleop init.
}

void Robot::AutonomousPeriodic() {}
void Robot::AutonomousPeriodic() {
c_drivetrain->Periodic();// update drivetrain no matter what
}

void Robot::TeleopInit() {
// TODO: Make sure autonomous command is canceled first.
// Make sure autonomous command is canceled first.
c_autoDumpCubeAndScore->Cancel();

//c_armTeleopCommand->Schedule();
//c_armTeleopCommand->resetTarget();
c_driveTeleopCommand->Schedule();
c_drivetrain->enableFieldCentric();
}

/**
* This function is called periodically during operator control.
*/
Expand All @@ -87,6 +130,10 @@ void Robot::TeleopPeriodic() {
if (c_driverController->GetBButtonPressed()) {
c_drivetrain->resetNavxHeading();
}

if(c_driverController->GetXButtonPressed()) {
c_drivetrain->lockMovement(false);
}
}

/**
Expand Down
135 changes: 135 additions & 0 deletions src/main/cpp/commands/arm/ArmTeleopCommand.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
#include "commands/arm/ArmTeleopCommand.h"
#include "subsystems/arm/arm.h"

#include <frc/XboxController.h>

#include <cmath>

#define JOYSTICK_DEADZONE 0.1
#define DEADZONE(input) ((std::abs(input) < JOYSTICK_DEADZONE) ? 0.0 : input)

const double k_maxPointSpeed = 0.005;
const double k_maxPointRotSpeed = (2.0 * M_PI / 10.0) * 0.02; // radians per second in 20ms.
const double k_maxWristRotSpeed = (2.0 * M_PI / 2.0) * 0.02;
const double k_maxGripSpeed = 0.1;
Comment on lines +11 to +14
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should go in the Constants.h file

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

review :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These constants aren't meant to be shared with an other parts of the program. I had concerns that someone might be inclined to reuse them for another purpose and have cause to change them.

I'm inclined to leave this for the competition as it's tested, and change it after.

Copy link
Collaborator

@nickquednow nickquednow Mar 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok. is there a possibility after competition to rename it to be c_ to clarify that it is not intended to be a global constant?


ArmTeleopCommand::ArmTeleopCommand(ArmSubsystem* arm, frc::XboxController* operatorController) {
c_operatorController = operatorController;
c_arm = arm;

AddRequirements(c_arm);
}

void ArmTeleopCommand::Initialize() {
// Update target to current point so arm doesn't move unexpectedly.
m_target = c_arm->getGripPoint();
c_arm->moveToPoint(m_target);
}

void ArmTeleopCommand::Execute() {
{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we add a comment here and at the end of this block saying something like: move the imaginary point

Vector offsetLX;
Vector offsetLY;
Vector offsetRY;
double gripMag = std::sqrt(std::pow(m_target.x,2)+std::pow(m_target.y,2));
double gripDir = std::atan2(m_target.x, m_target.y); // 0 deg == y axis

// Rotate turret. Speed of rotation is reduced the further the arm reaches.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we move the second comment to line 44?

double leftX = c_operatorController->GetLeftX();
// Square input to improve fidelity.
leftX = DEADZONE(leftX);
leftX = std::copysign(std::clamp(leftX * leftX, -1.0, 1.0), leftX);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we use std::pow(leftX,2) here (consistency).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's doesn't matter to me. Either way gets the point across. I'd like to think the c++ compiler is smart enough to convert a function call into a single equivalent multiplication, but I couldn't say for sure.

if (0.0 != leftX) {
// (+) leftX should move turret clockwise.
double dir = gripDir + (leftX * k_maxPointRotSpeed) / std::max(gripMag,1.0);
Point point1(
gripMag * std::sin(dir),
gripMag * std::cos(dir),
m_target.z
);
offsetLX = point1 - m_target;
}

// Extend/retract gripper from/to turret.
double leftY = -c_operatorController->GetLeftY(); /* Invert so + is forward */
// Square input to improve fidelity.
leftY = DEADZONE(leftY);
leftY = std::copysign(std::clamp(leftY * leftY, -1.0, 1.0), leftY);
if (0.0 != leftY) {
// (+) leftY should move away from turret.
double mag = gripMag + (leftY * k_maxPointSpeed);
Point point1(
mag * std::sin(gripDir),
mag * std::cos(gripDir),
m_target.z
);
offsetLY = point1 - m_target;
}

// Move gripper up or down.
double rightY = -c_operatorController->GetRightY(); /* Invert so + is up */
// Square input to improve fidelity.
rightY = DEADZONE(rightY);
rightY = std::copysign(std::clamp(rightY * rightY, -1.0, 1.0), rightY);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we put std::pow(rightY,2) here?

if (0.0 != rightY) {
// (+) rightY should move gripper up.
offsetRY = Vector(0.0, 0.0, rightY * k_maxPointSpeed);
}

m_target = m_target + offsetLX + offsetLY + offsetRY;

c_arm->moveToPoint(m_target);
}

// Rotate wrist clockwise or counterclockwise.
{
double leftTrigger = c_operatorController->GetLeftTriggerAxis();
double rightTrigger = c_operatorController->GetRightTriggerAxis();
double trigger = leftTrigger - rightTrigger;
// Square input to improve fidelity.
trigger = DEADZONE(trigger);
trigger = std::copysign(std::clamp(trigger * trigger, -1.0, 1.0), trigger);

// Use current angle as default so wrist doesn't move wildly upon enable.
double wristTargetAngle = c_arm->getWristRollAngle();

if (0.0 != trigger) {
// (+) trigger should rotate wrist counter-clockwise, looking down forearm.
wristTargetAngle += trigger * k_maxWristRotSpeed;
}

// Move/hold wrist angle.
c_arm->setWristRollAngle(wristTargetAngle);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we add // Rotate wrist clockwise or counterclockwise. here?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is to mark the end of the block? Sure.

If the comment isn't inline with the closing brace, then prefix the comment with // END ....


// Open and close gripper.
{
double bumper =
(c_operatorController->GetRightBumper() ? 1.0 : 0.0)
- (c_operatorController->GetLeftBumper() ? 1.0 : 0.0);

// Use current position as default so grip doesn't move wildly upon enable.
double gripTargetPos = c_arm->getGrip();

if (0.0 != bumper) {
gripTargetPos += bumper * k_maxGripSpeed;
}

// Move/hold grip.
c_arm->setGrip(gripTargetPos);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we add // Open and close gripper here?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same answer as line 103

}

void ArmTeleopCommand::End(bool interrupted) {
// Update target to current point so arm stops.
// Cannot stop motors because shoulder will backdrive and fall.
m_target = c_arm->getGripPoint();
}

bool ArmTeleopCommand::IsFinished() {
return false; // dont end because then we wont be able to drive
}

void ArmTeleopCommand::resetTarget(){
m_target = c_arm->getGripPoint();
}
43 changes: 43 additions & 0 deletions src/main/cpp/commands/arm/MoveToIntake.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#include "commands/arm/MoveToIntake.h"

#include "subsystems/arm/motionPath.h"
#include "subsystems/arm/arm.h"
#include "subsystems/arm/armPose.h"

MoveToIntakeCommand::MoveToIntakeCommand(ArmSubsystem * arm, Point currentPoint) {
m_arm = arm;
m_currentPoint = currentPoint;

AddRequirements(m_arm);
}

void MoveToIntakeCommand::Initialize() {
m_finalTarget = m_arm->m_pointIntake;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we use a geter function here instead?

Point currentPoint = m_arm->getGripPoint();

m_path.emplace(std::move(m_arm->getPathTo(currentPoint, m_finalTarget)));
m_target = m_path->getNextPoint();
}

void MoveToIntakeCommand::Execute() {
if(m_finalTarget.isNear(m_target) && m_arm->isNearPoint(m_target)) {
return;
} else if (m_arm->isNearPoint(m_target)) {
m_target = m_path->getNextPoint();
}

if (!m_arm->isPointSafe(m_target)) {
return;
}

ArmPose calculatedIKPose = m_arm->calcIKJointPoses(m_target);
}

void MoveToIntakeCommand::End(bool isInterrupted) {
//heeyaw
}

bool MoveToIntakeCommand::IsFinished() {
return !m_arm->isPointSafe(m_target)
|| (m_finalTarget.isNear(m_target) && m_arm->isNearPoint(m_target));
}
5 changes: 3 additions & 2 deletions src/main/cpp/commands/drivetrain/driveTeleopCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ void DriveTeleopCommand::Execute() {

// the rotation limit is there in case the driver does not want to spin as fast while driving (specifically limiting the controller input)
c_drivetrain->setMotion(
-DEADZONE(c_driverController->GetLeftX()) * speedFactor,
DEADZONE(c_driverController->GetLeftY()) * speedFactor,
DEADZONE(c_driverController->GetLeftX()) * speedFactor,
-DEADZONE(c_driverController->GetLeftY()) * speedFactor,
// Reverse rotation so right is clockwise robot motion.
DEADZONE(c_driverController->GetRightX()) * Constants::k_maxSpinSpeed
);
}
Expand Down
Loading