FRC team 5584. Est. 2014

 

 

Follow Our Progress

Keep updated with the team by following our social media channels. For exciting highlights videos and robot reveals, be sure to subscribe to our YouTube channel!

Read more

 

Robocamps

Come and join us at one of our Robo Camp workshops! Held at three locations across the Eastern suburbs of Melbourne. Register on our website now!

Read more

 

Our Sponsors

The companies that support our team to run each season and are helping us promote a bright future for STEM in Australia. 

Read more

 

2024 Season: Crescendo

  • 2024.ChampsREV
  • 2024.MRTAlliance
  • 2024.MRTDrive
  • 2024.MollyClimb
  • 2024.shoot
  • 2024.loading

2025 Season: Reefscape

  • 2025.load
  • 2025.ready
  • 2025.score
  • 2025.spin
  • 2025.cad
  • 2025.kickoff
  • 2025.prototype

These notes show how to get control of drive base and auxiliary motors as well as pneumatics systems on an FRC robot, they don't refine any of the controls so you won't be scoring goals with boulders using this solution but you will have some control over each motor and each pneumatic actuator/solenoid on our 2016 robot. 

These instructions have references to our 2016 robot "Mr B" but they should be fairly easy to adapt to support other teams with an insisting robot where they are considering a switch to C++. In summary, Mr B sub systems are ...

  • 4 wheel drive base
    • wheels driven in pairs by two gearboxes
    • wheel pairs connected by belts
    • gear boxes each driven by 2x CIMs
    • controlled by 4x CAN Talons
  • shooting arm
    • 2x mini CIM motors for shooting
    • controlled by 2x CAN Talons
    • 2x actuators for raising and lowering arm
    • controlled by 1x double solenoid
  • front arm(s)
    • 2x actuator for raising and lowering arm
    • controlled by 2x double solenoids
  • intake roller
    • 1x snow blower motor
    • controlled by 1x CAN Talon
  • feed roller
    • 1x snow blower motor
    • controlled by 1x CAN Talon

CREDITS:

The following references were very useful!

http://wp.wpi.edu/wpilib/2013/12/14/wpilib-robot-builder-developer-preview/
http://wpilib.screenstepslive.com/s/4485/m/26402

INSTRUCTIONS:

(a) setup dev environment

c:
mkdir \JazzHub\
mkdir \JazzHub\icrobotics\
cd \JazzHub\icrobotics\

git clone https://hub.jazz.net/git/icrobotics/frc
  git config --global user.name XXXX
  git config --global user.email YYYY

(replace XXXX and YYYY with your details for example "Joe Blogs" and "This email address is being protected from spambots. You need JavaScript enabled to view it.")

Launch eclipse for C++

Use workspace: C:\JazzHub\icrobotics\frc\software\cpp

(b) Create Robot Builder file and save ...

In Eclipse ...

Create and delete a WPILIB project

  (apparently this forces eclipse to apply some settings to the workspace)

  Select "File" > "New" > "Other"

  Select "WPILib Robot C++ Development" > "Example Robot C++ Project"

  Select "Next" > "Getting Started with C++" > "Getting Started"

  Select "Next" then "Finish"

  Select the "Getting Started" project in the left view then right-click and select "Delete"

  Tick the "Delete project contents on disk (cannot be undone)" then select "OK"

Create Robot Builder project ...

  Select "WPILib" > "Run RobotBuilder"
  Select New, enter team number and "ProjectX" as the name then "Create project"
  Select "File" > "Save As"
  Navigate to C:\JazzHub\icrobotics\frc\software\cpp
  Create "ProjectX Robot Builder" directory
  Navigate to new directory
  Save as "ProjectX.yaml"

NOTE: recommend that you make all of the following objects valid C++ names (i.e. no spaces) - apparently this is not necessary but it will make it easier for searching for variable names later.

NOTE: do not use object names that are likely to coincide with type names in the WPILib libraries, for example, Use "CANTalonXXX" and don't use "CANTalon"

NOTE: make sure that you use leading capitals for the subsystem and command names - this is important - failure to do so will result in "-fpermissive" errors being reported by the compiler. This occurs because the code generation system creates classes with the user specified names (case retained) and creates the object instances with the first letter in lower case, it does this to avoid name space conflicts, unfortunately this fails dismally if the class was named with leading lower case to start with!

