Skip to content
This repository has been archived by the owner on Jan 15, 2021. It is now read-only.

Problems with the HAT switch on Logitech Extreme 3D Pro Joystick #60

Open
kevintran-git opened this issue Jan 21, 2019 · 0 comments
Open

Comments

@kevintran-git
Copy link

Describe the bug
On the Logitech Extreme 3D Pro Joystick, there is a HAT (POV) switch on the top of the joystick. In the WPILIB code, it returns the angle that it is pressed at, in degrees. However, in SnobotSim, it is represented as a button, that is on when it displaced from its origin, and off otherwise. This is inaccurate, and the addition of a button throws off all other button ports on the Joystick by 1.

Also, the Y- and X- axes of the joystick are reversed. I don't know how to configure this through the setup.

Quick Glance Configuration
Please provide the following information

  1. SnobotSimPlugin version - "2019-0.2.0"
  2. SnobotSim version - 2019-0.0.1-RC
  3. GradleRIO version - "2019.1.1"
  4. I am using 64-bit Windows 10.
  5. I am testing this using a modified version of JavaExample on Snobot sim examples.

To Reproduce

package frc.robot;

import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.TimedRobot;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;

public class Robot extends TimedRobot
{
    private final Joystick mJoystick = new Joystick(0);

    public Robot() {}

    @Override
    public void teleopPeriodic()
    {
        for(int i = 1; i<= 12; i++){
            SmartDashboard.putBoolean("Button " + i, mJoystick.getRawButton(i));
        }

        SmartDashboard.putNumber("Joystick Y", mJoystick.getY());
        SmartDashboard.putNumber("Joystick X", mJoystick.getX());
    }
}

Then just look in the SmartDashboard.

Expected behavior
mJoystick.getPOV() should return a clockwise angle of the HAT switch's angle, or -1 if it isn't pressed. Currently the POV just doesn't exist in code.

Detailed Setup

plugins {
    id "java"
    id "edu.wpi.first.GradleRIO" version "2019.1.1"
    id "com.snobot.simulator.plugin.SnobotSimulatorPlugin" version "2019-0.2.0" apply false
}

def ROBOT_MAIN_CLASS = "frc.robot.Main"

// Define my targets (RoboRIO) and artifacts (deployable files)
// This is added by GradleRIO's backing project EmbeddedTools.
deploy {
    targets {
        roboRIO("roborio") {
            // Team number is loaded either from the .wpilib/wpilib_preferences.json
            // or from command line. If not found an exception will be thrown.
            // You can use getTeamOrDefault(team) instead of getTeamNumber if you
            // want to store a team number in this file.
            team = frc.getTeamNumber()
        }
    }
    artifacts {
        frcJavaArtifact('frcJava') {
            targets << "roborio"
            // Debug can be overridden by command line, for use with VSCode
            debug = frc.getDebugOrDefault(false)
        }
        // Built in artifact to deploy arbitrary files to the roboRIO.
        fileTreeArtifact('frcStaticFileDeploy') {
            // The directory below is the local directory to deploy
            files = fileTree(dir: 'src/main/deploy')
            // Deploy to RoboRIO target, into /home/lvuser/deploy
            targets << "roborio"
            directory = '/home/lvuser/deploy'
        }
    }
}

// Set this to true to enable desktop support.
def includeDesktopSupport = true

// Maven central needed for JUnit
repositories {
    mavenCentral()
}

/////////////////////////////////////////////////////
// Snobot Sim

apply plugin: com.snobot.simulator.plugin.SnobotSimulatorPlugin

configurations {
    snobotSimCompile
}

// This isn't necessary, but running analysis on your code is a good idea. If you do it, the files should probably be in your project dir,
// but since this is shared I have it in a more centralized location
apply from: "../styleguide/java_style.gradle"
// End Snobot Sim
/////////////////////////////////////////////////////

// Defining my dependencies. In this case, WPILib (+ friends), and vendor libraries.
// Also defines JUnit 4.
dependencies {
    compile wpi.deps.wpilib()
    compile wpi.deps.vendor.java()
    nativeZip wpi.deps.vendor.jni(wpi.platforms.roborio)
    nativeDesktopZip wpi.deps.vendor.jni(wpi.platforms.desktop)
    testCompile 'junit:junit:4.12'

    snobotSimCompile snobotSimJava()
}

// Setting up my Jar File. In this case, adding all libraries into the main jar ('fat jar')
// in order to make them all available at runtime. Also adding the manifest so WPILib
// knows where to look for our Robot Class.
jar {
    from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
    manifest edu.wpi.first.gradlerio.GradleRIOPlugin.javaManifest(ROBOT_MAIN_CLASS)
}

Additional context
I understand that you may not have the joystick physically present. If so, how would I set up the Joystick software myself?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant