Skip to main content

Mars Rover-Exploring Mars Geology
Lab 2 - Study your Martian Rock Sample

Teacher Portal

Part 1 - Step by Step

  1. InstructInstruct students that they are going to build on what they learned in Lab 1 to have the Code Base collect and return a Martian rock sample (the Red Disk). But now, they will code their robot to use Eye Sensor data to sort a Disk, based on its color.
    • Show students the Field setup with the sorting area marked with the X.  Once the Code Base collects the Red Disk, it will need to drop it in the square with the X. 

    image of field setup for Play Part 1. X marks the sorting area to deliver the Red Disk
    Field Setup

    • Students will build a project with you then test it on the Mars surface (the Field). This animation shows how the Code Base will move when this project is started. 
    Video file
  2. ModelModel for students how to build the project in VEXcode GO and test their projects on the Field.

    image of project plan in VEXcode GO: When Start, "Collect Disks" comment block, and "Sort Disk" comment block with Sort
    Plan project with [Comment] blocks

    • Then, have students add the following blocks under the “Collect Disk” [Comment] block to have the Code Base drive to collect the Red Disk.

    image of project with blocks to collect the Red Disk
    Collect Disk code

    • Next, add on to the project together to have the Code Base sort the Disk. Drag a [Turn for] block into the workspace and attach it below the “Sort Disk” [Comment] block. Change the parameter to 'left' to have the Code Base turn toward the sorting area.

    image of Turn for block added to the project with the turn parameter set to left
     Add [Turn for] and set to left

    • Add an [If then] block, and place a <Detects color> block in the hexagon. Leave the <Detects color> block set to red. This will have the Code Base use the Eye Sensor to detect the color of the Disk. If this Disk is red, the <Detects color> block will report true, and the blocks that are added to the inside of the ‘C’ block will run.

    image of  [If then] block added with with <Detects color>block
     Add [If then] with <Detects color>

    • Add a [Drive for] and an [Energize electromagnet] inside the [If then] block and set [Energize electromagnet] to 'drop.' This will have the Code Base drive to the sorting area and drop the Disk.

    image of Drive for and Energize Electromagnet set to drop added to the project, inside the If then block
    Add [Drive for} and [Energize electromagnet] set to 'drop'

    • Add a [Drive for] block and set it to reverse. This will have the Code Base return to the Mars Base after it has dropped the Disk.

    image of the Drive for block added inside the If then block and set to reverse
    Add [Drive for] and set to reverse

    • Finally, add a [Turn for] block, and set it to 'left' to have the Code Base return to the starting position —facing the Mars surface collecting area.

    Image of the [Drive for] block added inside the If then block and set to reverse
    Add [Drive for] and set to reverse

    Model for students how to test their project on the Field.

    • First, show them how to place their robot at the starting point (the Mars Base) and the Red Disk on the Field as shown in the image below.  Use the gridlines on the Field to help with alignment. The Disk and the Electromagnet can both be lined up on intersecting gridlines of the Field, to make it easier for students to be set up for success when they test their projects.

    Image of Code Base set at the starting location on the Field.
    Setup to Test

    • Once the Code Base is in place, select 'Start' in VEXcode GO to test the project.  Watch as the Code Base drives to collect the Red Disk, return to base, then deliver it to the sorting area.

    Image of the Start button called out on the VEXcode GO toolbar
    Select 'Start' to test the project

    • Students will need to select the 'Stop' button in the VEXcode GO Toolbar to stop the project.
    • For students who finish early and need additional challenges, have them move the Red Disk to a different location. Can they adjust their code to have the Code Base collect the Disk and deliver it to the same sorting area?
       
  3. FacilitateFacilitate a conversation with students as they test their projects.
    • How does the Code Base rover know when to energize the Electromagnet?
    • What blocks are used to have the Code Base detect the color of the Disk?
    • What would happen if the Code Base did not detect red? 

    Focus on the concept, not the precision. The goal of this Lab is to focus on the concept of using the Electromagnet in a project. If students slightly misaligned their robot, or the Disk is not exactly in the right place when they drive toward it, let them know that it's ok to move the Disk slightly to make sure it gets picked up by the Electromagnet.

  4. RemindRemind students to check the parameters in the [Drive for] blocks to make sure the project has the correct distances needed to collect then sort the Disk.
    • They should also check that the parameters in the [Turn for] blocks are set to have the Code Base turn the correct way to return to the Mars Base and toward the sorting area.

    In order to encourage a growth mindset and help students embrace the trial and error that is a part of coding and learn from the mistakes along the way, ask questions such as:

    • What mistake have you make that has taught you something?
    • What part of the Lab is tricky, or is making you think hard?
       
  5. AskAsk students how the Perseverance Rover might use an Eye Sensor to collect information and study the different Martian rock and soil samples. What could the Perseverance Rover study with the Eye Sensor?

