Creating an RBC file

Jump to: navigation, search
Creating an RBC file

What is an RBC file?

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.

How to create an RBC file

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).
RBC New File.png
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.
RBC File SaveAs.png
RBC File Name.png
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>
RBC File Params.png
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.
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.

XML parameters

XML Version

The XML Version parameter will identify the document as valid XML. This must always be at the top of the RBC document.
  • <?xml version="1.0" encoding="UTF-8"?>

RBC Version

Identifies the current RBC specification being used. As of today, this value should be specified as 1.0.0.
  • <RBCVersion>1.0.0</RBCVersion>

Platform Type

Sets the platform type in ROBOTC. Requires the ROBOTC installation to have an appropriate license activated and valid in order to work properly.
  • <Platform>PlatformType</Platform>
To set the Platform Type to... Use this parameter
VEX Cortex VEX2

Cortex Download Method (VEX Cortex only)

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
  • <CortexDLMethod>DownloadMode</CortexDLMethod>
To set the Download Method to... Use this parameter
USB Only USBOnly
USB or VEXNet USBorWifi
Competition (VEXNet) Competition

Circuit Board

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.
  • <CircuitBoard></CircuitBoard>

Menu Level

Sets the ROBOTC GUI Menu Level. Used to show/hide functionality by adjusting the menu level types (Basic, Advanced, and Super User)
  • <MenuLevel>Level</MenuLevel>
To set the Menu Level to... Use this parameter
Basic Basic
Expert Expert
Super User SuperUser

Compiler Mode

Sets ROBOTC’s compiler mode (Compiler Target) – used to switch between real robots, the PC-based emulator, and Virtual Worlds compiling targets.
  • <CompilerMode>CompilerTarget</CompilerMode>
To set the Compiler Target to... Use this parameter
Physical Robot Real
PC-based Emulator Emulator
Virtual Worlds VirtualWorlds

Compile and Download

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.
  • <CompileAndDownload>Yes</CompileAndDownload>
To set the Compile and Download option to... Use this parameter
Compile and download program automatically YES
Do not compile and download program automatically NO

Virtual World Index

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.
  • <VirtualWorldIndex>IndexNumber</VirtualWorldIndex>
To set this Virtual World 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 11
Robots to the Rescue: Operation Reset 12
Palm Island: Luau Edition 14
Ruins of Atlantis 15
RVW Level Builder 18

Source File Name

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.
  • <SourceFileName>Name_Of_Program.c</SourceFileName>
RBC Tab Name.png

RVW Parameters

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.
  • <RVWParameters>parameter1 parameter2 parameter3</RVWParameters>

Source Code

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.
  • <SourceCode></SourceCode>
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. The easiest way to perform this action on a large program is to use your text file editor's 'Find and Replace' feature, as shown in this video.
RBC Chars XML.png

Completed RBC File (Sample)

<?xml version="1.0" encoding="UTF-8"?>
<SourceFileName>2 Joystick Drive-Thresholds.c</SourceFileName>
<SourceCode>#pragma config(Sensor, in1,    leftLineFollower, sensorLineFollower)
#pragma config(Sensor, in2,    centerLineFollower, sensorLineFollower)
#pragma config(Sensor, in3,    rightLineFollower, sensorLineFollower)
#pragma config(Sensor, dgtl1,  rightEncoder,   sensorQuadEncoder)
#pragma config(Sensor, dgtl3,  leftEncoder,    sensorQuadEncoder)
#pragma config(Sensor, dgtl5,  compassSensor,  sensorVirtualCompass)
#pragma config(Sensor, dgtl6,  touchSensor,    sensorTouch)
#pragma config(Sensor, dgtl8,  sonarSensor,    sensorSONAR_cm)
#pragma config(Motor,  port2,           rightMotor,    tmotorServoContinuousRotation, openLoop)
#pragma config(Motor,  port3,           leftMotor,     tmotorServoContinuousRotation, openLoop)
//*!!Code automatically generated by &apos;ROBOTC&apos; configuration wizard               !!*//
/*+++++++++++++++++++++++++++++++++++++++++++++| Notes |++++++++++++++++++++++++++++++++++++++++++++++
2 Joystick Drive with Thresholds
- This program allows you to remotely control your robot using the USB Logitech Dual
  Action Joysticks.
- This program also ignores low values that would cause your robot to move when the joysticks fail to
  return back to exact center.  You may need to adjust the &apos;threshold&apos; value to get it just right.
- For USB values to be transmitted to the robot, you must follow several steps:
  - Use the &quot;#include &quot;JoystickDriver.c&quot;&quot; line at the beginning of your program
  - Call the &quot;getJoystickSettings(joystick);&quot; in a loop to repeatedly retrieve the latest values
  - Open the Robot &gt; Debugger Windows &gt; &quot;Joystick Control - Basic&quot; window after downloading your
    program to the virtual robot
Robot Model(s): Squarebot
[I/O Port]          [Name]              [Type]                [Description]
Motor Port 2        rightMotor          VEX Motor             Right side motor
Motor Port 3        leftMotor           VEX Motor             Left side motor
*To run this sample program on Swervebot, be sure to Reverse Motor Port 3 in the Motors and Sensors
 Setup, and to make sure that Motor Port 2 is NOT Reversed.
#pragma debuggerWindows(&quot;joystickSimple&quot;);
#include &quot;JoystickDriver.c&quot;
task main()
  //Integer variable that allows you to specify a &quot;deadzone&quot; where values (both positive or negative)
  //less than the threshold will be ignored.
  int threshold = 10;
  //Loop Forever
  while(1 == 1)
    //Get the Latest joystick values
    if(abs(joystick.joy1_y2) &gt; threshold)     // If the right analog stick&apos;s Y-axis readings are either above or below the threshold...
      motor[rightMotor] = joystick.joy1_y2;   // ...the right motor is assigned a power level equal to the right analog stick&apos;s Y-axis reading.
    else                                      // Else the readings are within the threshold, so
      motor[rightMotor] = 0;                  // ...the right motor is stopped with a power level of 0.
    if(abs(joystick.joy1_y1) &gt; threshold)     // If the left analog stick&apos;s Y-axis readings are either above or below the threshold...
      motor[leftMotor] = joystick.joy1_y1;    // ...the left motor is assigned a power level equal to the left analog stick&apos;s Y-axis reading.
    else                                      // Else if the readings are within the threshold...
      motor[leftMotor] = 0;                   // ...the left motor is stopped with a power level of 0.