We tried to make a simple drive train code for mecanums, and after we got what we think is a good end result we still end up with a first defined here and a line breakpoint error. we are kinda new to programming this year and would like any help we can get. here is the command part where the error is showing up…
#include “DriveMotorCommand.h”
#include “stdio.h”
#include “math.h”
DriveMotorCommand::DriveMotorCommand() {
// Use requires() here to declare subsystem dependencies
Requires(motorControlSubsystem);
}
// Called just before this Command runs the first time
void DriveMotorCommand::Initialize() {
}
// Called repeatedly when this Command is scheduled to run
void RobotDrive::MecanumDrive_Polar(float magnitude, float direction, float rotation)
{
static bool reported = false;
if (!reported)
{
}
// Normalized for full power along the Cartesian axes.
magnitude = Limit(magnitude) * sqrt(2.0);
// The rollers are at 45 degree angles.
double dirInRad = (direction + 45.0) * 3.14159 / 180.0;
double cosD = cos(dirInRad);
double sinD = sin(dirInRad);
double wheelSpeeds[kMaxNumberOfMotors];
wheelSpeeds[kFrontLeftMotor] = sinD * magnitude + rotation;
wheelSpeeds[kFrontRightMotor] = cosD * magnitude - rotation;
wheelSpeeds[kRearLeftMotor] = cosD * magnitude + rotation;
wheelSpeeds[kRearRightMotor] = sinD * magnitude - rotation;
Normalize(wheelSpeeds);
UINT8 syncGroup = 0x80;
m_frontLeftMotor->Set(wheelSpeeds[kFrontLeftMotor] * m_invertedMotors[kFrontLeftMotor] * m_maxOutput, syncGroup);
m_frontRightMotor->Set(wheelSpeeds[kFrontRightMotor] * m_invertedMotors[kFrontRightMotor] * m_maxOutput, syncGroup);
m_rearLeftMotor->Set(wheelSpeeds[kRearLeftMotor] * m_invertedMotors[kRearLeftMotor] * m_maxOutput, syncGroup);
m_rearRightMotor->Set(wheelSpeeds[kRearRightMotor] * m_invertedMotors[kRearRightMotor] * m_maxOutput, syncGroup);
CANJaguar::UpdateSyncGroup(syncGroup);
m_safetyHelper->Feed();
}
// Make this return true when this Command no longer needs to run execute()
bool DriveMotorCommand::IsFinished() {
return false;
}
// Called once after isFinished returns true
void DriveMotorCommand::End() {
motorControlSubsystem->Drive(0);
}
// Called when another command which requires one or more of the same
// subsystems is scheduled to run
void DriveMotorCommand::Interrupted() {
}