-
Notifications
You must be signed in to change notification settings - Fork 2
Controls
If you're not sure on how to do something, chances are the first thing that pops in your mind will work.
Simply click on any blank space and drag the mouse around.
Scrolling the mouse will zoom in and out. On a trackpad you can simply use a two-finger scroll to zoom in and out. On some devices pinch-to-zoom should even work too.
Click on the "plus" towards the bottom right corner.
Simply click on a point and drag it around.
Right clicking on a point will delete it. On a trackpad you can perform a two finger click.
Right clicking on a path (but not on another point) will create a new point. On a trackpad you can perform a two finger click.
If two paths that execute sequentially don't have the same start and end points you will get weird behavior. To ensure that two paths have the same end and start points you can connect them. To do this drag start of one path near the end of path that executes before it. Drop the path down and click again. The two paths should now have the same end and start point.
If you need to switch which point is selected when they are connected you can click in the same area again to switch between them
The autonomous timeline represents how the auto will run. On the robot each step (different colored section) will be executed from top to bottom.
In the above picture the robot will first sleep for 500ms, then drive the green path, then the blue path, and then finally the orange path.
Sometimes the Auto Timeline can get quite cluttered. You can close and open each step by clicking on the colored heading.
Open Step
Closed Step
Sometimes it is desirable to manually input a position into a path. To do this click on the point to highlight it. Then, find the row in the Auto Timeline that has a dark background. You can then edit the numbers in the textbox to change the location of that point.
From right to left, top to bottom, each point has 5 boxes (Note: The rotation box is linked to the direction of the control vector in non-holonomic mode): X Position Meters, Y Position Meters, Rotation (degrees), X Control Point, Y Control Point.
To reorder items in the Auto Timeline simply drag the step, using the colored section, to the desired position.
Sometimes the robot will need to execute other parts of the robot code during auto. The script step allows you easily execute any part of your robot code from the GUI.
It has a basic syntax that can be used to execute robot code.
Comments can be added by starting a line with a #
.
There is no support for semicolons, brackets, or other control loop logic. The complex control logic should be part of your robot code, not your auto.
This system uses reflection, so it requires all methods that want to be called to be either static
, for the class that contains it to be a singleton that has a public static getInstance()
method, or for a method to be supplied using the @AutoBuilderInstance
Annotation. Apart from ensuring that the methods can be invoked, there is no other configuration you need to do on your robot for this to work!
If you want to schedule a command from your auto. You'll first need to annotate the Command using the @AutoBuilderAccessible annotation
To call a (WPI) Command, simply type the Command's name. You'll know that the command will execute if the text that contains the name of the command turns Dark Teal. The commands will be executed by the Command Scheduler, and the AutoBuilder will not wait for the Command to complete unless you tell the AutoBuilder to do that.
If your Command's class is anonymous, the class will automatically be aliased with the Field's name that contained the instance that the AutoBuilder Grabbed. See more on this here.
If you want to cancel a command, type out the command as if you were trying to call it, and then type our cancel
as the first and only argument.
Each new line is a new method call. Each method call contains a Class followed by a .
and then a method and (optional) arguments that are separated by spaces.
Arguments must either be a primitive type, a String, or an Enum.
An example of a script is shown below.
sleep 500
print printing something yay!
Shooter.setShooterSpeed 5000
Intake.setDeployState DEPLOY
NOTE: The first 2 method call are actually not executed using reflection, but are instead hardcoded in.
Caution: Do NOT catch any interrupted exceptions if you're sleeping, etc... Just have your method throw the interrupted exception. The code executing your method will catch the exception for you. The exception is used to kill the auto when it is ended early. (Like when you disable the robot before the auto is completed). If you must catch it for some reason, be sure to rethrow it!
Likewise if you have any while/for loops in methods being executed by the auto you need to check if the current thread has been interrupted and throw an interrupted exception if it is! The easiest way to do this is to add a short Thead.sleep()
to your loops or you can add if (Thread.interrupted()) throw new InterruptedException();
If you want, the AutoBuilder can repeatedly call your method with a 20ms period if you a) annotate it with the @RequireWait annotation and b) have it return a boolean of false. If you want the AutoBuilder to stop calling your method, you return true in that method.
Potential Use Case: Repeatedly calling an aiming method until the robot has aimed at the target.
@RequireWait
public boolean aimRobot(double targetAngle) {
Rotation2d robotHeading = m_drive.getHeading();
m_drive.arcadeDriveCommand(
() -> 0,
() -> turnPidController.calculate(robotHeading.getDegrees(), targetAngle));
return turnPidController.atSetpoint();
}
If you see a warning icon, that means something is probably wrong.
On a trajectory, it means that the current path does not start at the end of the last path.
On a script, it means that it failed to parse and will not execute properly on the robot code.
If you see the warning symbol on a path step it means that first point on that path is not the same as the last point on the previous path. Click here to learn how to fix this.
If you see the warning symbol on a script step it means that your script is invalid. The method you are trying to call is probably not a valid method that you can call or your arguments have been deemed invalid. You should be able to hover over the text underlined in red to see exactly what the error is.
Undo and redo are supported. Simply press Ctrl + Z
to undo and Ctrl + Shift + Z
to redo