Owning Palette: DriverStation
Requires: FIRST Robotics Competition software. This topic might not match its corresponding palette in LabVIEW depending on your operating system, licensed product(s), and target.
Use the Joystick VIs to get information about one or more joysticks you connect to the driver station. You can connect up to four joysticks to the driver station. In the Teleop mode of the FIRST Robotics Competition (FRC), the robot moves in response to commands it receives from the joysticks.
Use the Open VI to create a JoystickDevRef reference cluster that you then can wire to the other Joystick VIs.
|Close||Closes a reference to the joystick you specify. Use this VI to close each joystick reference that you open with the Open VI.|
|Get||Returns button and scaled axis information about a joystick that you specify. Use the GetAxis VI to return the scaled value of a specific axis of the joystick. Use the GetRawValue VI to return button and raw axis information about the joystick.|
|GetAxis||Returns the scaled value of an axis of a joystick that you specify. Use the GetRawValue VI to return raw axis information about the joystick.|
|GetRawValue||Returns button and raw axis information about a joystick that you specify. Use the Get VI to return button and scaled axis information about the joystick.|
|Open||Opens a reference to the joystick you specify. You must open a reference before using any other VIs on this palette. After you open a reference to the joystick, you can use the other Joystick VIs to read the button and axis values of the joystick.|
|RefNum Registry Get||Gets the reference you specify. You first must set the reference with the RefNum Registry Set VI.|
|RefNum Registry Set||Sets a reference into a registry so that other VIs can call the reference. After you set a reference, you can call that reference with the RefNum Registry Get VI.|
Analog joysticks use a pair of potentiometers or Hall sensors and magnets to measure left-to-right movement and forward-and-back movement. The farther you move the joystick in a certain direction, the faster the object moves in that direction. Most analog joysticks have a resolution of 256 x 256. The Joystick VIs use axis values between –1.0 and 1.0, where 1.0 implies the fastest speed in one direction, and –1.0 implies the fastest speed in the opposite direction. Use the Scaler value of the Get and Get Axis VIs to scale the joystick values to values between –1.0 and 1.0. For example, if the resolution of the joystick is 256 x 256, set the Scaler value to 127. Values between –127 and 0 are scaled to values between –1.0 and 0.0, and values between 0 and 127 are scaled to values between 0.0 and 1.0.
The following figure demonstrates how to open a reference to joystick 1, get the button values and scaled axis values for that joystick, and use those values to specify the Y axis value (Speed) and X axis value (Curve) inputs for the ArcadeDrive VI. Joystick 1 has resolution of 256x256, so you set the Scaler input of the Get VI to 127.
The RobotDrive VIs in the previous figure control a two-wheeled robot using Jaguar motor controllers. The ArcadeDrive VI computes the motor speed from the Y axis value (Speed) and X axis value (Curve) values you specify.