Please note that the content contained in this document is out-of-date for the current competition season. Please feel free to use it as a reference moving forward.
The Advanced robot Framework uses different type definition clusters to pass information between the sub VIs. These clusters contain data on your motors, joysticks, cameras as well as other information. If you modify your code to include additional motors, joysticks or cameras you will need to modify these type definitions to support those features.
This example demonstrates how to modify the Advanced Robot Framework’s type defs to allow you to use another set of motors controlled by another joystick. This is a specific case, but you can use the same fundamentals to modify the Advanced Robot Framework anyway you want.
First we are going to add the additional code that we want to use in our program. For this example we are going to duplicate the Arcade Drive.vi portion of the Teleop.vi.
Right now the only information being carried in the RobotData Type Definition are the WatchdogDevRef, JoystickDevRef and the RobotDriveDevRef. To support the code that we just added we need to add a JoystickDevRef2 and a RobotDriveDevRef2 to the RobotData Type Definition.
To modify the RobotData Type Definition from the Teleop VI, right-click on the RobotData In and select Open Type Def.. This opens RobotData.ctl
Copy the JoystickDevRef and the RobotDriveDevRef. You can accomplish this by holding down Ctrl then clicking and dragging the JoystickDevRef and the RobotDriveDevRef. After copying these you will now have JoystickDevRef 2 and RobotDriveDevRef 2. Save RobotData.ctl. Since this is a strict type definition the changes that you have made will update all instances of this control.
Now we will go to the Begin VI and initialize all of the Device References. Add two JoystickOpen VIs and an Open2Motor VI and wire in the appropriate constants. Next expand the Unbundle By Name node and add JoystickDevRef, RobotDriveDevRef2 and JoystickDevRef2. Then wire the outputs of the Open VIs to the appropriate inputs on the Unbundle By Name node. Finally save and close the Begin VI.
We can now go back the Teleop VI and give our additional Joystick Get VI and ArcadeDrive VI the device references they need.
You can use these same methods to modify the advanced framework to include additional functionality without disrupting the organization of the framework.