Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sirchangealot #10

Open
wants to merge 34 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
91cf4e9
barebones program
JenniferPylko Feb 18, 2015
4b9badf
Merge branch 'sirchangealot' of https://github.com/Pittsford-Robotics…
JenniferPylko Feb 18, 2015
a7c53c9
Switched upper and lower lift sensors so lift works correctly
JenniferPylko Mar 11, 2015
8c61406
Build status now for correct branch
JenniferPylko Mar 12, 2015
a699e82
Remove the git diff part so the build will pass
JenniferPylko Mar 12, 2015
bd29d4e
Don't style check Travis, I know what I'm doing
JenniferPylko Mar 12, 2015
81d83e0
Add explanation for code in TeleopPeriodic()
JenniferPylko Mar 12, 2015
46ac102
Update branch for Travis CI badge
JenniferPylko Mar 13, 2015
14ad19f
Update branch for Travis CI badge
JenniferPylko Mar 13, 2015
fc811a9
Update branch for Travis CI badge
JenniferPylko Mar 13, 2015
ff4bf62
Reversed throttle for drive joystick
JenniferPylko Mar 14, 2015
b462935
Merge pull request #16 from Pittsford-Robotics-3181/feature/throttles
JenniferPylko Mar 14, 2015
ac6ba23
Update branch for Travis CI badge
JenniferPylko Mar 14, 2015
5a9b431
Merge remote-tracking branch 'origin/sirchangealot' into feature/hatc…
JenniferPylko Mar 14, 2015
4ce1eb9
Merge branch 'feature/hatcontrols' into sirchangealot
JenniferPylko Mar 14, 2015
4a2b9b1
Merge pull request #17 from Pittsford-Robotics-3181/sirchangealot
JenniferPylko Mar 14, 2015
f2fca8f
Implemented hat controls
JenniferPylko Mar 14, 2015
263c529
Merge pull request #18 from Pittsford-Robotics-3181/feature/hatcontrols
JenniferPylko Mar 14, 2015
4f6cb7a
Update branch for Travis CI badge
JenniferPylko Mar 14, 2015
80311eb
Anti-wobble works amazingly
JenniferPylko Mar 14, 2015
239dadc
Merge pull request #19 from Pittsford-Robotics-3181/sirchangealot
JenniferPylko Mar 14, 2015
0af83b0
The disabling of the drive system was caused by MotorSafetyHelper being
Ethan-O Mar 14, 2015
733baea
Merge pull request #21 from Pittsford-Robotics-3181/fix/motorsafety
JenniferPylko Mar 14, 2015
dcccbbc
Merge pull request #22 from Pittsford-Robotics-3181/sirchangealot
Ethan-O Mar 14, 2015
9c76bc4
Ethan Attempted to add a function where the liftsystem would move down
Ethan-O Mar 14, 2015
2ef53de
Merge branch 'feature/heightpresets' of https://github.com/Pittsford-…
Ethan-O Mar 14, 2015
8e20429
Print out encoder values for test
Mar 16, 2015
4a163cc
Added printDiagnostics(); and Ethan use encoder->Get() instead of
Mar 17, 2015
2452afc
Presets almost here
Mar 19, 2015
5b94719
The presets kind of work
Mar 20, 2015
835adf1
The presets are complete and are working perfectly
Ethan-O Mar 21, 2015
ded89a6
The presets chagned
Ethan-O Mar 21, 2015
0783669
Encoder Preset Constants and Button Bug Fixes
Mar 21, 2015
265afc3
Merge pull request #24 from Pittsford-Robotics-3181/feature/heightpre…
Mar 21, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/Debug/
.DS_Store
/.settings/language.settings.xml
src/*.o
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,3 @@ install:
- sudo apt-get install frc-toolchain clang-format-3.4
script:
- make
- clang-format --style=file -i src/*.cpp src/*.h
- git diff --exit-code
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
2015 Robot Code for Pittsford Panthers Robotics
===============================================
[![Build Status](https://travis-ci.org/Pittsford-Robotics-3181/2015Robotics.svg?branch=master)](https://travis-ci.org/Pittsford-Robotics-3181/2015Robotics)
[![Build Status](https://travis-ci.org/Pittsford-Robotics-3181/2015Robotics.svg?branch=feature/heightpresets)](https://travis-ci.org/Pittsford-Robotics-3181/2015Robotics)

Here is a line-by-line explanation of my code, well at least the TeleopPeriodic() method, because that's where the stuff that people might find confusing is.
```
robotDrive->MecanumDrive_Cartesian(rightStick->GetX()*(rightStick->GetThrottle()+1.0f)/2.0f, rightStick->GetY()*(rightStick->GetThrottle()+1.0f)/2.0f, rightStick->GetTwist()*(rightStick->GetThrottle()+1.0f)/2.0f, 0.0f);
```
This is just a call to WPILib's Mecanum Drive method, with throttle added.
```
liftMotor->Set(min(max(leftStick->GetY()*0.75f + static_cast<float>(sin(GetClock()/1000.0f))*0.25f, static_cast<float>(-lowerLiftSensor->Get())), static_cast<float>(upperLiftSensor->Get())));
```
The sin of time is just some anti-wobble. The min/max works like this. First it checks if the joystick Y value (+ wobble) (range -1 to 1) against the lower lift sensor with max(). If the sensor is 1, then the stick works. If it's 0, then the stick can only be a positive value, moving it up. The min() call is just the opposite.
```
liftState |= leftStick->GetRawButton(6);
liftState &= !leftStick->GetRawButton(4);
leftLiftServo->Set(90 * liftState);
rightLiftServo->Set(90 * !liftState);
```
The |= expands to `liftState = liftState | leftStick->GetRawButto(6);`. &= does the same thing but with &. An | between liftState and button 6 makes it so when button 6 is 1, liftState will become 1, but if button 6 is 0, liftState will not change. The & does the opposite, changing liftState to 0 if button 4 is 1, but leaving it alone if button 4 is 0. Multiplying 90 by liftState on the left and !liftState on the right makes it so when liftState is 1 left will be 90 and right will be 0, and flip them when liftState is 0.
17 changes: 15 additions & 2 deletions Makefile → makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#along with this program. If not, see <http://www.gnu.org/licenses/>.

AT = @
INCDIR = -I$(HOME)/wpilib/cpp/current/include -Isrc/
INCDIR = -I$(HOME)/wpilib/cpp/current/include
CPPFLAGS += -g -Wall -W $(INCDIR) -std=c++14 -fPIC
LFLAGS = -L$(HOME)/wpilib/cpp/current/lib -lwpi
CXX = arm-frc-linux-gnueabi-g++
Expand All @@ -23,9 +23,22 @@ RMCOMMAND = rm -f
DEPLOYTARGET = roboRIO-$(TEAM).local

SOURCES = $(wildcard src/*.cpp)
HEADERS = $(wildcard src/*.h)
HEADERS = $(wildcard src/*.hpp)
OBJECTS = $(patsubst src/%.cpp,src/%.o,$(wildcard src/*.cpp))



all: $(OBJECTS)
test -d bin/ || mkdir -p bin/
$(CXX) $(CPPFLAGS) $(OBJECTS) $(LFLAGS) -o bin/FRCUserProgram
clean:
@for dir in src; do find $$dir -name \*.o -exec $(RMCOMMAND) {} \; ; done
$(RMCOMMAND) bin/*

deploy:
ssh lvuser$(AT)$(DEPLOYTARGET) "rm /home/lvuser/FRCUserProgram || true"
sftp -oBatchMode=no -b sftpbatchfile lvuser$(AT)$(DEPLOYTARGET)
ssh lvuser$(AT)$(DEPLOYTARGET) ". /etc/profile.d/natinst-path.sh; chmod a+x /home/lvuser/FRCUserProgram; /usr/local/frc/bin/frcKillRobot.sh -t -r"

kill-robot:
ssh lvuser$(AT)$(DEPLOYTARGET) "/usr/local/frc/bin/frcKillRobot.sh"
1 change: 1 addition & 0 deletions sftpbatchfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
put bin/FRCUserProgram /home/lvuser/
46 changes: 0 additions & 46 deletions src/AlignmentGuide.cpp

This file was deleted.

44 changes: 0 additions & 44 deletions src/AlignmentGuide.h

This file was deleted.

26 changes: 0 additions & 26 deletions src/Calibration.h

This file was deleted.

158 changes: 0 additions & 158 deletions src/ControlScheme.cpp

This file was deleted.

47 changes: 0 additions & 47 deletions src/ControlScheme.h

This file was deleted.

Loading