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:
parent
ade2ce7bfb
commit
4c24ac3206
@ -2,7 +2,6 @@
|
|||||||
#include "Subsystems/Drivetrain.h"
|
#include "Subsystems/Drivetrain.h"
|
||||||
#include "Subsystems/Collector.h"
|
#include "Subsystems/Collector.h"
|
||||||
#include "Subsystems/Elevator.h"
|
#include "Subsystems/Elevator.h"
|
||||||
#include "Commands/Drive.h"
|
|
||||||
#include "Commands/Collect.h"
|
#include "Commands/Collect.h"
|
||||||
#include "Commands/Eject.h"
|
#include "Commands/Eject.h"
|
||||||
#include "Commands/Raise.h"
|
#include "Commands/Raise.h"
|
||||||
|
@ -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(){
|
|
||||||
}
|
|
@ -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
|
|
@ -1,9 +1,11 @@
|
|||||||
#include "Eject.h"
|
#include "Eject.h"
|
||||||
|
#include "../DentRobot.h"
|
||||||
Eject::Eject(){
|
Eject::Eject(){
|
||||||
}
|
}
|
||||||
void Eject::Initialize(){
|
void Eject::Initialize(){
|
||||||
}
|
}
|
||||||
void Eject::Execute(){
|
void Eject::Execute(){
|
||||||
|
DentRobot::collector->Set(oi->GetLeftStick()->GetThrottle());
|
||||||
}
|
}
|
||||||
bool Eject::IsFinished(){
|
bool Eject::IsFinished(){
|
||||||
return false;
|
return false;
|
||||||
|
@ -1,11 +1,16 @@
|
|||||||
#include "DentRobot.h"
|
#include "DentRobot.h"
|
||||||
DentRobot::DentRobot():
|
OI* DentRobot::oi=NULL;
|
||||||
driveCommand(new Drive()){
|
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");
|
printf("Initialized");
|
||||||
}
|
}
|
||||||
void DentRobot::RobotInit(){
|
void DentRobot::RobotInit(){
|
||||||
printf("Initializing");
|
|
||||||
CommandBase::init();
|
|
||||||
}
|
}
|
||||||
void DentRobot::DisabledPeriodic(){
|
void DentRobot::DisabledPeriodic(){
|
||||||
Scheduler::GetInstance()->Run();
|
Scheduler::GetInstance()->Run();
|
||||||
|
@ -1,15 +1,18 @@
|
|||||||
#ifndef DENTROBOT_H
|
#ifndef DENTROBOT_H
|
||||||
#define DENTROBOT_H
|
#define DENTROBOT_H
|
||||||
#include "WPILib.h"
|
#include "WPILib.h"
|
||||||
#include "Commands/Drive.h"
|
#include "OI.h"
|
||||||
#include "Commands/Collect.h"
|
#include "Subsystems/Elevator.h"
|
||||||
#include "Commands/Eject.h"
|
#include "Subsystems/Drivetrain.h"
|
||||||
#include "Commands/Raise.h"
|
#include "Subsystems/Collector.h"
|
||||||
#include "Commands/Lower.h"
|
|
||||||
class DentRobot: public IterativeRobot {
|
class DentRobot: public IterativeRobot {
|
||||||
private:
|
private:
|
||||||
Command *driveCommand = NULL;
|
Command *driveCommand = NULL;
|
||||||
public:
|
public:
|
||||||
|
static OI* oi;
|
||||||
|
static Collector* collector;
|
||||||
|
static Drivetrain* drivetrain;
|
||||||
|
static Elevator* elevator;
|
||||||
DentRobot();
|
DentRobot();
|
||||||
void RobotInit();
|
void RobotInit();
|
||||||
void DisabledPeriodic();
|
void DisabledPeriodic();
|
||||||
|
27
src/Makefile
Normal file
27
src/Makefile
Normal 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
|
16
src/OI.cpp
16
src/OI.cpp
@ -1,4 +1,20 @@
|
|||||||
#include "OI.h"
|
#include "OI.h"
|
||||||
|
#include "Commands/Lower.h"
|
||||||
|
#include "Commands/Raise.h"
|
||||||
|
#include "Commands/Collect.h"
|
||||||
|
#include "Commands/Eject.h"
|
||||||
|
|
||||||
OI::OI() {
|
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;
|
||||||
}
|
}
|
||||||
|
3
src/OI.h
3
src/OI.h
@ -6,7 +6,10 @@
|
|||||||
class OI
|
class OI
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
Joystick *leftStick, *rightStick;
|
||||||
public:
|
public:
|
||||||
OI();
|
OI();
|
||||||
|
Joystick* GetRightStick();
|
||||||
|
Joystick* GetLeftStick();
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
@ -2,6 +2,12 @@
|
|||||||
#include "../RobotMap.h"
|
#include "../RobotMap.h"
|
||||||
|
|
||||||
Collector::Collector() : Subsystem("Collector") {
|
Collector::Collector() : Subsystem("Collector") {
|
||||||
|
motor1=new Talon(0);
|
||||||
|
motor2=new Talon(1);
|
||||||
}
|
}
|
||||||
void Collector::InitDefaultCommand() {
|
void Collector::InitDefaultCommand() {
|
||||||
}
|
}
|
||||||
|
void Collector::Set(float power){
|
||||||
|
motor1->Set(power);
|
||||||
|
motor2->Set(power);
|
||||||
|
}
|
||||||
|
@ -5,8 +5,10 @@
|
|||||||
class Collector: public Subsystem
|
class Collector: public Subsystem
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
Talon *motor1, *motor2;
|
||||||
public:
|
public:
|
||||||
Collector();
|
Collector();
|
||||||
void InitDefaultCommand();
|
void InitDefaultCommand();
|
||||||
|
void Set(float);
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
#include "Elevator.h"
|
#include "Elevator.h"
|
||||||
#include "../RobotMap.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);
|
pot=new AnalogPotentiometer(0);
|
||||||
leftMotor=new Talon(1);
|
leftMotor=new Talon(1);
|
||||||
rightMotor=new Talon(0);
|
rightMotor=new Talon(0);
|
||||||
SetAbsoluteTolerance(0.004);
|
//SetAbsoluteTolerance(0.004);
|
||||||
}
|
}
|
||||||
void Elevator::InitDefaultCommand(){
|
void Elevator::InitDefaultCommand(){
|
||||||
}
|
}
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
#define ELEVATOR_H
|
#define ELEVATOR_H
|
||||||
|
|
||||||
#include "WPILib.h"
|
#include "WPILib.h"
|
||||||
#include "Commands/PIDSubsystem.h"
|
//#include "Commands/PIDSubsystem.h"
|
||||||
class Elevator: public PIDSubsystem
|
//class Elevator: public PIDSubsystem{
|
||||||
{
|
class Elevator: public Subsystem{
|
||||||
private:
|
private:
|
||||||
AnalogPotentiometer *pot;
|
AnalogPotentiometer *pot;
|
||||||
Talon *leftMotor, *rightMotor;
|
Talon *leftMotor, *rightMotor;
|
||||||
|
Loading…
Reference in New Issue
Block a user