Mid-Play Break & Group Discussion

As soon as every group has tested their project to have the Code Base collect and deliver the Red Disk to the sorting area, come together for a brief conversation.

Check in on students' progress and talk about what the Code Base is doing in their projects.

  • How does the Eye Sensor work in our project? What block(s) control the Eye Sensor?
  • How did you make the Electromagnet work with the Eye Sensor in your project?
  • What if we change the location of the Disks? Will this project still work? Why or Why not? What parameters would you change?

Part 2 - Step by Step

  1. InstructInstruct students that they are going to apply what they learned in Play Part 1 to iterate on their projects to make the Code Base collect the Red Disk from a new location and drop it in a new sorting area. They will need to change parameters in their projects to have the Code Base collect and sort the Disk successfully.
    • Show students the new Field setup and provide them with the drive distances so that they can focus on the code for this project. The Code Base will need to drive 200 millimeters  (~8 inches) to collect the Disk, and 350 millimeters (mm) (~14 inches (in)) to the new sorting area.

    Image of Play Part two field setup. The red disk is closer, but the sorting area is in the far right square
    Play Part 2 Field Setup

    • The following animation shows one possible way that the Code Base can move to complete the challenge. 
    Video file
  2. ModelModel for students how to get started with their projects in VEXcode GO.

    If necessary, model for students how to test their project on the Field.

    • Show them how to set up to test by placing the Code Base at the Mars Base.

    image of Code Base in starting position on the Field
    Set up to test

    • Once the Code Base is in place, select 'Start' in VEXcode GO to test the project. Then, observe the behaviors of the Code Base.
    • Students will need to select the 'Stop' button in the VEXcode GO Toolbar to stop the project after it completes the challenge.

    If students finish early, have them change the location of the sorting area. Have them move it one square closer to the Mars Base.

    • The approximate distance for this sorting area is 250 millimeters (mm) (~10 inches (in)). Can they code their robot to collect and deliver the Disk to the same sorting area?
       
  3. FacilitateFacilitate a conversation with students as they build and test their projects with questions such as:
    • How does the Code Base rover need to move to collect the Disk? Can you show me with your hands?
    • What do you have to change to have your Code Base rover collect the Disk from the new location?
    • What parameters do you have to change to have the Code Base rover drop the Disk at the new sorting area?

    Prepare students for the trial and error that is an intrinsic part of the experimentation that they will engage in with this challenge. You may want to use the problem-solving cycle graphic from the Background page as a visual aide to establish a structure for the problem-solving process with your students. See the Background for more information for strategies to help students troubleshoot their projects and come up with their own solutions. 

    Image of student problem solving cycle
    Student Problem-solving Cycle

    There are many possible solutions for this challenge. The following is one example.

    Image of VEXcode GO possible solution
     Play Part 2 Possible Solution

    Focus on the concept, not the precision. The goal of this Lab is to focus on the concept of using the Eye Sensor with the Electromagnet in a project. If students slightly misaligned their Code Base, or the Disk is not exactly in the right place when they drive toward it, let them know that it's ok to move the Disk slightly to make sure it gets picked up by the Electromagnet.

    If students need additional support to connect the behaviors of the Code Base with the block commands in their project, use the Project Stepping feature to help students go through their project one block at a time to see how each block is being executed in their project. For more information on how to use the Project Stepping feature, view the Stepping Through Blocks tutorial in VEXcode GO.

    image of the icon for the Stepping Through Blocks tutorial in VEXcode GO
    Through Blocks tutorial in VEXcode GO

  4. RemindRemind students to check the order (or sequence) of the blocks, and the parameters each block is set to in their projects before they test on the Field.
    • Did the Code Base turn right instead of left? What can you change to have the robot turn in the correct direction? 
    • Was the Disk further away? How can you change the parameter in the [Drive for] block to find the right distance for the Code Base rover to travel?
    • Is the <Detects color> block set to Red (the color of the Disk)?

    Talk students through problem-solving each issue as you circle the classroom. This will be an iterative process, so remind students that scientists who code the Mars rovers also have to try multiple times to get the rover to move how they intended.

  5. AskAsk students to think about how their project has changed from Play Part 1 to Play Part 2.
    • How has your project changed from the start of the Lab until now?
    • What did you change in your project to make it work better?
    • What change did you make that made it less successful? How did you fix it?