Advanced Robotics Programming: Difference between revisions

From TrcWiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
The Advanced Robotics Programming Class focuses on teaching our ''Titan Robotics Framework'' (TRC Library). The target audience of this Programming Class is for students who already have basic knowledge of the Java language. The class is primarily designed for FRC although it is also applicable for FTC because our ''TRC Library'' is shared between FTC and FRC. After finishing this class, you should be able to write code for both FTC and FRC robots with some minor differences.
The Advanced Robotics Programming Class focuses on teaching our ''Titan Robotics Framework'' (TRC Library). The target audience of this Programming Class is for students who already have basic knowledge of the Java language. The class is primarily designed for FRC although it is also applicable for FTC because our ''TRC Library'' is shared between FTC and FRC. After finishing this class, you should be able to write code for both FTC and FRC robots with some platform specific differences.


== Programming Software Installation ==
== Programming Software Installation ==
Line 9: Line 9:
At this point, you should have installed all necessary software for developing robot code and also clone the robot template code from the GitHub repo. Since the template already contains basic code for three different kinds of robot base (Differential Drive, Mecanum Drive and Swerve Drive), it takes very few modifications to make it work with any of the three types of robots.
At this point, you should have installed all necessary software for developing robot code and also clone the robot template code from the GitHub repo. Since the template already contains basic code for three different kinds of robot base (Differential Drive, Mecanum Drive and Swerve Drive), it takes very few modifications to make it work with any of the three types of robots.


In RobotParams.java, update the string constants HWNAME_xxDRIVE_MOTOR corresponding to the hardware names of the four driving wheel motors in your robot config.
* [[Changes to make your FRC Swerve Drive Base drivable in TeleOp]]
Compile the code and deploy it to the robot.
* [[Changes to make your FTC Mecanum Drive Base drivable in TeleOp]]
Place your robot on a stand so that the wheels can be free running without the robot running away from you. When looking down on the robot, the mecanum wheel rollers should form an X. If not, switch the mecanum wheels around until they form an X. On the Driver Station, activate your robot configuration. Select a TeleOp Opmode on the Driver Station called FtcTest. Press the init button to initialize the opmode. Press the D-pad down button on your driver gamepad until the "Test" shown on the Driver Station is on "Drive motors test". Press the D-pad right button to select the test. Then press the "Play" button on the Driver Station to start the opmode. This test will run each of the four driving wheels one after the other for 5 seconds each in the sequence of Left Front, Right Front, Left Back and Right Back. Note the rotation direction of each wheel and make sure they would have run the robot in the forward direction if the robot were placed on the ground. If any of the wheels are rotating in the wrong direction, correct them in RobotParams.java. Change xxDRIVE_INVERTED from true to false or vice versa to reverse the corresponding driving wheels until the test shows all four wheels rotating in the correct direction.
That's it. Your robot is now ready to be driven in TeleOp mode. The default drive mode is "Arcade Mode". It means the left stick on the driver gamepad controls the X and Y direction of the robot. The X-axis of the right stick controls the rotation. If you prefer, you can change the drive mode to "Holonomic Mode". In this mode, the Y-axis of the left stick controls the Y direction of the robot. The X-axis of the right stick controls the X direction, the left trigger controls turning left and the right trigger controls turning right. To change to this mode, change ROBOT_DRIVE_MODE in RobotParams.java to DriveMode.HOLONOMIC_MODE.
 
In addition, there are a few more buttons on the driver gamepad that modify how the robot is driven. Click the right bumper on the driver gamepad will toggle between Robot and Field Oriented driving modes. Our library also supports Inverted driving mode allowing the robot to switch the front and back end. This is useful for a robot that has an end effector such as an intake at the back so that the drivers can drive the robot around as if the intake is in front. Press and hold the left bumper allows you to drive the robot at slow speed. This is useful for delicate movement of the robot.


== Creating Subsystems ==
== Creating Subsystems ==

Revision as of 22:35, 22 June 2024

The Advanced Robotics Programming Class focuses on teaching our Titan Robotics Framework (TRC Library). The target audience of this Programming Class is for students who already have basic knowledge of the Java language. The class is primarily designed for FRC although it is also applicable for FTC because our TRC Library is shared between FTC and FRC. After finishing this class, you should be able to write code for both FTC and FRC robots with some platform specific differences.

Programming Software Installation

Before coming to the programming class, you need to install the required software on your laptop. Please do this at home before coming to class. We do not want to dedicate class time to install software because they are time consuming and require downloading gigabytes of data from the Internet which would overwhelm our Internet bandwidth if all students were downloading at the same time. Therefore, please make sure you finish these tasks at home before coming to class.

TeleOp Driving a Robot Right Out-Of-The-Box

At this point, you should have installed all necessary software for developing robot code and also clone the robot template code from the GitHub repo. Since the template already contains basic code for three different kinds of robot base (Differential Drive, Mecanum Drive and Swerve Drive), it takes very few modifications to make it work with any of the three types of robots.

Creating Subsystems

  • Motor Actuators
    • Elevator
    • Slide
    • Arm
    • Turret
  • Intake
  • Conveyor
  • Shooter
  • Grabber

Connecting Subsystems to the Robot

  • Instantiate the subsystems
  • TeleOp control of the subsystems
  • Display subsystem status

Writing Autonomous Code