Add a subsystem called "ShooterFlywheels" and add ...
  CAN Talon called "CANTalonShooterMotorRear" and set "ID" to 5
  CAN Talon called "CANTalonShooterMotorFront" and set "ID" to 6

Add a command called "ChuckBoulder" and set ...
  "Requires" field to "ShooterFlywheels"

Add a Joystick to the operator interface called "Joystick1" and add ...
  Joystick Button called "Joystick1"

Add a Joystick Button to Joystick called "JoystickButtonShoot" and set ...
  "Button" field to 4
  "Command" field to "ChuckBoulder"
  "When to run" field to "whileHeld"

Click on the project name (ProjectX) to reveal the properties of the project
  Check team number is 5584
  Set workspace to C:\JazzHub\icrobotics\frc\software\cpp
  Set wiring file location to C:\JazzHub\icrobotics\frc\software\cpp\ProjectX Wiring List
  Select "C++" in the menu (this will create a new project at  C:\JazzHub\icrobotics\frc\software\cpp\ProjectX)
  Select "File" > "Exit" to leave the Robot Builder

(c) Import generated code into eclipse ...

In Eclipse, import the generated code into project ...
  Select "File" > "Import"
  Select "General" > "Existing Projects into Workspace" > "Next" 
  Set root directory to  C:\JazzHub\icrobotics\frc\software\cpp\ProjectX
  Select "Finish" to import the project

(d) Check for issues ...

In Eclipse, check the "Problems" tab in the bottom pane - this should report "0 items"
If you get one or more "Program XXX not found in PATH" errors ...
  Scroll to the right to see which preference parameter is triggering this
  Right click on project name and select "Properties" > "C/C++ General" > "Preprocessor..."
  For the "linux-simulate" configuration select "CDT Cross GCC Built-in Compiler Settings" in the "Providers" tab and prefix ${COMMAND} with "arm-frc-linux-gnueabi-" so that start of command line is "arm-frc-linux-gnueabi-${COMMAND}..."
  Select "Apply" and "OK"
  Select "Window" > "Preferences" > "C/C++" > "Build" > "Settings"
  In the "Discovery" tab select "CDT GCC Built-in Compiler Settings" then prefix ${COMMAND} with "arm-frc-linux-gnueabi-" so that start of command line is "arm-frc-linux-gnueabi-${COMMAND}..."
  Select "Apply" and "OK"
Recheck the "Problems" tab in the bottom pane - this should now report "0 items"

(e) Complete a clean build ...

Right click on project and select "Clean Project"

Right click on project and select "Build Project"

Check the "Problems" tab in the bottom pane - this should now report "0 items"

(f) Code in the required behaviour for the ShooterFlywheels subsystem ...

Add code to the src/Subsystem/ShooterFlywheels.cpp ...

  void ShooterFlywheels::Run() {
      cANTalonShooterMotorRear->Set(-1);
      cANTalonShooterMotorFront->Set(-1);
  }

  void ShooterFlywheels::Stop() {
      cANTalonShooterMotorRear->Set(0);
      cANTalonShooterMotorFront->Set(0);
  }

Add public methods to src/Subsystem/ShooterFlywheels.h ...

  void Run();
  void Stop();

(g) Code the ChuckBoulder command ...

Add to src/Commands/ChuckBoulder.cpp ...

  Add "Robot::shooterFlywheels->Run();" to the "Initialize()" method
  Add "Robot::shooterFlywheels->Stop();" to the "End()" method
  Add "End();" to the "Interupted()" method

Note that no code changes required in command header file src/Commands/ChuckBoulder.h

(h) Check that code builds and deploy to robot for testing

  Right click on project and select "Clean Project"
  Right click on project and select "Build Project"
  Right click on project and select "Run As" > "WPILib C++ Deploy"
  Start the FRC Driver station and check for "three green" then select "Enable"
  You should now be able to test operation of two motors when joystick button 4 is pressed - the motors should stop when you release the button.

