FTC Set Up the Mecanum Training Platform 20231025
From wikidb
Contents
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
- Install the color sensor on the robot
- Plug the into IC2 port number 1
- Set the Configure a Color Sensor section below - FTC_Read_Colors_20231017#Configure_a_Color_Sensor
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?"
Photo credit:
- https://makezine.com/article/technology/robotics/choose-use-sensors-robot/
- https://youngzine.org/article-expert/technology/machines-sense-think-and-act
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
- See section: FTC_Read_Colors_20231017#Color_Sensor_Choices
- OnBot Java Guide: Electronics setup to Programming see chapter 11: Configuring Your Hardware
- Hardware and Software Configuration: Configuring a Color Distance Sensor - modify to work for a REV Color Sensor V3
Configuration File
- Control Hub
- I2C Bus 1
- Port 0 REV Color Sensor V3
- sensor_color
- I2C Bus 1
Example HW color senso configuration entry. Change ColorV3 to sensor_color for our examples.
From: https://docs.revrobotics.com/color-sensor/application-examples.