Difference between pages "Creating an RBC file" and "Tutorials/Getting Started/Getting Started with the VEX CORTEX"

From ROBOTC API Guide
(Difference between pages)
Jump to: navigation, search
(Compile and Download)
 
(Step 6: Updating VEXNet Key's firmware (2.0 and later only))
 
Line 1: Line 1:
<yambe:breadcrumb self="Creating an RBC file">Main|Main page</yambe:breadcrumb>
+
{{DISPLAYTITLE:Getting Started with the VEX Cortex}}
 +
<yambe:breadcrumb self="Getting Started with the VEX Cortex">Tutorials|Tutorials</yambe:breadcrumb>
 +
<br />
  
{{tl|1|}}
+
{{toc}}
 +
<br />
  
== What is an RBC file? ==
+
== Configuring the VEX Cortex for a WIRED connection using USB ==
{| style="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#FFFFFF; text-align:left; font-size:100%;" width="100%" cellpadding="5%" cellspacing="0" border="0"
+
{|width="740px"
 
|-
 
|-
|An RBC file is a special type of XML file that can be used with ROBOTC v3.52 or later. Once an RBC file is created properly, you will be able to configure ROBOTC's Platform Type, Compiler Target, Menu Level, and other important settings all with the click of a button. You can even configure the RBC program to load a user program and automatically download it to a robot or Virtual World of your choosing.
+
|This is a guide for setting up the VEX Cortex using the USB A-to-A cable. These steps are required the first time you use your computer to program a specific VEX Cortex, or after you've upated ROBOTC to the latest verstion. Once you've successfully completed these steps you can download your own programs without revisiting them. '''Note: Administrative privileges are required for some of these steps.'''
 +
|}
 +
<br />
 +
 
 +
=== Note: Driver Installation ===
 +
{|width="740px"
 
|-
 
|-
 +
|ROBOTC 3.05 and later automatically installs the necessary drivers for the VEX Cortex, VEXnet Joysticks, and USB-to-Serial Programming cable. If you need to download the drivers for troubleshooting purposes, you can still find them at www.ROBOTC.net/download/cortex:<br />
 +
{{vex2-drivers}}
 
|}
 
|}
 +
<br />
  
== How to create an RBC file ==
+
=== Step 1: Connect the Cortex to your PC ===
{| style="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#FFFFFF; text-align:left; font-size:100%;" width="100%" cellpadding="5%" cellspacing="0" border="0"
+
{|width="740px"
|-
+
|There are several steps required in order to create a working RBC file. You will need an activated installation of ROBOTC and a text file editor installed on the computer. For this demonstration, we used ROBOTC for VEX Robotics 4.0 and Notepad++ as our text file editor.
+
|-
+
|'''1)''' Create a new file in your text file editor (generally found under the 'File -> New' menu option).
+
|-
+
|'''2)''' Save the file with a custom name and a '.rbc' file extension. You may also need to change the 'File Type' dropdown menu to 'All Files', depending on the text editor settings.
+
|-
+
|'''3)''' Add the following parameters to the file:
+
*<?xml version="1.0" encoding="UTF-8"?>
+
*<RBCVersion>1.0.0</RBCVersion>
+
*<Platform></Platform>
+
*<CortexDLMethod></CortexDLMethod>
+
*<CircuitBoard></CircuitBoard>
+
*<MenuLevel></MenuLevel>
+
*<CompilerMode></CompilerMode>
+
*<CompileAndDownload></CompileAndDownload>
+
*<VirtualWorldIndex></VirtualWorldIndex>
+
*<SourceFileName>.c</SourceFileName>
+
*<RVWParameters></RVWParameters>
+
*<SourceCode></SourceCode>
+
|-
+
|'''4)''' Modify the parameters to fit the settings for the program. For a full listing of all of the available parameters, see the 'XML Parameters' section below.
+
 
|-
 
|-
|'''5)''' Save the RBC file.
+
|Connect the VEX Cortex directly to a USB port on your computer using the USB A-to-A cable. Allow a few seconds for Windows to recognize the device.<br />
 +
[[File:vex2-getting-started-connect.JPG]]<br />
 +
<br />
 
|-
 
|-
|'''6)''' Manually open the RBC file icon by double clicking on it. If the file is configured correctly, ROBOTC should open with the specified parameters using the specified source code. If the program does not open correctly (or opens with the wrong settings), double check the parameters for accuracy.
+
|Connect a 7.2V Robot battery to the Cortex and move the POWER switch to the ON position. Optionally, you can connect two motors to MOTOR Ports 2 and 3 for testing a sample program later in the sequence. You can connect 3-wire motors directly, or the newer 2-wire motors using Motor Controller 29 cables.<br />
 +
[[File:vex2-getting-started-battery_motors.JPG]]<br />
 +
''Note: Technically, the battery is not necessary for downloading Master CPU Firmware and ROBOTC Firmware, but it has helped in cases where the USB ports on the computer provide too little power to facilitate a reliable connection to the Cortex.''
 
|}
 
|}
 +
<br />
  
== XML parameters ==
+
=== Step 2: Platform Type and Communication Port ===
===XML Version===
+
{|width="740px"
{| style="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#FFFFFF; text-align:left; font-size:100%;" width="100%" cellpadding="5%" cellspacing="0" border="0"
+
 
|-
 
|-
| The XML Version parameter will identify the document as valid XML. This must always be at the top of the RBC document.
+
|Specify that you are using the Cortex and how it is connected to your computer in ROBOTC. Go to Robot &rarr; Platform Type &rarr; Innovation First (IFI) and select "'''VEX 2.0 Cortex'''" or "'''Natural Language (VEX Cortex)'''".<br />
*'''<?xml version="1.0" encoding="UTF-8"?>'''
+
[[File:vex2-getting-started-platform-selection.png]]<br />
 +
''Note: You should choose "'''VEX 2.0 Cortex'''" if you plan on programming using the standard ROBOTC language. Choose "'''Natural Language (VEX Cortex)'''" if you want to take advantage of the Natural Language commands in ROBOTC.''<br />
 +
<br />
 
|-
 
|-
|}
+
|Then go to View and choose Select Communication Port.<br />
===RBC Version===
+
[[File:Comm port.png]]<br />
{| style="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#FFFFFF; text-align:left; font-size:100%;" width="100%" cellpadding="5%" cellspacing="0" border="0"
+
<br />
 
|-
 
|-
| Identifies the current RBC specification being used. As of today, this value should be specified as 1.0.0.
+
|The Select Communications Port for Platforms window will appear. From the Communications Port drop down list, you should see "Automatic Selection" and one of two additional options:
*'''<RBCVersion>1.0.0</RBCVersion>'''
+
 
 +
If your VEX Cortex is in "bootload mode" or running an older (2.x) version of the Master CPU Firmware, it will appear as a "USB Wired Cable" option in the list.<br />
 +
[[File:Comm port select.png]]<br />
 +
<br />
 
|-
 
|-
 +
|If your VEX Cortex is running a newer (3.x) version of the Master CPU Firmware, it will appear as a "Vex Robotics Comm Port" in the list.<br />
 +
[[File:vex2-getting-started-auto-select.png]]<br />
 +
''Make sure that "Automatic Selection" or one of the two legitimate options is selected. If you ever plan on programming your robot wirelessly over VEXnet, choosing "Automatic Selection" is recommended. Press OK to save your choice.''
 +
 +
 +
 +
'''''Important:''' If the "USB Wired Cable" or "Vex Robotics Comm Port" options do not appear in the drop down menu when a VEX Cortex is connected, this may indicate that Windows has not recognized the device or access to it is blocked. Ensure that the VEX Cortex Device Driver was successfully installed with Administrative Privileges, disconnect and reconnect your Cortex from the computer, and press "Refresh List" to force ROBOTC to repopulate the list.''
 
|}
 
|}
===Platform Type===
+
<br />
{| style="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#FFFFFF; text-align:left; font-size:100%;" width="100%" cellpadding="5%" cellspacing="0" border="0"
+
 
 +
=== Step 3: Updating VEX Cortex Firmware ===
 +
{|width="740px"
 
|-
 
|-
| Sets the platform type in ROBOTC. Requires the ROBOTC installation to have an appropriate license activated and valid in order to work properly.
+
|Go to Robot &rarr; Download Firmware and select "Automatically Update VEX Cortex".<br />
*'''<Platform>PlatformType</Platform>'''
+
[[File:vex2-getting-started-auto-update.png]]<br />
 +
<br />
 
|-
 
|-
|}
+
|A message will appear, informing you that the software will update your Cortex to the latest Master CPU and ROBOTC Firmware files. Press OK to begin the process.<br />
{| class="wikitable"
+
[[File:vex2-getting-started-robotc-message.png]]<br />
 +
<br />
 
|-
 
|-
|'''To set the Platform Type to...'''
+
|A Download Progress window will appear, showing the progress of the Master CPU Firmware download.<br />
|'''Use this parameter'''
+
[[File:vex2-getting-started-download-progress.png]]<br />
 +
<br />
 
|-
 
|-
|VEX PIC
+
|When the Master CPU Firmware download is complete, a ROBOTC Message will appear and inform you that it will now update the ROBOTC firmware, if needed. Press OK to continue the process.<br />
|VEX
+
[[File:vex2-getting-started-ROBOTC_Message-2012-01-06_12_59_37.png]]<br />
 +
<br />
 
|-
 
|-
|VEX Cortex
+
|''Note: If this is the first time a VEX Cortex running the 3.x Master CPU Firmware has been connected to your computer, Windows will recognize it as a new device, and may prompt you to verify the new hardware installation. Press Continue or Continue Anyway to complete the installation.''<br />
|VEX2
+
[[File:New hw.png]]<br />
 +
<br />
 
|-
 
|-
|LEGO NXT
+
|If your ROBOTC Firmware is out-of-date, another Download Progress window will appear and begin the ROBOTC Firmware download.<br />
|NXT
+
[[File:vex2-getting-started-Download_Progress-2012-01-06_13_00_34.png]]<br />
 +
<br />
 
|-
 
|-
|LEGO NXT + TETRIX
+
|When the download completes, another ROBOTC Message will appear. Press OK to complete the process.<br />
|TETRIX
+
[[File:vex2-getting-started-ROBOTC_Message-2012-01-06_13_00_00.png]]<br />
 +
<br />
 
|-
 
|-
|Arduino
+
|'''''Notes:'''''
|ARDUINO
+
 
 +
Once this step is complete, you should no longer need Administrative privileges on your computer; you should be able to download Master CPU Firmware, ROBOTC firmware, and ROBOTC programs in a permissions-restricted account. Only future updates to ROBOTC and the VEX Cortex Device Driver will require Administrative privileges. Exception: On some computers, Windows may prompt you to "install new hardware" each time the Cortex is plugged in on a different USB port. To alleviate the issue, connect the updated VEX Cortex on each USB port as an administrator (no need to redownload firmware), or dedicate one USB port for communication with the VEX Cortex.
 +
 
 +
'''You only need to download the Firmware once''', when you first start using a VEX Cortex with ROBOTC, or when you upgrade to a newer version of ROBOTC. You do not need to re-download the firmware every time you want to download code. If the download fails, disconnect the VEX Cortex from your computer and turn it off. Then reconnect it to the computer, allow a few seconds to ensure that Windows recognizes it, turn it on, and try downloading the firmware again.
 
|}
 
|}
 +
<br />
  
===Cortex Download Method (VEX Cortex only)===
+
=== Step 4: Downloading and Running Code ===
{| style="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#FFFFFF; text-align:left; font-size:100%;" width="100%" cellpadding="5%" cellspacing="0" border="0"
+
{|width="740px"
 
|-
 
|-
| Sets the Cortex Download Method – used to modify the cortex download method to allow the Cortex to either require a VEXnet/USB cable in order to run, or to allow “standalone” mode to run a user’s program without searching for a COMM link. If the Cortex is using the VEXNet system or will be physically tethered to a Joystick Controller using the USB A-to-A cable, the VEXNet option should be used. Otherwise, use the USB-Only mode
+
|ROBOTC contains a large library of sample programs to help you get started. These sample programs can be downloaded to your VEX Cortex using the USB A-to-A cable, or using a wireless VEXnet connection.<br />
*'''<CortexDLMethod>DownloadMode</CortexDLMethod>'''
+
<br />
 +
The VEX Cortex Communication Mode controls how ROBOTC downloads programs to your Cortex, as well as what types of connections your Cortex checks for when it is powered on. Confirm that your VEX Cortex Communication Mode is set to "VEXnet or USB" or "USB Only". "'''USB Only'''" is the recommended method for wired-only programming.<br />
 +
[[File:vex2-getting-started-usb-only.png]]<br />
 +
<br />
 +
'''Option 1: VEXnet or USB'''<br />
 +
With this option selected, ROBOTC will download programs to your Cortex using a VEXnet or USB connection. In this mode, when the Cortex is powered ON it will look for a VEXnet or USB connection for up to 15 seconds before running your program. (The Communication Port &rarr; Automatic Selection option in the ROBOTC Preferences should be selected if you plan on switching between VEXnet and USB as your download method.)<br />
 +
 
 +
'''Option 2: USB Only'''<br />
 +
With this option selected, ROBOTC will download programs to your Cortex using only the USB connection. In this mode, when the Cortex is powered ON it will immediately run your program. This option will NOT work if you are using the VEXnet Joysticks to download to the Cortex, or remotely control it.<br />
 +
 
 +
'''Option 3: Competition (VEXnet)'''<br />
 +
This option disables the ROBOTC debugger, and is not recommended for classroom use.<br />
 +
<br />
 
|-
 
|-
|}
+
|To open a sample program, go to File &rarr; Open Sample Program.<br />
{| class="wikitable"
+
[[File:vex2-getting-started-program 2.png]]<br />
 +
<br />
 
|-
 
|-
|'''To set the Download Method to...'''
+
|Navigate to the Basic Movement folder and open "Moving Forward.c".<br />
|'''Use this parameter'''
+
[[File:vex2-getting-started-program 1.png]]<br />
 +
<br />
 
|-
 
|-
|USB Only
+
|Make sure that your robot is connected to the computer and turned ON. Then go to Robot &rarr; Compile and Download Program.<br />
|USBOnly
+
[[File:vex2-getting-started-compile.png]]<br />
 +
<br />
 
|-
 
|-
|USB or VEXNet
+
|'''''Important Note:''''' The VEX Cortex Communication Mode is stored in ROBOTC and on the Cortex. If you change the setting, it gets transferred to the Cortex the next time you download a program. The Cortex must be power cycled (disconnected from the computer, turned fully off, and then back on) before the change will take effect.<br />
|USBorWifi
+
[[File:vex2-getting-started-download_method_chage.png]]<br />
 +
<br />
 
|-
 
|-
|Competition (VEXNet)
+
|Download Progress window will appear while the program is downloading to the Cortex.<br />
|Competition
+
[[File:Robotc download-vex2-tut.png]]<br />
 +
<br />
 
|-
 
|-
 +
|When the Download Progress window closes, the Program Debug window will appear. You can run your program by pressing the "Start" button, or by disconnecting the robot and turning it OFF and back ON.<br />
 +
[[File:vex2-getting-started-program_debug.png]]<br />
 +
<br />
 +
|-
 +
|With the sample program above, you should observe motors plugged into Ports 2 and 3 spinning for 3 seconds.<br />
 +
[[File:vex2-getting-started-battery_motors.JPG]]<br />
 +
<br />
 
|}
 
|}
 +
<br />
  
===Circuit Board===
+
=== Step 5: Getting More Help ===
{| style="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#FFFFFF; text-align:left; font-size:100%;" width="100%" cellpadding="5%" cellspacing="0" border="0"
+
{|width="740px"
 
|-
 
|-
| This specifies the circuit board to be used. Has only real application with Arduino to differentiate between different board models (Uno,1280,2560,etc). Default value of blank (no value) for all other platforms.
+
|ROBOTC includes a useful Help system. You can launch the help system by going to the '''Help''' menu and selecting '''Open Help''', or by pressing the '''F1''' key on your keyboard.<br />
*'''<CircuitBoard></CircuitBoard>'''
+
[[File:vex2-getting-started-help.png]]<br />
 +
<br />
 
|-
 
|-
 +
|The [http://www.education.rec.ri.cmu.edu/products/teaching_robotc_cortex/index.html VEX Cortex Video Trainer] provides many useful video tutorials for learning the VEX Cortex system and ROBOTC Programming.
 +
 +
 +
Additional help and support can be found at http://www.robotc.net or by e-mailing support@robotc.net
 
|}
 
|}
===Menu Level===
+
<br />
{| style="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#FFFFFF; text-align:left; font-size:100%;" width="100%" cellpadding="5%" cellspacing="0" border="0"
+
 
 +
== Configuring the VEX Cortex for a WIRELESS connection using the VEXnet Joysticks ==
 +
{|width="740px"
 
|-
 
|-
| Sets the ROBOTC GUI Menu Level. Used to show/hide functionality by adjusting the menu level types (Basic, Advanced, and Super User)
+
|This is a guide for configuring the VEX Cortex system to be programmed wirelessly using a VEXnet connection. These steps are required the first time you use your computer to program a specific VEX Cortex, or after you've upated ROBOTC to the latest verstion. Once you've successfully completed these steps you can download your own programs without revisiting them. '''Note: Administrative privileges are required for some of these steps.'''
*'''<MenuLevel>Level</MenuLevel>'''
+
|}
 +
<br />
 +
 
 +
=== Note: Driver Installation ===
 +
{|width="740px"
 
|-
 
|-
 +
|ROBOTC 3.05 and later automatically installs the necessary drivers for the VEX Cortex, VEXnet Joysticks, and USB-to-Serial Programming cable. If you need to download the drivers for troubleshooting purposes, you can still find them at www.ROBOTC.net/download/cortex:<br />
 +
{{vex2-drivers}}
 
|}
 
|}
{| class="wikitable"
+
<br />
 +
 
 +
=== Step 1: Connect the Cortex to your PC ===
 +
{|width="740px"
 
|-
 
|-
|'''To set the Menu Level to...'''
+
|Connect the VEX Cortex directly to a USB port on your computer using the USB A-to-A cable. Allow a few seconds for Windows to recognize the device.<br />
|'''Use this parameter'''
+
[[File:vex2-getting-started-connect.JPG]]<br />
 +
<br />
 
|-
 
|-
|Basic
+
|Connect a 7.2V Robot battery to the Cortex and move the POWER switch to the ON position. Optionally, you can connect two motors to MOTOR Ports 2 and 3 for testing a sample program later in the sequence. You can connect 3-wire motors directly, or the newer 2-wire motors using Motor Controller 29 cables.<br />
|Basic
+
[[File:vex2-getting-started-battery_motors.JPG]]<br />
 +
''Note: Technically, the battery is not necessary for downloading Master CPU Firmware and ROBOTC Firmware, but it has helped in cases where the USB ports on the computer provide too little power to facilitate a reliable connection to the Cortex.''
 +
|}
 +
<br />
 +
 
 +
=== Step 2: Platform Type and Communication Port ===
 +
{|width="740px"
 
|-
 
|-
|Expert
+
|Specify that you are using the Cortex and how it is connected to your computer in ROBOTC. Go to Robot &rarr; Platform Type &rarr; Innovation First (IFI) and select "'''VEX 2.0 Cortex'''" or "'''Natural Language (VEX Cortex)'''".<br />
|Expert
+
[[File:vex2-getting-started-platform-selection.png]]<br />
 +
''Note: You should choose "'''VEX 2.0 Cortex'''" if you plan on programming using the standard ROBOTC language. Choose "'''Natural Language (VEX Cortex)'''" if you want to take advantage of the Natural Language commands in ROBOTC.''<br />
 +
<br />
 
|-
 
|-
|Super User
+
|Then go to View and choose Select Communication Port.<br />
|SuperUser
+
[[File:Comm port.png]]<br />
 +
<br />
 
|-
 
|-
 +
|The Select Communications Port for Platforms window will appear. From the Communications Port drop down list, you should see "Automatic Selection" and one of two additional options:
 +
 +
If your VEX Cortex is in "bootload mode" or running an older (2.x) version of the Master CPU Firmware, it will appear as a "USB Wired Cable" option in the list.<br />
 +
[[File:Comm port select.png]]<br />
 +
<br />
 +
|-
 +
|If your VEX Cortex is running a newer (3.x) version of the Master CPU Firmware, it will appear as a "Vex Robotics Comm Port" in the list.<br />
 +
[[File:vex2-getting-started-auto-select.png]]<br />
 +
''Make sure that "Automatic Selection" or one of the two legitimate options is selected. If you ever plan on programming your robot wirelessly over VEXnet, choosing "Automatic Selection" is recommended. Press OK to save your choice.''
 +
 +
 +
 +
'''''Important:''' If the "USB Wired Cable" or "Vex Robotics Comm Port" options do not appear in the drop down menu when a VEX Cortex is connected, this may indicate that Windows has not recognized the device or access to it is blocked. Ensure that the VEX Cortex Device Driver was successfully installed with Administrative Privileges, disconnect and reconnect your Cortex from the computer, and press "Refresh List" to force ROBOTC to repopulate the list.''
 
|}
 
|}
 +
<br />
  
===Compiler Mode===
+
=== Step 3: Updating VEX Cortex Firmware ===
{| style="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#FFFFFF; text-align:left; font-size:100%;" width="100%" cellpadding="5%" cellspacing="0" border="0"
+
{|width="740px"
 
|-
 
|-
| Sets ROBOTC’s compiler mode (Compiler Target) – used to switch between real robots, the PC-based emulator, and Virtual Worlds compiling targets.
+
|Go to Robot &rarr; Download Firmware and select "Automatically Update VEX Cortex".<br />
*'''<CompilerMode>CompilerTarget</CompilerMode>'''
+
[[File:vex2-getting-started-auto-update.png]]<br />
 +
<br />
 
|-
 
|-
|}
+
|A message will appear, informing you that the software will update your Cortex to the latest Master CPU and ROBOTC Firmware files. Press OK to begin the process.<br />
{| class="wikitable"
+
[[File:vex2-getting-started-robotc-message.png]]<br />
 +
<br />
 
|-
 
|-
|'''To set the Compiler Target to...'''
+
|A Download Progress window will appear, showing the progress of the Master CPU Firmware download.<br />
|'''Use this parameter'''
+
[[File:vex2-getting-started-download-progress.png]]<br />
 +
<br />
 
|-
 
|-
|Physical Robot
+
|When the Master CPU Firmware download is complete, a ROBOTC Message will appear and inform you that it will now update the ROBOTC firmware, if needed. Press OK to continue the process.<br />
|Real
+
[[File:vex2-getting-started-ROBOTC_Message-2012-01-06_12_59_37.png]]<br />
 +
<br />
 
|-
 
|-
|PC-based Emulator
+
|''Note: If this is the first time a VEX Cortex running the 3.x Master CPU Firmware has been connected to your computer, Windows will recognize it as a new device, and may prompt you to verify the new hardware installation. Press Continue or Continue Anyway to complete the installation.''<br />
|Emulator
+
[[File:New hw.png]]<br />
 +
<br />
 
|-
 
|-
|Virtual Worlds
+
|If your ROBOTC Firmware is out-of-date, another Download Progress window will appear and begin the ROBOTC Firmware download.<br />
|VirtualWorlds
+
[[File:vex2-getting-started-Download_Progress-2012-01-06_13_00_34.png]]<br />
 +
<br />
 
|-
 
|-
 +
|When the download completes, another ROBOTC Message will appear. Press OK to complete the process.<br />
 +
[[File:vex2-getting-started-ROBOTC_Message-2012-01-06_13_00_00.png]]<br />
 +
<br />
 
|}
 
|}
  
===Compile and Download===
+
=== Step 4: Updating VEXNet Joystick Controller Firmware ===
{| style="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#FFFFFF; text-align:left; font-size:100%;" width="100%" cellpadding="5%" cellspacing="0" border="0"
+
{|width="740px"
 
|-
 
|-
| Flag to specify if the source code should be “compiled” or “compiled and downloaded”. If set to “YES”, the code will automatically be downloaded to the robot or Virtual World. Otherwise ("NO"), it will only be compiled.
+
|Disconnect the USB cable from the Cortex and plug it into the USB port on the back of the VEXNet Joystick Controller.
*'''<CompileAndDownload>Yes</CompileAndDownload>'''
+
 
|-
 
|-
|}
+
|Go to Robot &rarr; Download Firmware and select "Automatically Update VEXNet Joystick".<br />
{| class="wikitable"
+
<br />
|-
+
|'''To set the Compile and Download option to...'''
+
|'''Use this parameter'''
+
|-
+
|Compile and download program automatically
+
|YES
+
 
|-
 
|-
|Do not compile and download program automatically
+
|The Master CPU Firmware file will then be downloaded to the Joystick Controller (there is no ROBOTC firmware residing on the Joystick Controllers). Once the process is complete, you may disconnect the Joystick Controller from the computer.
|NO
+
 
|-
 
|-
 
|}
 
|}
  
===Virtual World Index===
+
=== Step 5: Pairing the VEXNet Joystick Controller and Cortex ===
{| style="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#FFFFFF; text-align:left; font-size:100%;" width="100%" cellpadding="5%" cellspacing="0" border="0"
+
{|width="740px"
 
|-
 
|-
| Sets the numerical type of the RVW Level Pack Index that should be launched. – This is only a numerical number that references the RVW Level Pack “ID” number.
+
|The Cortex and VEXNet Controller must be paired together before the VEXNet system will work properly. In order to pair the Cortex and VEXNet Joystick Controller, you must:<br /><br />
*'''<VirtualWorldIndex>IndexNumber</VirtualWorldIndex>'''
+
*Unplug the Cortex from the computer and turn the Cortex off
 +
*Connect the Cortex to the Joystick Controller via the USB A-to-A cable (NOT the Programming Hardware kit)
 +
*Once the two devices are physically connected, turn on the Cortex and wait for the VEXNet light on the Cortex and Joystick Controller to turn green
 
|-
 
|-
 +
|This will connect the two devices and pair them properly so they will only communicate with one another. To pair the Cortex or Joystick Controller with another device, simply repeat the pairing process with the other device instead.
 
|}
 
|}
{| class="wikitable"
+
 
|-
+
=== Step 6: Updating VEXNet Key's firmware (2.0 and later only) ===
|'''To set this Virtual World'''
+
{|width="740px"
|'''Use this index parameter'''
+
|-
+
|Learning ROBOTC Tables Preview
+
|2
+
|-
+
|Curriculum Companion
+
|3
+
|-
+
|FTC Block Party!
+
|8
+
|-
+
|VEX Toss Up
+
|9
+
|-
+
|FTC Ring It Up!
+
|10
+
 
|-
 
|-
|VEX Sack Attack
+
|VEXNet 2.0 Keys have a separate firmware that resides inside of the individual keys, and may need to be upgraded before use. '''VEXnet 1.0 Key users can skip to Step 7'''.<br /><br />
|11
+
 
|-
 
|-
|Robots to the Rescue: Operation Reset
+
|First, download and run the '[http://www.vexrobotics.com/wiki/Software_Downloads#2_-_Update_Firmware_on_Cortex_Microcontroller.2C_VEXnet_Joystick.2C_and_VEXnet_Key_2.0 VEXNet Key 2.0 Firmware Upgrade Utility]' from VEX's download page.
|12
+
 
|-
 
|-
|Palm Island: Luau Edition
+
|Open the VEXNet 2.0 Firmware Upgrade Utility and plug the VEXNet 2.0 key you wish to upgrade into your computer's USB port. Click the 'Start Update' button within the Utility to start the firmware upgrade process.
|14
+
 
|-
 
|-
|Ruins of Atlantis
+
|Repeat the process with any remaining VEXNet 2.0 keys that require upgrading.
|15
+
|-
+
|RVW Level Builder
+
|18
+
 
|-
 
|-
 
|}
 
|}
  
===Source File Name===
+
=== Step 7: Setting Cortex Communication Mode ===
{| style="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#FFFFFF; text-align:left; font-size:100%;" width="100%" cellpadding="5%" cellspacing="0" border="0"
+
{|width="740px"
 
|-
 
|-
| Name of the file that will be saved/displayed on the ROBOTC tab-bar at compile time – Note this file only is used if SourceCode is provided.
+
|Open up a program you would like to load onto the Cortex. For the purposes of this tutorial, we selected the 'Dual Joystick Control' program from the 'Remote Control' Sample Programs folder.<br /><br />
*'''<SourceFileName>Name_Of_Program.c</SourceFileName>'''
+
[[File:Cortex VEXNet Sample Prog.png]]<br /><br />
 
|-
 
|-
|}
+
|With the Cortex turned on and plugged in, navigate to 'VEX Cortex Communication Mode' under the 'Robot' menu. Select 'VEXNet or USB' as the communication type.<br /><br />
===RVW Parameters===
+
[[File:Cortex Communication Type.png]] <br /><br />
{| style="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#FFFFFF; text-align:left; font-size:100%;" width="100%" cellpadding="5%" cellspacing="0" border="0"
+
 
|-
 
|-
| Command Line Parameters that will be passed the next time Robot Virtual Worlds is launched. If the “CompileAndDownload” flag is set to “NO”, these parameters will be stored for the next execution. After the Virtual Worlds has been executed once, these parameters are discarded.
+
|Compile and download the program to the Cortex. ROBOTC will pop up a message telling you that the communication mode has been changed and that a power cycle is required in order for the changes to take affect. <br /><br />
*'''<RVWParameters>parameter1 parameter2 parameter3</RVWParameters>'''
+
[[File:Cortex Communication Powercycle.png]]<br /><br />
|-
+
|}
+
===Source Code===
+
{| style="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#FFFFFF; text-align:left; font-size:100%;" width="100%" cellpadding="5%" cellspacing="0" border="0"
+
|-
+
| Source Code of program to be open/compiled/downloaded. This is not a reference to an existing file but rather the actual contents of the file. Because the RBC file uses XML formatting, the file cannot contain any XML escape markups in the Source Code section. Instead, the escape markups must be replaced with the characters below:
+
 
|-
 
|-
 +
|Once the program has downloaded to the Cortex, turn the Cortex off and back on. This 'power cycle' commits the communication type to the Cortex. Remember, you must repeat this process to revert back to USB only (making sure that USB only is selected as the mode). The Cortex should now be set up for wireless communication over VEXNet.<br /><br />
 
|}
 
|}
 +
 +
'''''Note:'''''
 +
 +
Once these steps are complete, you should no longer need Administrative privileges on your computer; you should be able to download Master CPU Firmware, ROBOTC firmware, and ROBOTC programs in a permissions-restricted account. Only future updates to ROBOTC and the VEX Cortex Device Driver will require Administrative privileges. Exception: On some computers, Windows may prompt you to "install new hardware" each time the Cortex is plugged in on a different USB port. To alleviate the issue, connect the updated VEX Cortex on each USB port as an administrator (no need to redownload firmware), or dedicate one USB port for communication with the VEX Cortex.
 +
 +
'''You only need to download the Firmware''' when you first start using a VEX Cortex with ROBOTC, or when you upgrade to a newer version of ROBOTC. You do not need to re-download the firmware every time you want to download code. If the download fails, disconnect the VEX Cortex from your computer and turn it off. Then reconnect it to the computer, allow a few seconds to ensure that Windows recognizes it, turn it on, and try downloading the firmware again.
 +
<br />

Latest revision as of 21:36, 11 April 2014

Tutorials → Getting Started with the VEX Cortex




Configuring the VEX Cortex for a WIRED connection using USB

This is a guide for setting up the VEX Cortex using the USB A-to-A cable. These steps are required the first time you use your computer to program a specific VEX Cortex, or after you've upated ROBOTC to the latest verstion. Once you've successfully completed these steps you can download your own programs without revisiting them. Note: Administrative privileges are required for some of these steps.


Note: Driver Installation

ROBOTC 3.05 and later automatically installs the necessary drivers for the VEX Cortex, VEXnet Joysticks, and USB-to-Serial Programming cable. If you need to download the drivers for troubleshooting purposes, you can still find them at www.ROBOTC.net/download/cortex:
The drivers for the CORTEX Microcontroller and VEXnet Joysticks are included in the ROBOTC 3.0 installers. If, for any reason, you need to download them separately, here are the downloads:
Download Network Driver (in addition to required driver) if ROBOTC will run from a network:


Step 1: Connect the Cortex to your PC

Connect the VEX Cortex directly to a USB port on your computer using the USB A-to-A cable. Allow a few seconds for Windows to recognize the device.

Vex2-getting-started-connect.JPG

Connect a 7.2V Robot battery to the Cortex and move the POWER switch to the ON position. Optionally, you can connect two motors to MOTOR Ports 2 and 3 for testing a sample program later in the sequence. You can connect 3-wire motors directly, or the newer 2-wire motors using Motor Controller 29 cables.

Vex2-getting-started-battery motors.JPG
Note: Technically, the battery is not necessary for downloading Master CPU Firmware and ROBOTC Firmware, but it has helped in cases where the USB ports on the computer provide too little power to facilitate a reliable connection to the Cortex.


Step 2: Platform Type and Communication Port

Specify that you are using the Cortex and how it is connected to your computer in ROBOTC. Go to Robot → Platform Type → Innovation First (IFI) and select "VEX 2.0 Cortex" or "Natural Language (VEX Cortex)".

Vex2-getting-started-platform-selection.png
Note: You should choose "VEX 2.0 Cortex" if you plan on programming using the standard ROBOTC language. Choose "Natural Language (VEX Cortex)" if you want to take advantage of the Natural Language commands in ROBOTC.

Then go to View and choose Select Communication Port.

Comm port.png

The Select Communications Port for Platforms window will appear. From the Communications Port drop down list, you should see "Automatic Selection" and one of two additional options:

If your VEX Cortex is in "bootload mode" or running an older (2.x) version of the Master CPU Firmware, it will appear as a "USB Wired Cable" option in the list.
Comm port select.png

If your VEX Cortex is running a newer (3.x) version of the Master CPU Firmware, it will appear as a "Vex Robotics Comm Port" in the list.

Vex2-getting-started-auto-select.png
Make sure that "Automatic Selection" or one of the two legitimate options is selected. If you ever plan on programming your robot wirelessly over VEXnet, choosing "Automatic Selection" is recommended. Press OK to save your choice.


Important: If the "USB Wired Cable" or "Vex Robotics Comm Port" options do not appear in the drop down menu when a VEX Cortex is connected, this may indicate that Windows has not recognized the device or access to it is blocked. Ensure that the VEX Cortex Device Driver was successfully installed with Administrative Privileges, disconnect and reconnect your Cortex from the computer, and press "Refresh List" to force ROBOTC to repopulate the list.


Step 3: Updating VEX Cortex Firmware

Go to Robot → Download Firmware and select "Automatically Update VEX Cortex".

Vex2-getting-started-auto-update.png

A message will appear, informing you that the software will update your Cortex to the latest Master CPU and ROBOTC Firmware files. Press OK to begin the process.

Vex2-getting-started-robotc-message.png

A Download Progress window will appear, showing the progress of the Master CPU Firmware download.

Vex2-getting-started-download-progress.png

When the Master CPU Firmware download is complete, a ROBOTC Message will appear and inform you that it will now update the ROBOTC firmware, if needed. Press OK to continue the process.

Vex2-getting-started-ROBOTC Message-2012-01-06 12 59 37.png

Note: If this is the first time a VEX Cortex running the 3.x Master CPU Firmware has been connected to your computer, Windows will recognize it as a new device, and may prompt you to verify the new hardware installation. Press Continue or Continue Anyway to complete the installation.

New hw.png

If your ROBOTC Firmware is out-of-date, another Download Progress window will appear and begin the ROBOTC Firmware download.

Vex2-getting-started-Download Progress-2012-01-06 13 00 34.png

When the download completes, another ROBOTC Message will appear. Press OK to complete the process.

Vex2-getting-started-ROBOTC Message-2012-01-06 13 00 00.png

Notes:

Once this step is complete, you should no longer need Administrative privileges on your computer; you should be able to download Master CPU Firmware, ROBOTC firmware, and ROBOTC programs in a permissions-restricted account. Only future updates to ROBOTC and the VEX Cortex Device Driver will require Administrative privileges. Exception: On some computers, Windows may prompt you to "install new hardware" each time the Cortex is plugged in on a different USB port. To alleviate the issue, connect the updated VEX Cortex on each USB port as an administrator (no need to redownload firmware), or dedicate one USB port for communication with the VEX Cortex.

You only need to download the Firmware once, when you first start using a VEX Cortex with ROBOTC, or when you upgrade to a newer version of ROBOTC. You do not need to re-download the firmware every time you want to download code. If the download fails, disconnect the VEX Cortex from your computer and turn it off. Then reconnect it to the computer, allow a few seconds to ensure that Windows recognizes it, turn it on, and try downloading the firmware again.


Step 4: Downloading and Running Code

ROBOTC contains a large library of sample programs to help you get started. These sample programs can be downloaded to your VEX Cortex using the USB A-to-A cable, or using a wireless VEXnet connection.


The VEX Cortex Communication Mode controls how ROBOTC downloads programs to your Cortex, as well as what types of connections your Cortex checks for when it is powered on. Confirm that your VEX Cortex Communication Mode is set to "VEXnet or USB" or "USB Only". "USB Only" is the recommended method for wired-only programming.
Vex2-getting-started-usb-only.png

Option 1: VEXnet or USB
With this option selected, ROBOTC will download programs to your Cortex using a VEXnet or USB connection. In this mode, when the Cortex is powered ON it will look for a VEXnet or USB connection for up to 15 seconds before running your program. (The Communication Port → Automatic Selection option in the ROBOTC Preferences should be selected if you plan on switching between VEXnet and USB as your download method.)

Option 2: USB Only
With this option selected, ROBOTC will download programs to your Cortex using only the USB connection. In this mode, when the Cortex is powered ON it will immediately run your program. This option will NOT work if you are using the VEXnet Joysticks to download to the Cortex, or remotely control it.

Option 3: Competition (VEXnet)
This option disables the ROBOTC debugger, and is not recommended for classroom use.

To open a sample program, go to File → Open Sample Program.

Vex2-getting-started-program 2.png

Navigate to the Basic Movement folder and open "Moving Forward.c".

Vex2-getting-started-program 1.png

Make sure that your robot is connected to the computer and turned ON. Then go to Robot → Compile and Download Program.

Vex2-getting-started-compile.png

Important Note: The VEX Cortex Communication Mode is stored in ROBOTC and on the Cortex. If you change the setting, it gets transferred to the Cortex the next time you download a program. The Cortex must be power cycled (disconnected from the computer, turned fully off, and then back on) before the change will take effect.

Vex2-getting-started-download method chage.png

Download Progress window will appear while the program is downloading to the Cortex.

Robotc download-vex2-tut.png

When the Download Progress window closes, the Program Debug window will appear. You can run your program by pressing the "Start" button, or by disconnecting the robot and turning it OFF and back ON.

Vex2-getting-started-program debug.png

With the sample program above, you should observe motors plugged into Ports 2 and 3 spinning for 3 seconds.

Vex2-getting-started-battery motors.JPG


Step 5: Getting More Help

ROBOTC includes a useful Help system. You can launch the help system by going to the Help menu and selecting Open Help, or by pressing the F1 key on your keyboard.

Vex2-getting-started-help.png

The VEX Cortex Video Trainer provides many useful video tutorials for learning the VEX Cortex system and ROBOTC Programming.


Additional help and support can be found at http://www.robotc.net or by e-mailing support@robotc.net


Configuring the VEX Cortex for a WIRELESS connection using the VEXnet Joysticks

This is a guide for configuring the VEX Cortex system to be programmed wirelessly using a VEXnet connection. These steps are required the first time you use your computer to program a specific VEX Cortex, or after you've upated ROBOTC to the latest verstion. Once you've successfully completed these steps you can download your own programs without revisiting them. Note: Administrative privileges are required for some of these steps.


Note: Driver Installation

ROBOTC 3.05 and later automatically installs the necessary drivers for the VEX Cortex, VEXnet Joysticks, and USB-to-Serial Programming cable. If you need to download the drivers for troubleshooting purposes, you can still find them at www.ROBOTC.net/download/cortex:
The drivers for the CORTEX Microcontroller and VEXnet Joysticks are included in the ROBOTC 3.0 installers. If, for any reason, you need to download them separately, here are the downloads:
Download Network Driver (in addition to required driver) if ROBOTC will run from a network:


Step 1: Connect the Cortex to your PC

Connect the VEX Cortex directly to a USB port on your computer using the USB A-to-A cable. Allow a few seconds for Windows to recognize the device.

Vex2-getting-started-connect.JPG

Connect a 7.2V Robot battery to the Cortex and move the POWER switch to the ON position. Optionally, you can connect two motors to MOTOR Ports 2 and 3 for testing a sample program later in the sequence. You can connect 3-wire motors directly, or the newer 2-wire motors using Motor Controller 29 cables.

Vex2-getting-started-battery motors.JPG
Note: Technically, the battery is not necessary for downloading Master CPU Firmware and ROBOTC Firmware, but it has helped in cases where the USB ports on the computer provide too little power to facilitate a reliable connection to the Cortex.


Step 2: Platform Type and Communication Port

Specify that you are using the Cortex and how it is connected to your computer in ROBOTC. Go to Robot → Platform Type → Innovation First (IFI) and select "VEX 2.0 Cortex" or "Natural Language (VEX Cortex)".

Vex2-getting-started-platform-selection.png
Note: You should choose "VEX 2.0 Cortex" if you plan on programming using the standard ROBOTC language. Choose "Natural Language (VEX Cortex)" if you want to take advantage of the Natural Language commands in ROBOTC.

Then go to View and choose Select Communication Port.

Comm port.png

The Select Communications Port for Platforms window will appear. From the Communications Port drop down list, you should see "Automatic Selection" and one of two additional options:

If your VEX Cortex is in "bootload mode" or running an older (2.x) version of the Master CPU Firmware, it will appear as a "USB Wired Cable" option in the list.
Comm port select.png

If your VEX Cortex is running a newer (3.x) version of the Master CPU Firmware, it will appear as a "Vex Robotics Comm Port" in the list.

Vex2-getting-started-auto-select.png
Make sure that "Automatic Selection" or one of the two legitimate options is selected. If you ever plan on programming your robot wirelessly over VEXnet, choosing "Automatic Selection" is recommended. Press OK to save your choice.


Important: If the "USB Wired Cable" or "Vex Robotics Comm Port" options do not appear in the drop down menu when a VEX Cortex is connected, this may indicate that Windows has not recognized the device or access to it is blocked. Ensure that the VEX Cortex Device Driver was successfully installed with Administrative Privileges, disconnect and reconnect your Cortex from the computer, and press "Refresh List" to force ROBOTC to repopulate the list.


Step 3: Updating VEX Cortex Firmware

Go to Robot → Download Firmware and select "Automatically Update VEX Cortex".

Vex2-getting-started-auto-update.png

A message will appear, informing you that the software will update your Cortex to the latest Master CPU and ROBOTC Firmware files. Press OK to begin the process.

Vex2-getting-started-robotc-message.png

A Download Progress window will appear, showing the progress of the Master CPU Firmware download.

Vex2-getting-started-download-progress.png

When the Master CPU Firmware download is complete, a ROBOTC Message will appear and inform you that it will now update the ROBOTC firmware, if needed. Press OK to continue the process.

Vex2-getting-started-ROBOTC Message-2012-01-06 12 59 37.png

Note: If this is the first time a VEX Cortex running the 3.x Master CPU Firmware has been connected to your computer, Windows will recognize it as a new device, and may prompt you to verify the new hardware installation. Press Continue or Continue Anyway to complete the installation.

New hw.png

If your ROBOTC Firmware is out-of-date, another Download Progress window will appear and begin the ROBOTC Firmware download.

Vex2-getting-started-Download Progress-2012-01-06 13 00 34.png

When the download completes, another ROBOTC Message will appear. Press OK to complete the process.

Vex2-getting-started-ROBOTC Message-2012-01-06 13 00 00.png

Step 4: Updating VEXNet Joystick Controller Firmware

Disconnect the USB cable from the Cortex and plug it into the USB port on the back of the VEXNet Joystick Controller.
Go to Robot → Download Firmware and select "Automatically Update VEXNet Joystick".


The Master CPU Firmware file will then be downloaded to the Joystick Controller (there is no ROBOTC firmware residing on the Joystick Controllers). Once the process is complete, you may disconnect the Joystick Controller from the computer.

Step 5: Pairing the VEXNet Joystick Controller and Cortex

The Cortex and VEXNet Controller must be paired together before the VEXNet system will work properly. In order to pair the Cortex and VEXNet Joystick Controller, you must:

  • Unplug the Cortex from the computer and turn the Cortex off
  • Connect the Cortex to the Joystick Controller via the USB A-to-A cable (NOT the Programming Hardware kit)
  • Once the two devices are physically connected, turn on the Cortex and wait for the VEXNet light on the Cortex and Joystick Controller to turn green
This will connect the two devices and pair them properly so they will only communicate with one another. To pair the Cortex or Joystick Controller with another device, simply repeat the pairing process with the other device instead.

Step 6: Updating VEXNet Key's firmware (2.0 and later only)

VEXNet 2.0 Keys have a separate firmware that resides inside of the individual keys, and may need to be upgraded before use. VEXnet 1.0 Key users can skip to Step 7.

First, download and run the 'VEXNet Key 2.0 Firmware Upgrade Utility' from VEX's download page.
Open the VEXNet 2.0 Firmware Upgrade Utility and plug the VEXNet 2.0 key you wish to upgrade into your computer's USB port. Click the 'Start Update' button within the Utility to start the firmware upgrade process.
Repeat the process with any remaining VEXNet 2.0 keys that require upgrading.

Step 7: Setting Cortex Communication Mode

Open up a program you would like to load onto the Cortex. For the purposes of this tutorial, we selected the 'Dual Joystick Control' program from the 'Remote Control' Sample Programs folder.

Cortex VEXNet Sample Prog.png

With the Cortex turned on and plugged in, navigate to 'VEX Cortex Communication Mode' under the 'Robot' menu. Select 'VEXNet or USB' as the communication type.

Cortex Communication Type.png

Compile and download the program to the Cortex. ROBOTC will pop up a message telling you that the communication mode has been changed and that a power cycle is required in order for the changes to take affect.

Cortex Communication Powercycle.png

Once the program has downloaded to the Cortex, turn the Cortex off and back on. This 'power cycle' commits the communication type to the Cortex. Remember, you must repeat this process to revert back to USB only (making sure that USB only is selected as the mode). The Cortex should now be set up for wireless communication over VEXNet.

Note:

Once these steps are complete, you should no longer need Administrative privileges on your computer; you should be able to download Master CPU Firmware, ROBOTC firmware, and ROBOTC programs in a permissions-restricted account. Only future updates to ROBOTC and the VEX Cortex Device Driver will require Administrative privileges. Exception: On some computers, Windows may prompt you to "install new hardware" each time the Cortex is plugged in on a different USB port. To alleviate the issue, connect the updated VEX Cortex on each USB port as an administrator (no need to redownload firmware), or dedicate one USB port for communication with the VEX Cortex.

You only need to download the Firmware when you first start using a VEX Cortex with ROBOTC, or when you upgrade to a newer version of ROBOTC. You do not need to re-download the firmware every time you want to download code. If the download fails, disconnect the VEX Cortex from your computer and turn it off. Then reconnect it to the computer, allow a few seconds to ensure that Windows recognizes it, turn it on, and try downloading the firmware again.