(i) Repeat previous steps to add controls for remaining motor systems ...

  "FeedBoulder" command and "FeedRoller" subsystem (with "CANTalonFrontRoller" set to ID 7) and Joystick Button "JoystickButtonFeed" (button set to 3 and "When to Run" set to "whileHeld")
  "CollectBoulder" command and "PickupRoller" subsystem (with "CANTalonRearRoller" set to ID 8) and Joystick Button "JoystickButtonPickup" (button set to 5 and "When to Run" set to "whileHeld")
  NOTE: you do not need to import the project from the robot builder, simply select the project in Eclipse, right-click and select "Refresh" to load the most recent changes generated by the Robot Builder into the Eclipse project

(j) Add pnuematic systems to Robot Builder Project ...

NOTE: no compressor subsysetm needs to be created as the addition of any solenoids automatically enables the compressor management by the PCM.

Use Robot Builder as described above to create a sybsystem call "FrontArm" and add ...
  Double Solenoid called "DoubleSolenoidRight" and set ...
    "Forward PCM" to 0
    "Forward Channel" to 2
    "Reverse PCM" to 0
    "Reverse Channel" to 3
  Double Solenoid called "DoubleSolenoidLeft" and set ...
    "Forward PCM" to 0
    "Forward Channel" to 2
    "Reverse PCM" to 0
    "Reverse Channel" to 3

Add a command called "FrontArmDown" and set ...
  "Requires" field to "FrontArm"

Add a Joystick Button to Joystick called "JoystickButtonFrontArmDown" and set ...
  "Button" field to 6
  "Command" field to "FrontArmDown"
  "When to run" field to "whileHeld"

Select "Save" then "C++" then "File" > "Exit" to leave the Robot Builder

In Eclipse select the project, right-click and select "Refresh" to load the latest generated code from the robot builder.

(k) Code the FrontArm subsystem

Add the following to src/Subsystem/FrontArm.cpp

  void FrontArm::Up() {
    doubleSolenoidLeft->Set(DoubleSolenoid::Value::kReverse);
    doubleSolenoidRight->Set(DoubleSolenoid::Value::kReverse);
  }

  void FrontArm::Down() {
    doubleSolenoidLeft->Set(DoubleSolenoid::Value::kForward);
    doubleSolenoidRight->Set(DoubleSolenoid::Value::kForward);
  }

  void FrontArm::Stop() {
    doubleSolenoidLeft->Set(DoubleSolenoid::Value::kOff);
    doubleSolenoidRight->Set(DoubleSolenoid::Value::kOff);
  }

Add the following as public methods in src/Subsystem/FrontArm.h

  void Up();
  void Down();
  void Stop();

(l) Code the FrontArmDown command ...

Add to src/Commands/FrontArmDown.cpp ...

  Add "Robot::frontArm->Down();" to the "Initialize()" method
  Add "Robot::frontArm->Up();" to the "End()" method
  Add "End();" to the "Interupted()" method

Note that no code changes required in command header file src/Commands/FrontArmDown.h

(m) Check that code builds and deploy to robot for testing

You should now be able to clean-build-deploy-test operation of compressor (automatic) and the front arm movement when joystick button is pressed.

(n) Repeat previous steps to add controls for remaining pneumatic systems ...

  "ShooterArmDown" command and "ShooterArm" subsystem (forward channel 0, reverse channel 1) and joystick button "JoystickButtonShooterArmDown" (set "button" to 7 and "When to run" set to "whileHeld")

(o) Create a LowMode Command Group

This will be a "Command Group" that calls FrontArmDown and ShooterArmDown commands in parallel:

  Launch Robot Builder from eclipse
  Add a "Command Group" called "LowMode"
  Right-click on the "Start" box and select "Add Parallel" > "FrontArmDown"
  Right-click on the "Start" box and select "Add Parallel" > "ShooterArmDown"
  Add a Joystick Button called "JoystickButtonLowMode" with
    "Button" field set to 8
    "When to run" field set to "whileHeld"
  Select "Save" then "C++" then "File" > "Exit" to leave the Robot Builder
  Note that no additional code changes are required for the command group as we are just acti
  You should now be able to clean-build-deploy-test operation of compressor (automatic) and the front and shhoter arm movement when joystick button is pressed.

