001/*----------------------------------------------------------------------------*/ 002/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */ 003/* Open Source Software - may be modified and shared by FRC teams. The code */ 004/* must be accompanied by the FIRST BSD license file in the root directory of */ 005/* the project. */ 006/*----------------------------------------------------------------------------*/ 007 008package edu.wpi.first.wpilibj; 009 010/** 011 * JoystickBase Interface. 012 */ 013public abstract class JoystickBase extends GenericHID { 014 public JoystickBase(int port) { 015 super(port); 016 } 017 018 /** 019 * Get the z position of the HID. 020 * 021 * @param hand which hand, left or right 022 * @return the z position 023 */ 024 public abstract double getZ(Hand hand); 025 026 public double getZ() { 027 return getZ(Hand.kRight); 028 } 029 030 /** 031 * Get the twist value. 032 * 033 * @return the twist value 034 */ 035 public abstract double getTwist(); 036 037 /** 038 * Get the throttle. 039 * 040 * @return the throttle value 041 */ 042 public abstract double getThrottle(); 043 044 /** 045 * Is the trigger pressed. 046 * 047 * @return true if pressed 048 */ 049 public final boolean getTrigger() { 050 return getTrigger(Hand.kRight); 051 } 052 053 /** 054 * Is the trigger pressed. 055 * 056 * @param hand which hand 057 * @return true if the trigger for the given hand is pressed 058 */ 059 public abstract boolean getTrigger(Hand hand); 060 061 /** 062 * Is the top button pressed. 063 * 064 * @return true if the top button is pressed 065 */ 066 public final boolean getTop() { 067 return getTop(Hand.kRight); 068 } 069 070 /** 071 * Is the top button pressed. 072 * 073 * @param hand which hand 074 * @return true if hte top button for the given hand is pressed 075 */ 076 public abstract boolean getTop(Hand hand); 077 078 public abstract int getPOV(int pov); 079 080 public abstract int getPOVCount(); 081 082 public abstract HIDType getType(); 083 084 public abstract String getName(); 085 086 public abstract void setOutput(int outputNumber, boolean value); 087 088 public abstract void setOutputs(int value); 089 090 public abstract void setRumble(RumbleType type, double value); 091}