Sample FTC Blocks Opmodes: Difference between revisions

From ORTOP Wiki
(Added line breaks.)
(Deleted redundant list; added category)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
Sample Op Mode Programs
Here are some additional sample opmodes. You can download them to your computer (by right clicking) and then use the Upload Op Mode button on the Blocks main menu to add them to your list of op modes.  Review the comments in each sample for information on connecting motors and sensors and setting up a matching config file. All of these op modes are intended to be used during the Autonomous period.  Display the op mode by selecting it from the list after you have uploaded it.  If it is labeled as TeleOp to the right of its name, change it to Autonomous and Save it.  This will cause it to correctly appear in the left menu on the Driver Station menu.
 
As discussed earlier, there are over a dozen sample op modes available from a drop-down menu when you create a new op mode.  Here are some additional sample op modes. You can download them to your computer (by right clicking) and then use the Upload Op Mode button on the Blocks main menu to add them to your list of op modes.  Review the comments in each sample for information on connecting motors and sensors and setting up a matching config file. All of these op modes are intended to be used during the Autonomous period.  Display the op mode by selecting it from the list after you have uploaded it.  If it is labeled as TeleOp to the right of its name, change it to Autonomous and Save it.  This will cause it to correctly appear in the left menu on the Driver Station menu.


* [https://ortop.org/ftc/BlocksProgramming/REV-Gyro-Nav-Full.blk Navigate with the gyro built into REV Expansion Hub’s Inertial Measurement Unit (IMU)]
* [https://ortop.org/ftc/BlocksProgramming/REV-Gyro-Nav-Full.blk Navigate with the gyro built into REV Expansion Hub’s Inertial Measurement Unit (IMU)]
Line 41: Line 39:


     Demonstrates how to use Tensor Flow during the Autonomous Period to seek, find and touch a SKYSTONE. This file can also be access via https://tinyurl.com/SeekSkystoneBLK Here’s a link to a PDF file showing the blocks of this Op Mode that you can display or print: [https://tinyurl.com/SeekSkystonePrint tinyurl.com/SeekSkystonePrint]
     Demonstrates how to use Tensor Flow during the Autonomous Period to seek, find and touch a SKYSTONE. This file can also be access via https://tinyurl.com/SeekSkystoneBLK Here’s a link to a PDF file showing the blocks of this Op Mode that you can display or print: [https://tinyurl.com/SeekSkystonePrint tinyurl.com/SeekSkystonePrint]
[[Category: FIRST Tech Challenge]]

Latest revision as of 14:03, 29 September 2020

Here are some additional sample opmodes. You can download them to your computer (by right clicking) and then use the Upload Op Mode button on the Blocks main menu to add them to your list of op modes. Review the comments in each sample for information on connecting motors and sensors and setting up a matching config file. All of these op modes are intended to be used during the Autonomous period. Display the op mode by selecting it from the list after you have uploaded it. If it is labeled as TeleOp to the right of its name, change it to Autonomous and Save it. This will cause it to correctly appear in the left menu on the Driver Station menu.

  Uses the gyroscope built into the REV Expansion Hub to allow an autonomous op mode to move straight and turn.  You can modify it to implement other autonomous driving sequences.
   Uses motor encoders to control movement of the robot on the playing field.  Can be modified to implement other autonomous driving sequences.  Also see YouTube video on this subject.
   Use the Display REV Color-Distance Sensor Readings op mode above to measure light values for the line and its background.  Average them and use this value to adjust threshold in the code for the op mode. This op mode can be adapted to other sensors by referring to the other display programs above.
   This sample op mode does nothing but includes comments that give hints on how three functions might be executed in pseudo parallel.  This approach may be helpful if you need your robot to do two or three things at once during autonomous mode. Each function may need a state variable to help it keep track where it is in performing a sequence of tasks.  A state variable can be a numeric variable with a different integer value for each step in the sequence.  Each function can check its state variable to determine what it is currently doing and change the variable’s value if it’s time to do something different.
  • Programming your op mode for the Autonomous Period as a sequence of stages. (Template to be linked later)
   If your robot does a sequence of things in stages with each stage containing certain actions, you will probably find it easier to perform each stage in sequence rather than using the parallel approach in the template above.  You can put the code for each stage in the main op mode or put it in a Blocks function, which is called by the main op mode. Either way, you should always check isStopRequested before starting each stage and during any loops.  See the video on Ensuring Your Robot Will Stop. 
   This sample program combines examples of autonomous driving with good practice in monitoring stop requests so the robot will pass inspection and behave well on the field.
   Demonstration of text-to-speech feature included in Blocks Programming.
   Demonstrates how to use Tensor Flow during the Autonomous Period to find and pick up gold minerals. This file can also be accessed via tinyurl.com/SeekGoldBLK Here’s a link to a PDF file showing the blocks of this Op Mode that you can display or print: tinyurl.com/SeekGoldPDF
   Demonstrates how to use Tensor Flow during the Autonomous Period to seek, find and touch a SKYSTONE. This file can also be access via https://tinyurl.com/SeekSkystoneBLK Here’s a link to a PDF file showing the blocks of this Op Mode that you can display or print: tinyurl.com/SeekSkystonePrint