Moved drive code back into the TankDrive class.

This commit is contained in:
Jason 2016-02-02 09:39:51 -05:00
parent d4ae350953
commit 27b2b418fc
13 changed files with 2120 additions and 1923 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
.metadata
DriveBase/.settings
DriveBase/sysProps.xml
.metadata

View File

@ -2424,3 +2424,128 @@ java.io.IOException: Cannot run program "arm-frc-linux-gnueabi-g++": Launching f
at org.eclipse.ui.actions.BuildAction$1.runInWorkspace(BuildAction.java:287)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:39)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
!SESSION 2016-02-02 09:26:52.353 -----------------------------------------------
eclipse.buildId=4.5.1.M20150904-0015
java.version=1.8.0_66
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Framework arguments: -product org.eclipse.epp.package.cpp.product
Command-line arguments: -os win32 -ws win32 -arch x86 -product org.eclipse.epp.package.cpp.product
!ENTRY org.eclipse.core.resources 2 10035 2016-02-02 09:26:58.155
!MESSAGE The workspace exited with unsaved changes in the previous session; refreshing workspace to recover changes.
!ENTRY org.eclipse.cdt.core 4 0 2016-02-02 09:27:04.242
!MESSAGE Error: Cannot run program "arm-frc-linux-gnueabi-gcc": Launching failed
!STACK 0
java.io.IOException: Cannot run program "arm-frc-linux-gnueabi-gcc": Launching failed
at org.eclipse.cdt.utils.spawner.Spawner.exec(Spawner.java:349)
at org.eclipse.cdt.utils.spawner.Spawner.<init>(Spawner.java:91)
at org.eclipse.cdt.utils.spawner.ProcessFactory.exec(ProcessFactory.java:91)
at org.eclipse.cdt.core.CommandLauncher.execute(CommandLauncher.java:194)
at org.eclipse.cdt.internal.core.BuildRunnerHelper.build(BuildRunnerHelper.java:263)
at org.eclipse.cdt.managedbuilder.language.settings.providers.AbstractBuiltinSpecsDetector.runProgramForLanguage(AbstractBuiltinSpecsDetector.java:759)
at org.eclipse.cdt.managedbuilder.language.settings.providers.AbstractBuiltinSpecsDetector.runForLanguage(AbstractBuiltinSpecsDetector.java:689)
at org.eclipse.cdt.managedbuilder.language.settings.providers.AbstractBuiltinSpecsDetector.runForEachLanguage(AbstractBuiltinSpecsDetector.java:562)
at org.eclipse.cdt.managedbuilder.language.settings.providers.AbstractBuiltinSpecsDetector$1.runInWorkspace(AbstractBuiltinSpecsDetector.java:496)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:39)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
!ENTRY org.eclipse.cdt.core 4 0 2016-02-02 09:27:04.336
!MESSAGE Error: Cannot run program "arm-frc-linux-gnueabi-g++": Launching failed
!STACK 0
java.io.IOException: Cannot run program "arm-frc-linux-gnueabi-g++": Launching failed
at org.eclipse.cdt.utils.spawner.Spawner.exec(Spawner.java:349)
at org.eclipse.cdt.utils.spawner.Spawner.<init>(Spawner.java:91)
at org.eclipse.cdt.utils.spawner.ProcessFactory.exec(ProcessFactory.java:91)
at org.eclipse.cdt.core.CommandLauncher.execute(CommandLauncher.java:194)
at org.eclipse.cdt.internal.core.BuildRunnerHelper.build(BuildRunnerHelper.java:263)
at org.eclipse.cdt.managedbuilder.language.settings.providers.AbstractBuiltinSpecsDetector.runProgramForLanguage(AbstractBuiltinSpecsDetector.java:759)
at org.eclipse.cdt.managedbuilder.language.settings.providers.AbstractBuiltinSpecsDetector.runForLanguage(AbstractBuiltinSpecsDetector.java:689)
at org.eclipse.cdt.managedbuilder.language.settings.providers.AbstractBuiltinSpecsDetector.runForEachLanguage(AbstractBuiltinSpecsDetector.java:562)
at org.eclipse.cdt.managedbuilder.language.settings.providers.AbstractBuiltinSpecsDetector$1.runInWorkspace(AbstractBuiltinSpecsDetector.java:496)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:39)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
!ENTRY org.eclipse.cdt.core 4 0 2016-02-02 09:27:04.424
!MESSAGE Error: Cannot run program "gcc": Launching failed
!STACK 0
java.io.IOException: Cannot run program "gcc": Launching failed
at org.eclipse.cdt.utils.spawner.Spawner.exec(Spawner.java:349)
at org.eclipse.cdt.utils.spawner.Spawner.<init>(Spawner.java:91)
at org.eclipse.cdt.utils.spawner.ProcessFactory.exec(ProcessFactory.java:91)
at org.eclipse.cdt.core.CommandLauncher.execute(CommandLauncher.java:194)
at org.eclipse.cdt.internal.core.BuildRunnerHelper.build(BuildRunnerHelper.java:263)
at org.eclipse.cdt.managedbuilder.language.settings.providers.AbstractBuiltinSpecsDetector.runProgramForLanguage(AbstractBuiltinSpecsDetector.java:759)
at org.eclipse.cdt.managedbuilder.language.settings.providers.AbstractBuiltinSpecsDetector.runForLanguage(AbstractBuiltinSpecsDetector.java:689)
at org.eclipse.cdt.managedbuilder.language.settings.providers.AbstractBuiltinSpecsDetector.runForEachLanguage(AbstractBuiltinSpecsDetector.java:562)
at org.eclipse.cdt.managedbuilder.language.settings.providers.AbstractBuiltinSpecsDetector$1.runInWorkspace(AbstractBuiltinSpecsDetector.java:496)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:39)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
!ENTRY org.eclipse.cdt.core 4 0 2016-02-02 09:27:04.465
!MESSAGE Error: Cannot run program "g++": Launching failed
!STACK 0
java.io.IOException: Cannot run program "g++": Launching failed
at org.eclipse.cdt.utils.spawner.Spawner.exec(Spawner.java:349)
at org.eclipse.cdt.utils.spawner.Spawner.<init>(Spawner.java:91)
at org.eclipse.cdt.utils.spawner.ProcessFactory.exec(ProcessFactory.java:91)
at org.eclipse.cdt.core.CommandLauncher.execute(CommandLauncher.java:194)
at org.eclipse.cdt.internal.core.BuildRunnerHelper.build(BuildRunnerHelper.java:263)
at org.eclipse.cdt.managedbuilder.language.settings.providers.AbstractBuiltinSpecsDetector.runProgramForLanguage(AbstractBuiltinSpecsDetector.java:759)
at org.eclipse.cdt.managedbuilder.language.settings.providers.AbstractBuiltinSpecsDetector.runForLanguage(AbstractBuiltinSpecsDetector.java:689)
at org.eclipse.cdt.managedbuilder.language.settings.providers.AbstractBuiltinSpecsDetector.runForEachLanguage(AbstractBuiltinSpecsDetector.java:562)
at org.eclipse.cdt.managedbuilder.language.settings.providers.AbstractBuiltinSpecsDetector$1.runInWorkspace(AbstractBuiltinSpecsDetector.java:496)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:39)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
!ENTRY org.eclipse.cdt.core 4 0 2016-02-02 09:27:04.507
!MESSAGE Error: Cannot run program "gcc": Launching failed
!STACK 0
java.io.IOException: Cannot run program "gcc": Launching failed
at org.eclipse.cdt.utils.spawner.Spawner.exec(Spawner.java:349)
at org.eclipse.cdt.utils.spawner.Spawner.<init>(Spawner.java:91)
at org.eclipse.cdt.utils.spawner.ProcessFactory.exec(ProcessFactory.java:91)
at org.eclipse.cdt.core.CommandLauncher.execute(CommandLauncher.java:194)
at org.eclipse.cdt.internal.core.BuildRunnerHelper.build(BuildRunnerHelper.java:263)
at org.eclipse.cdt.managedbuilder.language.settings.providers.AbstractBuiltinSpecsDetector.runProgramForLanguage(AbstractBuiltinSpecsDetector.java:759)
at org.eclipse.cdt.managedbuilder.language.settings.providers.AbstractBuiltinSpecsDetector.runForLanguage(AbstractBuiltinSpecsDetector.java:689)
at org.eclipse.cdt.managedbuilder.language.settings.providers.AbstractBuiltinSpecsDetector.runForEachLanguage(AbstractBuiltinSpecsDetector.java:562)
at org.eclipse.cdt.managedbuilder.language.settings.providers.AbstractBuiltinSpecsDetector$1.runInWorkspace(AbstractBuiltinSpecsDetector.java:496)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:39)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
!ENTRY org.eclipse.cdt.core 4 0 2016-02-02 09:27:04.583
!MESSAGE Error: Cannot run program "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64\cl": Launching failed
!STACK 0
java.io.IOException: Cannot run program "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64\cl": Launching failed
at org.eclipse.cdt.utils.spawner.Spawner.exec(Spawner.java:349)
at org.eclipse.cdt.utils.spawner.Spawner.<init>(Spawner.java:91)
at org.eclipse.cdt.utils.spawner.ProcessFactory.exec(ProcessFactory.java:91)
at org.eclipse.cdt.core.CommandLauncher.execute(CommandLauncher.java:194)
at org.eclipse.cdt.internal.core.BuildRunnerHelper.build(BuildRunnerHelper.java:263)
at org.eclipse.cdt.managedbuilder.language.settings.providers.AbstractBuiltinSpecsDetector.runProgramForLanguage(AbstractBuiltinSpecsDetector.java:759)
at org.eclipse.cdt.managedbuilder.language.settings.providers.AbstractBuiltinSpecsDetector.runForLanguage(AbstractBuiltinSpecsDetector.java:689)
at org.eclipse.cdt.managedbuilder.language.settings.providers.AbstractBuiltinSpecsDetector.runForEachLanguage(AbstractBuiltinSpecsDetector.java:562)
at org.eclipse.cdt.managedbuilder.language.settings.providers.AbstractBuiltinSpecsDetector$1.runInWorkspace(AbstractBuiltinSpecsDetector.java:496)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:39)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
!ENTRY org.eclipse.egit.ui 2 0 2016-02-02 09:27:04.901
!MESSAGE Warning: The environment variable HOME is not set. The following directory will be used to store the Git
user global configuration and to define the default location to store repositories: 'C:\Users\Jason'. If this is
not correct please set the HOME environment variable and restart Eclipse. Otherwise Git for Windows and
EGit might behave differently since they see different configuration options.
This warning can be switched off on the Team > Git > Confirmations and Warnings preference page.
!ENTRY edu.wpi.first.wpilib.plugins.core 1 0 2016-02-02 09:27:06.129
!MESSAGE Installing tools if necessary
!ENTRY edu.wpi.first.wpilib.plugins.core 1 0 2016-02-02 09:27:06.149
!MESSAGE Installedtools
!ENTRY edu.wpi.first.wpilib.plugins.core 1 0 2016-02-02 09:27:06.192
!MESSAGE Installing cpp if necessary
!ENTRY edu.wpi.first.wpilib.plugins.core 1 0 2016-02-02 09:27:06.225
!MESSAGE Installedcpp

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,3 @@
#Thu Jan 28 11:18:13 EST 2016
#Tue Feb 02 09:26:57 EST 2016
org.eclipse.core.runtime=2
org.eclipse.platform=4.5.1.v20150904-0015

