FTC Set Up the Mecanum Training Platform 20231025

From wikidb
Revision as of 15:44, 24 October 2023 by Edc (Talk | contribs)

Jump to: navigation, search

Why

  • Create a program testing platform. We want to create programs that we can copy to the competitions robot without modification.

Check Points

Check Point 2

  • Locate the the Drive Mecanum program in GetHub and copy it to your laptop. You will need internet access for this step
  • Load the program into your robot

Check Point 3

  • This program will not run correctly because it robot hardware needs to be configured for a different motor configuration.
  • Configure these motors with the same I2C connections and motor names as the competition robot.
  • Change the motor names in the java program to match the configuruation
  • Build
  • You can not test yet because the Driver Hub has not yet been configured.

Check Point 2

Check Point 3

  • Run and test the program
  • You should be able to see RGB and HSV color value displayed on the Driver Hub based on the color of objects under the color sensor - make sure the sensor is turned on
  • What is the Hue value of our roll of green tape?

Check Point 4

  • Check for the green tape and send a telemetry message to the Driver Station
            // Check for green using hue
            if (hsvValues[0] >110 && hsvValues[0]<140)
            {
               telemetry.addLine()
                   .addData("wow", “ I see something green.");
               telemetry.update();
            }
  • TBD - suggest a program name change

Check Point 5

  • Modify the program so that the robot moves forward.
    • Change "DRIVE" to "true"

Check Point 6

  • Modify the program to move backwards when the robot encounters a green line of tape.

Sense - Think - Act loop

We have just implemented an Sense-Think-Act loop.

  • Which code implements "Sense?"
  • Which code implements "Think?"
  • Which dode implements "Act?"

Sense-think-act.jpeg

Photo credit:

Configure a Color Sensor

Color Sensor Demo Code

Find this line of code

  colorSensor = hardwareMap.get(NormalizedColorSensor.class, "sensor_color");

Physical Connection

  • Connect Color Sensor to one of the I2C ports - 1 in this case

Configure Hardware

References

Configuration File

  • Control Hub
    • I2C Bus 1
      • Port 0 REV Color Sensor V3
      • sensor_color

Example HW color senso configuration entry. Change ColorV3 to sensor_color for our examples.

ColorSensorConfiguration.png

From: https://docs.revrobotics.com/color-sensor/application-examples.

RGB (Red Green Blue) and HSV (Hue Saturation Value) Color Models