mirror of
https://github.com/team2059/Zaphod
synced 2025-01-07 22:14:14 -05:00
Changed build script to bash. Removed AutoMain.
This commit is contained in:
parent
ca3e5f513c
commit
4a84b99fff
51
build
51
build
@ -1,39 +1,12 @@
|
||||
#!/usr/bin/python -tt
|
||||
|
||||
import sys,os
|
||||
|
||||
#Should be changed to the name of the *.out file produced in /bin
|
||||
ROBOT_NAME = 'Zaphod'
|
||||
RRIO_IPADDRESS = '10.20.59.2'
|
||||
|
||||
#Global functions for the actions
|
||||
def build():
|
||||
os.system('cd src && make && cd ..')
|
||||
|
||||
def clean():
|
||||
os.system('cd src && make clean && cd ..')
|
||||
|
||||
def deploy():
|
||||
command = 'cd bin && wput '+ ROBOT_NAME+'.out ftp://frc:frc@'+RRIO_IPADDRESS+'/ni-rt/system/FRC_UserProgram.out'
|
||||
os.system(command)
|
||||
|
||||
#Check that there is actually an action to perform
|
||||
if len(sys.argv) == 1:
|
||||
print("Requires an argument")
|
||||
exit()
|
||||
|
||||
#Bulk of the program that checks for the actions it needs to do
|
||||
|
||||
if sys.argv[1] == 'build':
|
||||
build()
|
||||
|
||||
if sys.argv[1] == 'clean':
|
||||
clean()
|
||||
|
||||
if sys.argv[1] == 'buildclean':
|
||||
clean()
|
||||
build()
|
||||
|
||||
if sys.argv[1] == 'deploy':
|
||||
deploy()
|
||||
# vim: ts=4:sw=4:noet
|
||||
#!/bin/bash
|
||||
OUTFILE='Zaphod.out'
|
||||
RRIO_IPADDRESS='10.20.59.2'
|
||||
if [ "$1" = "build" ];then
|
||||
cd src && make
|
||||
elif [ "$1" = "clean" ];then
|
||||
cd src&&make clean
|
||||
elif [ "$1" = "buildclean" ];then
|
||||
cd src&&make clean;make
|
||||
elif [ "$1" = "deploy" ];then
|
||||
cd bin&&wput $OUTFILE ftp://frc:frc@10.20.59.2/ni-rt/system/FRC_UserProgram.out
|
||||
fi
|
||||
|
@ -1,5 +0,0 @@
|
||||
#include "AutoMain.h"
|
||||
HHAuto::HHAuto(){
|
||||
|
||||
}
|
||||
|
@ -1,6 +0,0 @@
|
||||
#include <WPILib.h>
|
||||
#include "../Definitions.h"
|
||||
class HHAuto{
|
||||
public:
|
||||
HHAuto();
|
||||
};
|
@ -7,22 +7,21 @@ HHRobot::HHRobot():
|
||||
collector(new HHCollector()),
|
||||
compressorSystem(new HHCompressor()),
|
||||
dashboard(new HHDashboard()),
|
||||
autoseq(new HHAuto()),
|
||||
sonar(new HHSonar()){
|
||||
netTable = NetworkTable::GetTable("datatable");
|
||||
netTable=NetworkTable::GetTable("datatable");
|
||||
}
|
||||
bool HHRobot::CheckJoystickValues(){
|
||||
float x=ControlSystem->rightJoystickAxisValues[1];
|
||||
float y=ControlSystem->rightJoystickAxisValues[2];
|
||||
if((-.1 < x && x < .1) && (-.1 < y && y < .1)) {
|
||||
dashboard->PutBoolValue("Joysticks Valid", true);
|
||||
if((-.1<x && x<.1) && (-.1<y && y<.1)) {
|
||||
dashboard->PutBoolValue("Joysticks Valid",true);
|
||||
return true;
|
||||
}else{
|
||||
dashboard->PutBoolValue("Joysticks Valid", false);
|
||||
dashboard->PutBoolValue("Joysticks Valid",false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
void HHRobot::DriveRobot(float x, float y){
|
||||
void HHRobot::DriveRobot(float x,float y){
|
||||
if(y>1.0f){
|
||||
y=1.0f;
|
||||
}else if(y!=0.0f&&y<-1.0f){
|
||||
@ -38,30 +37,30 @@ void HHRobot::DriveRobot(float x, float y){
|
||||
left3->SetRaw(int(leftPower));
|
||||
}
|
||||
void HHRobot::UpdateDashboard(){
|
||||
dashboard->PutFloatValue("Shooting Power", ControlSystem->throttle);
|
||||
dashboard->PutFloatValue("Shooting Power",ControlSystem->throttle);
|
||||
}
|
||||
void HHRobot::RunAuto(){
|
||||
int step, time;
|
||||
int step,time;
|
||||
compressorSystem->ExtendCollector();
|
||||
//TODO I have no idea what rate this loop runs at so we are going to have to fine tune the times
|
||||
//Drive for 51 inches/cm/units (or time)
|
||||
if(step == 0 && time < 200){
|
||||
if(sonar->GetInches("FRONTLEFT") >= 51){
|
||||
if(step==0 && time<200){
|
||||
if(sonar->GetInches("FRONTLEFT")>=51){
|
||||
DriveRobot(0,-.5);
|
||||
}else{
|
||||
DriveRobot(0,0);
|
||||
}
|
||||
}else{
|
||||
step = 1;
|
||||
step=1;
|
||||
}
|
||||
//TODO Pass the shooting power and sonar distance as variables to the RunAuto function
|
||||
//Shoot at a power
|
||||
if(step == 1 && time < 500){
|
||||
if(step==1 && time<500){
|
||||
shooter->StartShootingSequence(0.78);
|
||||
}else{
|
||||
step = 2;
|
||||
step=2;
|
||||
}
|
||||
if(step == 2){
|
||||
if(step==2){
|
||||
return;
|
||||
}
|
||||
//Important periodic things
|
||||
@ -78,9 +77,9 @@ void HHRobot::Handler(){
|
||||
shooter->UpdateShooterPosition(targetAngle);
|
||||
//TODO Need to implement a timing system to not break the spike (this function doesn't run the compressor at the moment)
|
||||
compressorSystem->CompressorSystemPeriodic(allowCompressing);
|
||||
collector->UpdateCollector(shooter->isShooting, shooter->GetAngle());
|
||||
collector->UpdateCollector(shooter->isShooting,shooter->GetAngle());
|
||||
if(CheckJoystickValues()) {
|
||||
DriveRobot(ControlSystem->rightJoystickAxisValues[3]+ControlSystem->rightJoystickAxisValues[1], -ControlSystem->rightJoystickAxisValues[2]);
|
||||
DriveRobot(ControlSystem->rightJoystickAxisValues[3]+ControlSystem->rightJoystickAxisValues[1],-ControlSystem->rightJoystickAxisValues[2]);
|
||||
}
|
||||
UpdateDashboard();
|
||||
//Button assignments to actions
|
||||
@ -100,25 +99,25 @@ void HHRobot::Handler(){
|
||||
compressorSystem->RetractCollector();
|
||||
}
|
||||
if(ControlSystem->leftJoystickValues[SHOOTER_ANGLE_ONE]){
|
||||
targetAngle = 100;
|
||||
targetAngle=100;
|
||||
}
|
||||
if(ControlSystem->leftJoystickValues[SHOOTER_ANGLE_TWO]){
|
||||
targetAngle = 120;
|
||||
targetAngle=120;
|
||||
}
|
||||
if(ControlSystem->leftJoystickValues[SHOOTER_ANGLE_THREE]){
|
||||
targetAngle = 90;
|
||||
targetAngle=90;
|
||||
}
|
||||
if(ControlSystem->leftJoystickValues[SHOOTER_ANGLE_FOUR]){
|
||||
targetAngle = 130;
|
||||
targetAngle=130;
|
||||
}
|
||||
if(ControlSystem->rightJoystickValues[DISABLE_COMPRESSOR]){
|
||||
allowCompressing = false;
|
||||
allowCompressing=false;
|
||||
}else{
|
||||
allowCompressing = true;
|
||||
allowCompressing=true;
|
||||
}
|
||||
if(ControlSystem->rightJoystickValues[DRIVE_FOR_DISTANCE]){
|
||||
targetAngle = 100;
|
||||
if(sonar->GetInches("FRONTLEFT") >= 45){
|
||||
targetAngle=100;
|
||||
if(sonar->GetInches("FRONTLEFT")>=45){
|
||||
DriveRobot(0,-.5);
|
||||
}
|
||||
else{
|
||||
|
@ -2,7 +2,6 @@
|
||||
#define __ZAPHOD_ROBOT_H__
|
||||
#include <WPILib.h>
|
||||
#include "HHBase.h"
|
||||
#include "Auto/AutoMain.h"
|
||||
#include "Definitions.h"
|
||||
class JoystickController;
|
||||
class HHShooter;
|
||||
@ -20,7 +19,6 @@ class HHRobot{
|
||||
HHCollector *collector;
|
||||
HHCompressor *compressorSystem;
|
||||
HHDashboard *dashboard;
|
||||
HHAuto *autoseq;
|
||||
HHSonar *sonar;
|
||||
public:
|
||||
HHRobot();
|
||||
|
Loading…
x
Reference in New Issue
Block a user