-
Notifications
You must be signed in to change notification settings - Fork 2
Set up the GUI
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.
- 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.
- 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 |
This is ignored unless useReflection
is set to false.
See: I don't want to use reflection
Default: "scriptMethods" : [ "print", "sleep" ]
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
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
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
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
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!!
The max velocity of the robot
The max acceleration of the robot
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
{
"type" : "CentripetalAccelerationConstraint",
"maxCentripetalAccelerationMetersPerSecondSq" : 2.032
}
{
"type" : "DifferentialDriveVoltageConstraint",
"feedforward" : {
"ks" : 5.0,
"kv" : 1.0,
"ka" : 0.0
},
"kinematics" : {
"trackWidthMeters" : 0.93
},
"maxVoltage" : 10.0
}
{
"type" : "DifferentialDriveKinematicsConstraint",
"kinematics" : {
"trackWidthMeters" : 0.93
},
"maxSpeedMetersPerSecond" : 2.0
}
{
"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
}
{
"type" : "MaxVelocityConstraint",
"maxVelocity" : 2.0
}
{
"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
}
{
"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
}
{
"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
}
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:
- Add your class as a JsonSubType in
me.varun.autobuilder.wpi.math.trajectory.constraint.TrajectoryConstraint
- 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.
You probably don't need to change them, but here what they do anyways.
This determines which the GUI should read/save to.
Default: "selectedAuto" : "auto.json"
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
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