NXT Using Joysticks
| For ROBOTC Joystick NXT functions, check out the NXT Joystick Functions page!
|
|
Joystick Control
| ROBOTC supports using Logitech USB joystick controllers to drive your NXT over the USB or Bluetooth communication link. This allows the user to send commands to their robot in real time, rather than having only pre-programmed behaviors.The joystick functionality works by taking data from the joystick controller and sends it to the NXT over the debugger link as a single message.
getJoystickSettings(joystick); |
#include "JoystickDriver.c" // Tells ROBOTC to include the driver file for the joystick. task main() { while(true) { getJoystickSettings(joystick); // Update Buttons and Joysticks motor[motorC] = joystick.joy1_y1; motor[motorB] = joystick.joy1_y2; } } |
Buttons
Joystick Control - Simple
Joystick Control - Game
| There is also a second Joystick Control window, "Joystick Control - Game". This window is specifically designed to emulate the FIRST Tech Challenge game mode. To test your FTC competition programs, you can use the controller station to mimic what the Field Management System will do. This includes switching between Autonomous and User Control, Changing if your robot is on the blue or red alliance and also disabling (or pausing) your robot. These commands can be found on the left side of the Joystick Station.
|
| File:Single expert menu.gif |
After setting the Menu Level to "Expert", you can then access the "Joystick Control - Game" station by:
|
|
| As you can see, the window has a few more options than the "Joystick Control - Simple" screen did. |
|
| If you would like to use two controllers, click the "Dual Joysticks" button to expand the Joystick Control window to facilitate two controllers. You can assign the same controller to both Primary and Secondary Joysticks, but this is not recommended. |
|







