Overview

In this lesson we are going to focus on solving a one dimensional problem via an automation algorithm. To achieve this we will use the base robot you constructed last lesson and Vex’s block-based coding system.

Basic Bot final product

Outcomes Covered

  • ETL 1130: Robotics 1
    • 4. demonstrate basic competencies
    • 5. make personal connections to the cluster content and processes to inform possible pathway choices
  • CSE 1110: Structed Programming 1
    • 1. demonstrate introductory structured programming skills by writing sequential algorithms to solve problems involving input, processing and output
    • 2. translate algorithms into source code, convert the source code into machine executable form, execute and debug, as required
    • 3. analyze and compare the results of the program with the intent of the algorithm and modify as required
    • 4. demonstrate basic competencies
    • 5. make personal connections to the cluster content and processes to inform possible pathway choices

Materials

  • Computer /w Vex V5 Blocks installed
  • USB Type A to USB Micro Cable
  • Base Bot from the Basic Ball Lesson

Software

I highly recommend that if you are new to coding you start your robotic coding career with VEXcode V5 Blocks rather than a tex based language, like VEXcode V5 Text. You can find links to both programs below, download and install the program of your choice, then continue on with the lesson. Please note there currently is no native Linux based VEXcode program.

Coding

Coding Behavoirs

The goal of this lesson is for your robot to transfer medical supplies from one point to another without any direct input from you (also known as autonomously).

To achieve this, we must code the robot to perform a specific set of tasks (this is referred to as a robotic behavior). You can think of these behaviors as the task a robot is capable of doing. Robots can have both simple and complex behaviors. Some examples of simple behaviors are:

  • Rotate a motor assigned to a specified port
  • Drive forward (rotate both the left and right motors using the Drivetrain)
  • Travel 5 meters (drive forward, then stop)

Often more complex behaviors are broken down into multiple simple behaviors. For example, the task of picking up an object and moving it to another point may be broken down into the following behaviors:

  • Drive forward 50cm
  • Pick up object
  • Turn 90 degrees clockwise on the spot
  • Drive forward 75cm
  • Drop object

Planning Code

When coding an behavioural algorithm, we want to account for all the variables that could impede our robot’s ability to complete its task with a favorable outcome. Here is a list of some of the variables you should take into account when coding your robot.

  • The dimesions of the drive space.
  • The dimesions of the robot.
  • The size of the tires.
  • The travel speed.
  • Any many more… Try to come up with a few on your own.

Explore

Before We Begin

It is time to code, open VEXcode V5 Blocks and let’s get started.

  • Here is a block from the VEXcode V5 Blocks program.

This block will move your robot forward one inch. Thinking back to our exploration of behaviors, we can use this block to as a movement types of behavior. Use this time to explore the VEXcode V5 block software, most blocks can act as behaviors that we can use to complete more complex behaviors.

Our First Project

Follow the steps below to complete your first project using VEXcode V5 Blocks.

  • Start a New Project
    • Before you begin your project, select the Speedbot (Drivetrain 2-Motors, No Gyro) template project. The template project contains the Basic Bots’s motor configuration. If the template is not used, your robot will not run the project correctly.
    • Open the File menu.
    • Select Open Examples.
    • Select and open the Speedbot (Drivetrain 2-motors, No Gyro) template project.
    • Since we will be using the drive for block, rename your project Drive.
    • Save your project.
  • Drive Foward
    • Add the drive for block to the when started block in the programming area.
    • Select the drop-down and change the units from inches to millimeters.
    • Change the distance from 1 mm to 100 mm.
    • Click on the Slot icon. You can download your project to one of the four available slots in the Robot Brain. Click on the number 1.
    • Connect the robot to your computer. The Brain icon in the toolbar turns green once a successful connection has been made.
    • Click the Download button on the toolbar to download the Drive project to the Robot Brain.
    • Check to make sure your project has downloaded to the Speedbot’s Brain by looking at the Robot Brain’s screen. The project name should be listed in slot 1.
    • Run the project on the Speedbot robot by making sure the project is selected and then press the Run button on the Robot Brain. Congratulations on creating your first project!
  • Drive Reverse
    • Go back to the VEXCode V5 Blocks programming area. Change the drive for block to display reverse instead of forward.
    • Download the project
    • Run the project by making sure the project is selected and then press the Run button on the Robot Brain.
  • Wait then Drive in Reverse
    • Go back to the VEXCode V5 Blocks programming area. Add a wait block before the drive for block. This will tell the robot to wait before driving in reverse.
    • Insert three seconds into the wait block. This tells the robot to wait three before driving in reverse.
    • Download the project
    • Run the project by making sure the project is selected and then press the Run button on the Robot Brain.
  • Micro-Challenge: Robotic Lines
  • In this challenge your goal is to create a behavior for your robot to complete a line-like drill. The behavoir you create should follow the following procedure (in order):

    1. Drive Forward 30cm
    2. Wait 1 second
    3. Drive Reverse 30cm
    4. Wait 1 second
    5. Drive Forward 60cm
    6. Wait 1 second
    7. Drive Reverse 60cm
    8. Wait 1 second
    9. Drive Forward 90cm
    10. Wait 1 second
    11. Drive Reverse 90cm
    12. ~Finish~

    Keep in mind that each tile on the classroom floor is 30cm by 30cm and that 10mm = 1 cm. When you are complete make sure you show it off to Mr. MacKay.

Challenge: Automated Hospital

In this challenge, you need to program your robot to navigate a hospital as it delivers medications to patients in several different rooms. To successfully complete this challenge, you will need to program your robot to move from the Start Zone and stop in the Pharmacy for 5 seconds to pick up medications.

The project should then move the robot to each of the Patient Rooms (1, 2, and 3 in no particular order) and stop in the room for 3 seconds to deliver the medication. In order to move between floors in the hospital, the robot needs to park in the area designated as the Elevator for 5 seconds to indicate it is moving to another floor.

After medication has been delivered to all of the rooms, the robot should then return to the Start Zone. You should recreate the hospital map above on your floor using tape and a meter stick or ruler. Be sure to indicate where the Start Zone, Pharmacy, Elevator, and Patient Rooms are located.

To complete the challenge, you will need:

  • Roll of tape (to create the hospital layout on the floor)
  • 1.8 meter by 2 meter open area
  • Meter stick or ruler

Further

This section is reservered to AP like challenges for students wanting to take their learning further.

Mark as Complete
chevron_right