From 738139995bca6eb1e478e286a88617d8f45dff83 Mon Sep 17 00:00:00 2001 From: Adam Long Date: Fri, 6 Jun 2014 16:24:28 -0400 Subject: [PATCH] Greatly improved the buildscript to almost makefile like functionality. Also added and alias to the users bashrc (frcbot) --- build.py | 40 ++++++++++++++++++++++++++++++++++++++ configure | 5 ++++- src/Subsystems/Shooter.cpp | 1 + 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 build.py diff --git a/build.py b/build.py new file mode 100644 index 0000000..dafd4dc --- /dev/null +++ b/build.py @@ -0,0 +1,40 @@ +#!/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': + build() + clean() + +if sys.argv[1] == 'deploy': + deploy() + + diff --git a/configure b/configure index 93141c5..55a8844 100755 --- a/configure +++ b/configure @@ -1,8 +1,11 @@ #!/bin/bash git submodule init git submodule update -export PATH=$PATH:$(pwd)/bin/ucpp/ucpp +echo "export PATH=$PATH:$(pwd)/bin/ucpp/ucpp" >> ~/.bashrc +echo "alias frcbot='python build.py'" >> ~/.bashrc cd src ucpp setup -t 2059 ucpp init ucpp configure +cd .. +source ~/.bashrc diff --git a/src/Subsystems/Shooter.cpp b/src/Subsystems/Shooter.cpp index 3e65c5a..0e92e5e 100644 --- a/src/Subsystems/Shooter.cpp +++ b/src/Subsystems/Shooter.cpp @@ -66,6 +66,7 @@ void ZaphodShooter::shootRaw(float power) shooterRight2->SetRaw(int(floatToPWM(-power))); } +//Should be run in a loop void ZaphodShooter::updateShooterPosition() { if(e_ShooterState == IDLE_PRESHOT)