2
0
mirror of https://github.com/team2059/Dent synced 2024-12-18 20:52:29 -05:00

Merge branch patch/style-fixes

This commit is contained in:
Austen Adler 2015-03-09 10:15:43 -04:00
commit c10a308abf
22 changed files with 34 additions and 36 deletions

View File

@ -10,9 +10,9 @@ Elevator* CommandBase::elevator = NULL;
BinElevator* CommandBase::binElevator = NULL;
Pneumatics* CommandBase::pneumatics=NULL;
OI* CommandBase::oi = NULL;
CommandBase::CommandBase(char const *name) : Command(name) {
CommandBase::CommandBase(char const *name): Command(name){
}
CommandBase::CommandBase() : Command() {
CommandBase::CommandBase(): Command(){
}
void CommandBase::init(){
drivetrain = new Drivetrain();

View File

@ -10,7 +10,7 @@
#include "OI.h"
#include "WPILib.h"
class CommandBase: public Command {
class CommandBase: public Command{
public:
CommandBase(char const *name);
CommandBase();

View File

@ -1,7 +1,7 @@
#include "AutoDrive.h"
#include "../../DentRobot.h"
// Drive for a short while then stop. Just for testing
AutoDrive::AutoDrive(double duration, double xtmp, double ytmp) : Command("AutoDrive"){
AutoDrive::AutoDrive(double duration, double xtmp, double ytmp): Command("AutoDrive"){
Requires(DentRobot::drivetrain);
SetTimeout(duration);
x=xtmp;

View File

@ -1,6 +1,6 @@
#include "Turn.h"
#include "../../DentRobot.h"
Turn::Turn(double timeout) : Command("Turn"){
Turn::Turn(double timeout): Command("Turn"){
Requires(DentRobot::drivetrain);
SetTimeout(timeout);
}

View File

@ -1,7 +1,7 @@
#include "BinCloseArms.h"
#include "../../DentRobot.h"
#include "../../OI.h"
BinCloseArms::BinCloseArms(double timeout) : Command("BinCloseArms"){
BinCloseArms::BinCloseArms(double timeout): Command("BinCloseArms"){
SetTimeout(timeout);
}
void BinCloseArms::Initialize(){

View File

@ -1,7 +1,7 @@
#include "BinLower.h"
#include "../../DentRobot.h"
#include "../../OI.h"
BinLower::BinLower(float timeout) : Command("BinLower"){
BinLower::BinLower(float timeout): Command("BinLower"){
SetTimeout(timeout);
}
void BinLower::Initialize(){
@ -10,7 +10,7 @@ void BinLower::Execute(){
DentRobot::binElevator->Run(-1.0);
}
bool BinLower::IsFinished(){
if (/*!DentRobot::binElevator->GetElevatorBottom()||*/IsTimedOut()){
if(/*!DentRobot::binElevator->GetElevatorBottom()||*/IsTimedOut()){
printf("Robot stoped BinLowering. Sensor based? %d\n", !DentRobot::binElevator->GetElevatorBottom());
return true;
}else{

View File

@ -1,7 +1,7 @@
#include "BinOpenArms.h"
#include "../../DentRobot.h"
#include "../../OI.h"
BinOpenArms::BinOpenArms(double timeout) : Command("BinOpenArms"){
BinOpenArms::BinOpenArms(double timeout): Command("BinOpenArms"){
SetTimeout(timeout);
}
void BinOpenArms::Initialize(){

View File

@ -1,7 +1,7 @@
#include "BinRaise.h"
#include "../../DentRobot.h"
#include "../../OI.h"
BinRaise::BinRaise(double timeout) : Command("BinRaise"){
BinRaise::BinRaise(double timeout): Command("BinRaise"){
SetTimeout(timeout);
}
void BinRaise::Initialize(){
@ -10,7 +10,7 @@ void BinRaise::Execute(){
DentRobot::binElevator->Run(1.0);
}
bool BinRaise::IsFinished(){
if (/*!DentRobot::binElevator->GetElevatorTop()||*/IsTimedOut()){
if(/*!DentRobot::binElevator->GetElevatorTop()||*/IsTimedOut()){
printf("Robot stoped raising. Sensor based? %d\n", !DentRobot::binElevator->GetElevatorTop());
return true;
}else{

View File

@ -1,5 +1,5 @@
#include "RollIn.h"
RollIn::RollIn(double speed) : Command("RollIn"){
RollIn::RollIn(double speed): Command("RollIn"){
rawSpeed=speed;
}
void RollIn::Initialize(){

View File

@ -1,5 +1,5 @@
#include "RollOut.h"
RollOut::RollOut(double timeout) : Command("RollOut"){
RollOut::RollOut(double timeout): Command("RollOut"){
Requires(DentRobot::collector);
SetTimeout(timeout);
}
@ -9,7 +9,7 @@ void RollOut::Execute(){
//TODO check this value to move the motors in the right direction
// Devide by 2 twice because this speed should be half the collector speed
DentRobot::collector->MoveRollers(-DentRobot::oi->GetLeftThrottle() * 0.8);
SmartDashboard::PutNumber("DriveThrottle",-DentRobot::oi->GetLeftThrottle());
SmartDashboard::PutNumber("DriveThrottle", -DentRobot::oi->GetLeftThrottle());
}
bool RollOut::IsFinished(){
return IsTimedOut();

View File

@ -1,6 +1,6 @@
#include "Drive.h"
#include "../../DentRobot.h"
Drive::Drive() : Command("Drive"){
Drive::Drive(): Command("Drive"){
Requires(DentRobot::drivetrain);
}
void Drive::Initialize(){
@ -11,10 +11,10 @@ void Drive::Execute(){
y = -DentRobot::oi->GetLeftStick()->GetRawAxis(1);
z = DentRobot::oi->GetLeftStick()->GetRawAxis(2);
// Lock the x axis when not holding button 1
//if (DentRobot::oi->GetLeftStick()->GetRawButton(1)){
//if(DentRobot::oi->GetLeftStick()->GetRawButton(1)){
// x=0;
//}
//if (DentRobot::oi->GetLeftStick()->GetRawButton(2)){
//if(DentRobot::oi->GetLeftStick()->GetRawButton(2)){
// y=0;
//}
//X axis, Y axis, Z axis, sensitivity, speed threshold (usually throttle), gyro

View File

@ -1,7 +1,7 @@
#include "Lower.h"
#include "../../DentRobot.h"
#include "../../OI.h"
Lower::Lower(double timeout) : Command("Lower"){
Lower::Lower(double timeout): Command("Lower"){
SetTimeout(timeout);
}
void Lower::Initialize(){
@ -10,7 +10,7 @@ void Lower::Execute(){
DentRobot::elevator->Run(-1.0);
}
bool Lower::IsFinished(){
if (!DentRobot::elevator->GetElevatorBottom()||IsTimedOut()){
if(!DentRobot::elevator->GetElevatorBottom()||IsTimedOut()){
printf("Robot stoped lowering. Sensor based? %d\n", !DentRobot::elevator->GetElevatorBottom());
return true;
}else{

View File

@ -1,7 +1,7 @@
#include "Raise.h"
#include "../../DentRobot.h"
#include "../../OI.h"
Raise::Raise(double timeout) : Command("Raise"){
Raise::Raise(double timeout): Command("Raise"){
SetTimeout(timeout);
}
void Raise::Initialize(){
@ -13,12 +13,12 @@ bool Raise::IsFinished(){
//if(!DentRobot::elevator->GetElevatorMiddle()){
// DentRobot::elevator->stoppedAtSensor=true;
//}
//if ((DentRobot::elevator->stoppedAtSensor)){
//if((DentRobot::elevator->stoppedAtSensor)){
// printf("Stopped at the middle sensor\n");
// DentRobot::elevator->stoppedAtSensor=false;
// return true;
//}else if (!DentRobot::elevator->GetElevatorTop()) {
if (!DentRobot::elevator->GetElevatorTop()||!DentRobot::elevator->GetElevatorMiddle()||IsTimedOut()){
//}else if(!DentRobot::elevator->GetElevatorTop()){
if(!DentRobot::elevator->GetElevatorTop()||!DentRobot::elevator->GetElevatorMiddle()||IsTimedOut()){
printf("Robot stopped raising. Sensor based? %d\n", !DentRobot::elevator->GetElevatorTop()||!DentRobot::elevator->GetElevatorMiddle());
return true;
}else{

View File

@ -3,7 +3,7 @@
#include "Commands/CommandGroup.h"
#include "../../DentRobot.h"
#include "../../RobotMap.h"
CheckDrive::CheckDrive(int motorID) : CommandGroup("CheckDrive"){
CheckDrive::CheckDrive(int motorID): CommandGroup("CheckDrive"){
Requires(DentRobot::drivetrain);
motor = motorID;
}

View File

@ -43,7 +43,7 @@ void DentRobot::RobotInit(){
SmartDashboard::PutBoolean("Elevator Bottom", false);
SmartDashboard::PutBoolean("Elevator Top", false);
//Drive speed
SmartDashboard::PutNumber("DriveSpeedReductionThresh",2);
SmartDashboard::PutNumber("DriveSpeedReductionThresh", 2);
}
void DentRobot::DisabledPeriodic(){
Scheduler::GetInstance()->Run();
@ -60,7 +60,7 @@ void DentRobot::AutonomousPeriodic(){
Scheduler::GetInstance()->Run();
}
void DentRobot::TeleopInit(){
if (aut != NULL){
if(aut != NULL){
aut->Cancel();
}
}

View File

@ -13,7 +13,7 @@
*
* Features a 4-motor collector, 4-motor mecanum drivetrain, two one-motor elevators
*/
class DentRobot: public IterativeRobot {
class DentRobot: public IterativeRobot{
private:
/**
* @brief The default driving command

2
OI.cpp
View File

@ -10,7 +10,7 @@
#include "Commands/Autonomous/CollectTote.h"
#include "Commands/Autonomous/ReleaseTote.h"
#include "Commands/Test/CheckRobot.h"
OI::OI() {
OI::OI(){
// Joysticks
leftStick=new Joystick(0);
rightStick=new Joystick(1);

3
OI.h
View File

@ -7,8 +7,7 @@
/**
* @brief Controls the robot with joysticks
*/
class OI
{
class OI{
private:
Joystick *leftStick, *rightStick;
public:

View File

@ -1,7 +1,7 @@
#include "Collector.h"
#include "../RobotMap.h"
Collector::Collector() : Subsystem("Collector"){
Collector::Collector(): Subsystem("Collector"){
collectorMotorLeft=new CANTalon(COLLECTOR_LEFT_CAN);
collectorMotorBottom=new CANTalon(COLLECTOR_BOTTOM_CAN);
collectorMotorRamp=new CANTalon(COLLECTOR_RAMP_CAN);

View File

@ -7,8 +7,7 @@
*
* Uses four motors, two on the sides, one on the bottom, and one on the ramp to collect and eject totes
*/
class Collector: public Subsystem
{
class Collector: public Subsystem{
private:
CANTalon *collectorMotorLeft, //<! Left collector motor
*collectorMotorBottom, //<! Bottom collctor motor

View File

@ -2,7 +2,7 @@
#include "../RobotMap.h"
#include "../Commands/Drivetrain/Drive.h"
Drivetrain::Drivetrain() : Subsystem("Drivetrain"){
Drivetrain::Drivetrain(): Subsystem("Drivetrain"){
rightFront = new CANTalon(DRIVE_FRONT_RIGHT_CAN);
leftFront = new CANTalon(DRIVE_FRONT_LEFT_CAN);
rightRear = new CANTalon(DRIVE_BACK_RIGHT_CAN);
@ -15,7 +15,7 @@ void Drivetrain::DriveMecanum(double x, double y, double z, double sensitivity,
double correctX = -(sensitivity*(pow(x, 3))+(1-sensitivity)*x);
double correctY = -(sensitivity*(pow(y, 3))+(1-sensitivity)*y);
double correctZ = -z * 0.5;
if (DentRobot::oi->GetLeftStick()->GetRawButton(9)){
if(DentRobot::oi->GetLeftStick()->GetRawButton(9)){
correctY /= SmartDashboard::GetNumber("DriveSpeedReductionThresh");
}
rightFront->Set((-correctX + correctY - correctZ));

View File

@ -1,7 +1,7 @@
#include "Pneumatics.h"
#include "../RobotMap.h"
Pneumatics::Pneumatics() : Subsystem("Pneumatics"){
Pneumatics::Pneumatics(): Subsystem("Pneumatics"){
solenoid1 = new Solenoid(BINELEVATOR_SOLDENOID_ONE);
solenoid2 = new Solenoid(BINELEVATOR_SOLDENOID_TWO);
}