From 32154cf6aadba51bec68891be2c4bf69fb0f789d Mon Sep 17 00:00:00 2001 From: Adam Long Date: Fri, 16 Jan 2015 15:20:34 +0000 Subject: [PATCH] Preliminary can support --- src/HHBase.cpp | 1 + src/HHRobot.cpp | 10 +++------- src/HHRobot.h | 2 +- src/Makefile | 27 +++++++++++++++++++++++++++ src/Makefile.old | 29 +++++++++++++++++++++++++++++ 5 files changed, 61 insertions(+), 8 deletions(-) create mode 100644 src/Makefile create mode 100644 src/Makefile.old diff --git a/src/HHBase.cpp b/src/HHBase.cpp index 20fbdb7..0023bc3 100644 --- a/src/HHBase.cpp +++ b/src/HHBase.cpp @@ -21,6 +21,7 @@ void HHBase::DisabledPeriodic(){} void HHBase::AutonomousPeriodic(){ } void HHBase::TeleopPeriodic(){ + hhbot->Handler(); } void HHBase::Test(){} START_ROBOT_CLASS(HHBase); diff --git a/src/HHRobot.cpp b/src/HHRobot.cpp index fc70017..e381a4b 100644 --- a/src/HHRobot.cpp +++ b/src/HHRobot.cpp @@ -1,20 +1,16 @@ #include "HHRobot.h" #include "HHBase.h" HHRobot::HHRobot(): - // - hhdrive(new RobotDrive(2,0,3,1)), + tmpMotor1(new CANTalon(0)), joystick1(new Extreme3dPro(0)){ - hhdrive->SetExpiration(0.1); - hhdrive->SetInvertedMotor(RobotDrive::kFrontRightMotor, true); - hhdrive->SetInvertedMotor(RobotDrive::kRearLeftMotor,true); } void HHRobot::Init(){ printf("Initing\n"); printf("Code Version: %f\n",0000.1); - //Put table values initally to avoid annoying refreshing } //Main function used to handle periodic tasks on the robot void HHRobot::Handler(){ - hhdrive->MecanumDrive_Cartesian(joystick1->GetJoystickAxis("z"), joystick1->GetJoystickAxis("y"), joystick1->GetJoystickAxis("x")); + tmpMotor1->Set(joystick1->GetJoystickAxis("y")); + SmartDashboard::PutNumber("tmp",joystick1->GetJoystickAxis("y")); } // vim: ts=2:sw=2:et diff --git a/src/HHRobot.h b/src/HHRobot.h index 814029b..21828fd 100644 --- a/src/HHRobot.h +++ b/src/HHRobot.h @@ -5,7 +5,7 @@ #include "hhlib/input/controller/Joystick.h" class HHRobot{ private: - RobotDrive *hhdrive; + CANTalon *tmpMotor1; Extreme3dPro *joystick1; public: HHRobot(); diff --git a/src/Makefile b/src/Makefile new file mode 100644 index 0000000..952e810 --- /dev/null +++ b/src/Makefile @@ -0,0 +1,27 @@ +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=/var/frc/wpilib +EXEC=bin/FRCUserProgram +CLEANSER=rm -r +REMOTEIP=10.20.59.2 + +all : $(OBJECTS) + $(CC) -L$(WPILIB)/lib $(LDFLAGS) -o $(EXEC) $(OBJECTS) -lwpi + +%.o : %.cpp + $(CC) $(CFLAGS) -I$(WPILIB)/include $^ -o $@ + +clean: + $(CLEANSER) $(OBJECTS) + +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 diff --git a/src/Makefile.old b/src/Makefile.old new file mode 100644 index 0000000..b265c91 --- /dev/null +++ b/src/Makefile.old @@ -0,0 +1,29 @@ +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=/var/frc/wpilib +EXEC=bin/FRCUserProgram +CLEANSER=rm -r +REMOTEIP=10.0.1.31 + +all : $(OBJECTS) + $(CC) -L$(WPILIB)/lib $(LDFLAGS) -o $(EXEC) $(OBJECTS) -lwpi + +%.o : %.cpp + $(CC) $(CFLAGS) -I$(WPILIB)/include $^ -o $@ + +clean: + $(CLEANSER) $(OBJECTS) + +deploy: + @ssh -v admin@$(REMOTEIP) "rm /home/lvuser/FRCUserProgram" + @scp bin/FRCUserProgram admin@$(REMOTEIP) + @ssh -v admin@$(REMOTEIP) "/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