Skip to content

Set up the GUI

varun7654 edited this page Jan 4, 2022 · 21 revisions

Before you start

This app stores most of its configuration in json config files. This page will guide you through setting everything up so that you can use the app. Unfortunately, some stuff is still hardcoded and you will need to edit the source code to change this stuff. Fortunately, you can still use the app without editing those values. We're working on getting removing all hardcoded values so that there will be no need to edit the source code.

The app saves all its data when it is closed. It will overwrite all changes you have made while the app was open. CLOSE THE APP BEFORE YOU EDIT THE CONFIGS.

Setting up the config

Lauch the app and find your config

  1. You will first need to launch the app and then close it. Since everything is saved when the app is closed this is when all the files will be created.
  2. Refer to the following table to find the location of the config file based on your OS
OS Config Folder Location
Windows %appdata%/AutoBuilder
Mac ~/Library/Preferences/AutoBuilder
Linux XDG_CONFIG_HOME/AutoBuilder
Linux (if XDG_CONFIG_HOME is not present) ~/.config/AutoBuilder

scriptMethods Set up your script methods

This is ignored unless useReflection is set to false.

See: I don't want to use reflection

Default: "scriptMethods" : [ "print", "sleep" ]

teamNumber Set your team number

This number is used to connect to your robot. Not setting this will prevent you from uploading autos and seeing the live preview.

Default : "teamNumber" : 3476

Set your robot dimensions

This is used to determine the bounding box preview that is seen when dragging points around the field. Units are in meters.

Defualt: "robotLength" : 0.9191625, "robotWidth" : 0.9229725

networkTablesEnabled Enable/Disable Networktables

If you are getting lag spikes while using the app and are not connected to the robot you can disable networktables to fix the lag spikes.

Warning: You will not be able to connect to the robot if you disable this.

Default: "networkTablesEnabled" : true

useReflection Decide if you want to use reflection

Keep this value set to true if you want to use the reflection powered scripting features. Keep this enabled unless you have a reason to disable it.

Default: "useReflection" : true

pathingConfig Pathing config

This section is what powers the path preview. You must set this up correctly for your robot to work. Failure to do so will cause all sorts of weird behavior. These values need to be the real values that your robot uses. The path is calculated in the GUI using the following values. Changing these same values in the robot code will have no effect on the path that the robot drives!!

maxVelocityMetersPerSecond

The max velocity of the robot

maxAccelerationMetersPerSecondSq

The max acceleration of the robot

Other constraints

The trajectoryConstraints section is a list of all the constraints that will be applied to the robot path. These are the same constraints that you would add by calling TrajectoryConfig#addConstraint

All the default WPI constrains are added by default for your reference. You should simply delete the ones that you will not use.

Below you will also find all the constraints you can add to this list. Simply copy the json and change the values to your needs

Centripetal Acceleration Constraint

    {
      "type" : "CentripetalAccelerationConstraint",
      "maxCentripetalAccelerationMetersPerSecondSq" : 2.032
    }

Differential Drive Voltage Constraint

    {
      "type" : "DifferentialDriveVoltageConstraint",
      "feedforward" : {
        "ks" : 5.0,
        "kv" : 1.0,
        "ka" : 0.0
      },
      "kinematics" : {
        "trackWidthMeters" : 0.93
      },
      "maxVoltage" : 10.0
    }

Differential Drive Kinematics Constraint

    {
      "type" : "DifferentialDriveKinematicsConstraint",
      "kinematics" : {
        "trackWidthMeters" : 0.93
      },
      "maxSpeedMetersPerSecond" : 2.0
    }

Elliptical Region Constraint

    {
      "type" : "EllipticalRegionConstraint",
      "center" : {
        "x" : 20.0,
        "y" : 25.0
      },
      "radii" : {
        "x" : 2.7755575615628914E-17,
        "y" : 0.35355339059327373
      },
      "constraint" : add the json of another constraint you want to only happen in this area
    }

Max Velocity Constraint

    {
      "type" : "MaxVelocityConstraint",
      "maxVelocity" : 2.0
    }

Mecanum Drive Kinematics Constraint

    {
      "type" : "MecanumDriveKinematicsConstraint",
      "kinematics" : {
        "frontLeftWheelMeters" : {
          "x" : -0.5,
          "y" : 0.5
        },
        "frontRightWheelMeters" : {
          "x" : 0.5,
          "y" : 0.5
        },
        "rearLeftWheelMeters" : {
          "x" : -0.5,
          "y" : 0.5
        },
        "rearRightWheelMeters" : {
          "x" : -0.5,
          "y" : -0.5
        }
      },
      "maxSpeedMetersPerSecond" : 2.0
    }

Rectangular Region Constraint

    {
      "type" : "RectangularRegionConstraint",
      "bottomLeftPoint" : {
        "x" : 0.0,
        "y" : 0.0
      },
      "topRightPoint" : {
        "x" : 20.0,
        "y" : 20.0
      },
      "constraint" : add the json of another constraint you want to only happen in this area
    }

Swerve Drive Kinematics Constraint

     {
      "type" : "SwerveDriveKinematicsConstraint",
      "kinematics" : {
        "wheelsMeters" : [ {
          "x" : -0.5,
          "y" : 0.5
        }, {
          "x" : 0.5,
          "y" : 0.5
        }, {
          "x" : -0.5,
          "y" : 0.5
        }, {
          "x" : -0.5,
          "y" : -0.5
        } ]
      },
      "maxSpeedMetersPerSecond" : 2.0
    }

Custom Constraints

You will need to add your constraint class manually into the code. After you do that, you need to ensure that constraint will be serialized properly.

To do this:

  1. Add your class as a JsonSubType in me.varun.autobuilder.wpi.math.trajectory.constraint.TrajectoryConstraint
  2. Ensure that you class can get serialized and deserialized properly. You will need to add the proper annotations to your code so that data is read and saved properly. It is probably easier to look at one of the other subtypes in the above class and see how we added the annotations to the WPI classes.

Other config options

You probably don't need to change them, but here what they do anyways.

selectedAuto Selected Auto

This determines which the GUI should read/save to.

Default: "selectedAuto" : "auto.json"

pointScaleFactor Point Scale Factor

This number is used to multiply the positions that are stored in meters to get their pixel position to be able to render them.

Default "pointScaleFactor" : 129.70079

Origin X & Y

This is how many pixels the background image is translated. The defualt it moving the image to the left 422 pixel and down 589 pixels. This is done so that (0,0) in the application space is equivalent to the (0,0) on the image.

Default: "originX" : -422.0, "originY" : -589.0