Skip to content

[Tutorial 1.2] Your first Igneous project

Colby Skeggs edited this page Nov 11, 2015 · 4 revisions

WARNING: THIS DOCUMENTATION IS FOR CCRE v2, NOT CCRE v3!

See the readme on the main page for the correct documentation.

Your first Igneous project

[Back to the previous tutorial]([Tutorial 1.1] Setting up the CCRE)

Creating your new project

Right-click on "TemplateIgneousRobot" project and select "Copy" and then right-click on the background of project pane and select "Paste".

Enter "My First Robot" under "Project Name" and select "OK".

Go to the Project menu and press Build All.

Creating your main robot class

Right-click on teamNNNN under src in "My First Robot" and select Refactor->Rename...

Replace the NNNN with your team number, so for example team1540, and press OK.

Now right-click on RobotTemplate.java within the team???? package and select Refactor->Rename...

Replace RobotTemplate with MyFirstRobot in the New name field.

Press "Finish".

The file should look like this:

package teamNNNN;

import ccre.igneous.Igneous;
import ccre.igneous.IgneousApplication;
import ccre.log.Logger;

public class MyFirstRobot implements IgneousApplication {

    public void setupRobot() {
        // Robot setup code goes here.
    }
}

This code is the basic outline of Igneous robot code.

Add the following test line to the setupRobot() method:

        Logger.info("Hello, World!");

You now have a simple program that will display "Hello, World!" on the logging window!

Configuring your new program

Double-click on "main.properties". Replace the first two lines with:

igneous.main=teamNNNN.MyFirstRobot
remoteaddress-2014=10.NN.NN.2

where NNNN is your team number. For example:

igneous.main=team1540.MyFirstRobot
remoteaddress-2014=10.15.40.2

You will only need to change those lines again if you change your main robot class or your team number.

Running your new program in the emulator

The CCRE's emulator is one of its most useful features: you can easily test your code without a real robot.

To launch your program in the roboRIO emulator, simply go to Run -> External Tools -> My First Robot Emulate for roboRIO.

The External Tools menu can also be found in the toolbar for faster access.

Once you launch your program, it should build (this may take a while) and then the emulator's window will open. In the logging section (near the top), you should see something like this:

[INFO] (DeviceListMain.java:101) Starting application: team1540.MyFirstRobot
[INFO] (MyFirstRobot.java:17) Hello, World!
[INFO] (DeviceListMain.java:103) Hello, team1540.MyFirstRobot!

You can also try changing "Hello, World!" to something else, and that will show up as the second line instead!

Running your new program on the robot

Before you download code, make sure that you have the Riolog view open, so that you can see the output from your robot. Go to Window -> Show View -> Other... Type in "Riolog" and press enter.

Follow the same instructions as for emulating, except instead of "My First Robot Emulate for roboRIO", select "My First Robot Deploy for roboRIO."

The download process will start - the code will be compiled and deployed to the robot, and then the code will reboot. (You will have to be connected to the robot for this to work.) Once the robot comes back online, look in the Riolog view, and you should see

LOG[INFO] (MyFirstRobot.java:17) Hello, World!

in the output. If so, your first program worked!

(Note: This tutorial does not include information on how to image your robot and set up the driver station. You can find that here.)

Next: [Making your robot drive]([Tutorial 1.3] Making your robot drive)