(p) Now set up a drive base subsystem ...

  Launch Robot Builder from eclipse
  Add a subsystem called "DriveBase" and add a "Robot Drive 4" controller and add ...
    CANTalon called "CANTalonFrontLeft" and set "ID" to 1
    CANTalon called "CANTalonRearLeft" and set "ID" to 2
    CANTalon called "CANTalonFrontRight" and set "ID" to 3
    CANTalon called "CANTalonRearRight" and set "ID" to 4
  Create a command called "DriveWithJoysticks" and set
    "Requires" field to "DriveBase"
  In DriveBase subsystem, set the Default Command field to "DriveWithJoysticks"
  Select "Save" then "C++" then "File" > "Exit" to leave the Robot Builder
  Add to the top of src/Subsystems/DriveBase.cpp ...
    #include "../Commands/DriveWithJoysticks.h"
  Add to the bottom of src/Subsystems/DriveBase.cpp ...
    void DriveBase::TakeJoystickInputs( std::shared_ptr<Joystick> stick ) {
      robotDriveFourControllers->ArcadeDrive( stick->GetY(), stick->GetZ() ) ;
    }
    void DriveBase::Stop() {
      robotDriveFourControllers->Drive(0,0);
    }
  Add the following public methods to src/Subsystems/DriveBase.h

    void TakeJoystickInputs( std::shared_ptr<Joystick> stick );

    void Stop();

  Add to src/Commands/DriveWithJoysticks.cpp ...
    Add "Robot::driveBase->TakeJoystickInputs( Robot::oi->getJoystick1() );" to the "Execute()" method
    Add "Robot::driveBase->Stop();" to the "End()" method
    Add "End();" to the "Interupted()" method

(q) You should now be able to clean-build-deploy and test all of the systems on Mr B!

TROUBLESHOOTING:

Compiler / Linker Errors:

1. If you see this error ...

"Program XXX not found in PATH"

then fix the project and eclipse preferences as described in step (d) above (i.e. prefix the required ${COMMAND} lines with "arm-frc-linux-gnueabi-" so that start of command line is "arm-frc-linux-gnueabi-${COMMAND}...")

2. If you see this error ...

"..\src\Subsystems\DriveBase.cpp:40:31: error: expected type-specifier before 'DriveWithJoysticks'"

then fix it by adding ...

"#include "../Commands/DriveWithJoysticks.h""

to the head of DriveBase.cpp file.

Code Anlyser errors:

The CDT code analyser (codan) is known to have some issues -  errors being reported when they are not expected; errors peristing after being fixed and even errors being reported when the project build works perfectly.

Things to try to solve the errors and warnings reported by the code analyser ...

1. Right click on project name then select "Index" > "Rebuild"

2. Right click on project name then select "Run C/C++ Code Analysis"

3. Exit from eclipse and then launch eclipse again

4. Add an #include "WPILib.h" to the file that is reporting the error (note that the code analyser does not seem to find symbols in files included by and included file) it should not be necessary but placing an include locally seems to resolve this problem

5. In "Window" > "Preferences" > "C/C++" > "Indexer" select "Index all header variants" - follow up with an index rebuild (Right click on project name then select "Index" > "Rebuild") and finally closing and re-opening any files that are marked with errors in the IDE (this seems to solve a lot of the unresolved symbols).

6. Check that the Project/Includes folder on the left is listing:

C:/Users/Robocamp/wpilib/cpp/current/include

and

C:/Users/Robocamp/wpilib/user/cpp/include

Running a build seems to temporarily fix this. Restart eclipse and it goes away again? Doh!

This problem does seem to be fixed by unchecking and rechecking the "Auto Manage User Libraries" at Window > Preferences > WPILib Preferences.

7. Make sure all files are saved.

8. As a last resort, copy the offending line, delete the line, save the file, error should clear, now re-instate (paste) the line and save again. This often works, presumably it forces the index to flush that record.

9. Opening and closing files in the IDE (whether they are saved or not) also seems to help sometimes.

The above list will not be exhaustive - the items that work for you will differ depending on the circumstances, as we learn more we can update this article!