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

Robot compiles (still untested)

This commit is contained in:
Austen Adler 2015-01-17 12:21:16 -05:00
parent ade2ce7bfb
commit 4c24ac3206
14 changed files with 82 additions and 50 deletions

View File

@ -2,7 +2,6 @@
#include "Subsystems/Drivetrain.h"
#include "Subsystems/Collector.h"
#include "Subsystems/Elevator.h"
#include "Commands/Drive.h"
#include "Commands/Collect.h"
#include "Commands/Eject.h"
#include "Commands/Raise.h"

View File

@ -1,15 +0,0 @@
#include "Drive.h"
Drive::Drive(){
}
void Drive::Initialize(){
}
void Drive::Execute(){
}
bool Drive::IsFinished(){
return false;
}
void Drive::End(){
}
void Drive::Interrupted(){
}

View File

@ -1,17 +0,0 @@
#ifndef DRIVE_H
#define DRIVE_H
#include "../CommandBase.h"
#include "WPILib.h"
class Drive: public CommandBase{
public:
Drive();
void Initialize();
void Execute();
bool IsFinished();
void End();
void Interrupted();
};
#endif

View File

@ -1,9 +1,11 @@
#include "Eject.h"
#include "../DentRobot.h"
Eject::Eject(){
}
void Eject::Initialize(){
}
void Eject::Execute(){
DentRobot::collector->Set(oi->GetLeftStick()->GetThrottle());
}
bool Eject::IsFinished(){
return false;

View File

@ -1,11 +1,16 @@
#include "DentRobot.h"
DentRobot::DentRobot():
driveCommand(new Drive()){
OI* DentRobot::oi=NULL;
Collector* DentRobot::collector=NULL;
Drivetrain* DentRobot::drivetrain=NULL;
Elevator* DentRobot::elevator=NULL;
DentRobot::DentRobot(){
oi=new OI();
collector=new Collector();
drivetrain=new Drivetrain();
elevator=new Elevator();
printf("Initialized");
}
void DentRobot::RobotInit(){
printf("Initializing");
CommandBase::init();
}
void DentRobot::DisabledPeriodic(){
Scheduler::GetInstance()->Run();

View File

@ -1,15 +1,18 @@
#ifndef DENTROBOT_H
#define DENTROBOT_H
#include "WPILib.h"
#include "Commands/Drive.h"
#include "Commands/Collect.h"
#include "Commands/Eject.h"
#include "Commands/Raise.h"
#include "Commands/Lower.h"
#include "OI.h"
#include "Subsystems/Elevator.h"
#include "Subsystems/Drivetrain.h"
#include "Subsystems/Collector.h"
class DentRobot: public IterativeRobot {
private:
Command *driveCommand = NULL;
public:
static OI* oi;
static Collector* collector;
static Drivetrain* drivetrain;
static Elevator* elevator;
DentRobot();
void RobotInit();
void DisabledPeriodic();

27
src/Makefile Normal file
View File

@ -0,0 +1,27 @@
REMOTEIP=10.20.59.2
CC=arm-frc-linux-gnueabi-g++
CFLAGS=-std=c++11 -O0 -g3 -Wall -c -fmessage-length=0
LDFLAGS=-Wl,-rpath,/opt/GenICam_v2_3/bin/Linux_armv7-a
SOURCES=$(shell find -type f -name "*.cpp")
OBJECTS=$(SOURCES:.cpp=.o)
WPILIB=/home/stonewareslord/Applications/vagrant/frc-cpp-vagrantfile/wpilib
EXEC=bin/FRCUserProgram
CLEANSER=rm -r
all : $(OBJECTS)
$(CC) -L$(WPILIB)/lib $(LDFLAGS) -o $(EXEC) $(OBJECTS) -lwpi
%.o : %.cpp
$(CC) $(CFLAGS) -I$(WPILIB)/include $^ -o $@
clean:
$(CLEANSER) $(OBJECTS) bin/FRCUserProgram
deploy:
@cat bin/FRCUserProgram | ssh admin@$(REMOTEIP) 'cat > /home/lvuser/FRCUserProgram2&&rm /home/lvuser/FRCUserProgram;mv /home/lvuser/FRCUserProgram2 /home/lvuser/FRCUserProgram&&. /etc/profile.d/natinst-path.sh;chmod a+x /home/lvuser/FRCUserProgram;/usr/local/frc/bin/frcKillRobot.sh -t -r'
putkey:
@test -d ~/.ssh||mkdir ~/.ssh;test -f ~/.ssh/id_rsa||ssh-keygen -t rsa -f ~/.ssh/id_rsa -b 4096 -q -N '';cat ~/.ssh/id_rsa.pub|ssh -v admin@$(REMOTEIP) 'cat >> /tmp/key;mkdir -p ~/.ssh;cat /tmp/key >> ~/.ssh/authorized_keys;rm /tmp/key'
updatemakefile:
@curl -s https://raw.githubusercontent.com/int0x191f2/nameless/master/configure.sh | sh

View File

@ -1,4 +1,20 @@
#include "OI.h"
#include "Commands/Lower.h"
#include "Commands/Raise.h"
#include "Commands/Collect.h"
#include "Commands/Eject.h"
OI::OI() {
leftStick=new Joystick(0);
rightStick=new Joystick(1);
JoystickButton *left10=new JoystickButton(leftStick, 10);
JoystickButton *left11=new JoystickButton(leftStick, 11);
left10->WhenPressed(new Eject());
left11->WhenPressed(new Collect());
}
Joystick* OI::GetRightStick(){
return rightStick;
}
Joystick* OI::GetLeftStick(){
return leftStick;
}

View File

@ -6,7 +6,10 @@
class OI
{
private:
Joystick *leftStick, *rightStick;
public:
OI();
Joystick* GetRightStick();
Joystick* GetLeftStick();
};
#endif

View File

@ -2,6 +2,12 @@
#include "../RobotMap.h"
Collector::Collector() : Subsystem("Collector") {
motor1=new Talon(0);
motor2=new Talon(1);
}
void Collector::InitDefaultCommand() {
}
void Collector::Set(float power){
motor1->Set(power);
motor2->Set(power);
}

View File

@ -5,8 +5,10 @@
class Collector: public Subsystem
{
private:
Talon *motor1, *motor2;
public:
Collector();
void InitDefaultCommand();
void Set(float);
};
#endif

View File

@ -1,14 +1,14 @@
#include "Drivetrain.h"
#include "../RobotMap.h"
Drivetrain::Drivetrain() : Subsystem("Drivetrain") {
Drivetrain::Drivetrain() : Subsystem("Drivetrain"){
frontLeft=new Talon(0);
frontRight=new Talon(1);
backLeft=new Talon(2);
backRight=new Talon(3);
drive=new RobotDrive(frontLeft, frontRight, backLeft, backRight);
}
void Drivetrain::InitDefaultCommand() {
void Drivetrain::InitDefaultCommand(){
}
void Drivetrain::DriveMecanum(float x, float y, float rotation){
drive->MecanumDrive_Cartesian(x, y, rotation);

View File

@ -1,12 +1,13 @@
#include "Elevator.h"
#include "../RobotMap.h"
Elevator::Elevator() : PIDSubsystem("Elevator", kP_real, kI_real, 0.0){
//Elevator::Elevator() : PIDSubsystem("Elevator", kP_real, kI_real, 0.0){
Elevator::Elevator() : Subsystem("Elevator"){
pot=new AnalogPotentiometer(0);
leftMotor=new Talon(1);
rightMotor=new Talon(0);
SetAbsoluteTolerance(0.004);
//SetAbsoluteTolerance(0.004);
}
void Elevator::InitDefaultCommand() {
void Elevator::InitDefaultCommand(){
}
float Elevator::GetPotValue(){
return pot->Get();

View File

@ -2,9 +2,9 @@
#define ELEVATOR_H
#include "WPILib.h"
#include "Commands/PIDSubsystem.h"
class Elevator: public PIDSubsystem
{
//#include "Commands/PIDSubsystem.h"
//class Elevator: public PIDSubsystem{
class Elevator: public Subsystem{
private:
AnalogPotentiometer *pot;
Talon *leftMotor, *rightMotor;