Skip to main content

Posts

Showing posts with the label robot program

Using Wind River Workbench

Wind River Workbench is a complete C/C++ Interactive Development Environment (IDE) that handles all aspects of code development.  It will help you: • Write the code for your robot with editors, syntax highlighting, formatting, auto-completion, etc. • Compile the source code into binary object code for the cRIO PowerPC architecture. • Debug and test code by downloading the code to the cRIO robot controller and enabling you to step through line by line and examine variables of the running code. • Deploy the program so that it will automatically start up when the robot is powered on. You can even use Subversion, a popular source code repository server to manage your code and track changes. This is especially useful if there is more than one person doing software development. Setting up the environment To use Workbench you need to configure it so that it knows about your robot and the programs that you want to download to it. There are three areas that need to be s...

Writing C programs

You can also write C programs with the WPI Robotics Library using a set of C functions that map on top  of the C++ classes and methods. To write C code: • You need to create .cpp (C++ files) rather than .C files because the C wrapper functions take advantage of overloaded functions. This means that there are a number of functions that have the same name, but different argument lists. This increases the compatibility with the C++ programming interfaces and will make transition to C++ much easier if you choose to do that. • Specify port and/or slot (module) numbers in most of the functions. Behind the scenes, the functions allocate C++ objects that correspond to the functions that you are using. This serves two purposes: it ensures that you are not using a particular port for two purposes accidently since the C++ underlying functions track “reservations” and makes the code very similar to previous years where the port numbers were on each call. You will find that there...

A simple robot program

Creating a robot program has been designed to be as simple as possible while still allowing a lot of flexibility. Here’s an example of a template that represents the simplest robot program you can create. #include "WPILib.h" class RobotDemo : public SimpleRobot { RobotDemo(void) { // put initialization code here } void Autonomous(void) { // put autonomous code here } void OperatorControl(void) { // put operator control code here } }; START_ROBOT_CLASS(RobotDemo); There are several templates that can be used as starting points for writing robot programs. This one, SimpleRobot is probably the easiest to use. Simply add code for initializing sensors and anything else you need in the constructor, code for your autonomous program in the Autonomous function, and the code for your operator control part of the program in OperatorControl. SimpleRobot is actually the name of a C++ class or object that is used as the base of this robot program called RobotDemo...