View File

@ -14,8 +14,7 @@ class Robot : public IterativeRobot {
CANTalon l2_drive;
CANTalon shooter1;
CANTalon shooter2;
RobotDrive drivetrain1;
RobotDrive drivetrain2;
TankDrive drive;
Joystick rstick, lstick;
@ -31,21 +30,11 @@ public:
l2_drive(4),
shooter1(10),
shooter2(11),
drivetrain1(l1_drive, r1_drive),
drivetrain2(l2_drive, r2_drive),
drive(&l1_drive, &l2_drive, &r1_drive, &r2_drive),
rstick(0),
lstick(1)
{
printf("Initializing Robot...");
printf("Initializing TankDrive");
//drive = new TankDrive(&l1_drive, &l2_drive, &r1_drive, &r2_drive);
printf("Ready!");
//l1_drive.SetInverted(true);
//l2_drive.SetInverted(true);
//l1_drive.Set(0, 0);
//l2_drive.Set(0, 0);
//r1_drive.Set(0, 1);
//r2_drive.Set(0, 1);
}
void DisabledInit()
@ -60,7 +49,6 @@ public:
void TeleopInit()
{
printf("Starting Teleop mode");
r1_drive.Enable();
r2_drive.Enable();
l1_drive.Enable();
@ -72,34 +60,16 @@ public:
void TeleopPeriodic()
{
printf("Teleop Periodic Start.");
float speed = lstick.GetY() * ((1.0 - (lstick.GetThrottle()))/2.0);
float rot = lstick.GetX();
drivetrain1.ArcadeDrive(speed, rot, false);
drivetrain2.ArcadeDrive(speed, rot, false);
drive.Drive(&lstick);
float power = (1.0 - rstick.GetThrottle()) / 2.0;
shooter1.Set(power);
shooter2.Set(power);
printf("~Teleop Periodic End.");
}
/**
* Runs the motor from the output of a Joystick.
*
void OperatorControl() {
while (IsOperatorControl() && IsEnabled()) {
// Do Drive.
std::cerr << "In Operator Control";
drive->Drive(&m_stick);
Wait(kUpdatePeriod); // Wait a bit so that the loop doesn't lock everything up.
}
}*/
//TankDrive *drive;
};
START_ROBOT_CLASS(Robot)

View File

@ -13,17 +13,14 @@
#endif // DEADZONE_RADIUS
#include "WPILib.h"
#include <math.h>
class TankDrive {
public:
TankDrive(CANTalon *l1, CANTalon *l2, CANTalon* r1, CANTalon *r2)
{
this->l1 = l1;
this->l2 = l2;
this->r1 = r1;
this->r2 = r2;
dt1 = RobotDrive(l1, r1);
dt2 = RobotDrive(l2, r2);
}
virtual ~TankDrive() { delete l1; delete l2; delete r1; delete r2; }
@ -31,7 +28,7 @@ public:
{
float x = js->GetX(),
y = js->GetY(),
th = js->GetThrottle();
th = ((1.0 - (js.GetThrottle()))/2.0);
// set deadzone
if(x > -DEADZONE_RADIUS && x < DEADZONE_RADIUS)
@ -43,33 +40,14 @@ public:
y = 0;
}
float left=0, right=0;
if(x == 0)
{
left = th * y;
right = left;
}
else if(x < 0)
{
right = th;
left = th * cos(x);
}
else
{
right = th * cos(x);
left = th;
}
l1->Set(left);
l2->Set(left);
r1->Set(right);
r2->Set(right);
float speed = y * th;
float rot = y;
dt1.ArcadeDrive(speed, rot, false);
dt2.ArcadeDrive(speed, rot, false);
}
private:
CANTalon *l1, *l2, *r1, *r2;
RobotDrive dt1, dt2;
};
#endif /* SRC_TANKDRIVE_H_ */