| 1 | /** |
| 2 | * Copyright (c) 2015, www.techhounds.com |
| 3 | * All rights reserved. |
| 4 | * |
| 5 | * <p> |
| 6 | * Redistribution and use in source and binary forms, with or without |
| 7 | * modification, are permitted provided that the following conditions are met: |
| 8 | * </p> |
| 9 | * <ul> |
| 10 | * <li>Redistributions of source code must retain the above copyright |
| 11 | * notice, this list of conditions and the following disclaimer.</li> |
| 12 | * <li>Redistributions in binary form must reproduce the above copyright |
| 13 | * notice, this list of conditions and the following disclaimer in the |
| 14 | * documentation and/or other materials provided with the distribution.</li> |
| 15 | * <li>Neither the name of the www.techhounds.com nor the |
| 16 | * names of its contributors may be used to endorse or promote products |
| 17 | * derived from this software without specific prior written permission.</li> |
| 18 | * </ul> |
| 19 | * |
| 20 | * <p> |
| 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
| 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 23 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 24 | * DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY |
| 25 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 26 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 27 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 28 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 31 | * </p> |
| 32 | */ |
| 33 | |
| 34 | package org.usfirst.frc.team3501.robot; |
| 35 | |
| 36 | import edu.wpi.first.wpilibj.PIDSource; |
| 37 | |
| 38 | /** |
| 39 | * A rotation tracker allows you to keep track of how far the robot has rotated |
| 40 | * since the object was constructed or zeroed. |
| 41 | * |
| 42 | * <p> |
| 43 | * This object is most useful when you want to turn your robot a particular |
| 44 | * number of degrees, or when you want to detect whether your robot is tipping. |
| 45 | * </p> |
| 46 | * |
| 47 | * <p> |
| 48 | * You will typically use the {@link #getRotationTracker} method associated with |
| 49 | * the gyro class associated with your hardware. For example |
| 50 | * {@link GyroItg3200.getRotationTrackerZ()}. |
| 51 | * </p> |
| 52 | */ |
| 53 | public interface RotationTracker extends PIDSource { |
| 54 | |
| 55 | /** |
| 56 | * Returns the angle in signed decimal degrees since construction or zeroing. |
| 57 | * |
| 58 | * <p> |
| 59 | * This value is used as the PID sensor value. |
| 60 | * </p> |
| 61 | * |
| 62 | * @return Number of degrees the robot has rotated in the range of [-INF, |
| 63 | * +INF]. Positive values indicate clockwise rotation (720 means it |
| 64 | * has spun around twice and is facing the same direction). |
| 65 | */ |
| 66 | public double getAngle(); |
| 67 | |
| 68 | /** |
| 69 | * Zeros the rotation tracker so the current direction we are pointing now |
| 70 | * becomes the zero point. |
| 71 | */ |
| 72 | public void zero(); |
| 73 | |
| 74 | } |