ADM Project 1.2.3

Stacking Objects

Use loops, variables, and a magnetic end effector to stack objects in a planned layout.

Your lesson guide

Objective

Work toward the lesson goal: Stacking Objects. Use the directions and success criteria in the activity below.

Materials

For the online work: a browser and your engineering notebook. Follow the activity’s materials list for any physical build, and get teacher approval before using equipment.

Plan your time

Suggested work block: 45–60 minutes. Physical builds and projects may span several classes; follow your teacher’s schedule.

Lesson Overview

In this project, you will apply robotic movement, sequencing, variables, loops, and spatial planning to stack objects accurately and repeatably. The example uses a magnetic end effector to pick up cubes, move them into rows, build additional layers, and adjust placement height.

Notes

  • This project extends palletizing by stacking objects in multiple layers.
  • The magnetic end effector must be set before pickup and placement begins.
  • Variables such as z, yPos, and xPos control height and placement locations.
  • Repeated pickup and drop-off patterns are handled with loops.
  • Final submissions should include comments that clearly explain each row, layer, height change, and final placement.
Code example

1.2.3: Stacking Objects

Review the code, copy it when needed, and add comments before submitting your final version.

VEXcode Python Example
Code examples may be incomplete or missing comments. Comments are required for code submissions.
def main():
    arm.set_end_effector_type(Arm.MAGNET)
    arm.set_speed(100)

    cubes = 2
    yPos = 185
    z = 60
    arm.move_to(180, 0, 180)
    #place cubes in back row
    for x in range(cubes):
        #move to pick up cube

        arm.move_to(48, 152, 30)
        arm.move_to(48, 152, 25)
        arm.set_end_effector_magnet(True)
        #move to drop off cube
        arm.move_to(48, 152, z)
        arm.move_to(200, yPos, z-15)
        arm.move_to(200, yPos, z-19)
        arm.set_end_effector_magnet(False)
        arm.move_to(168, 160, 100)
        yPos = yPos - 50
    xPos = 135

    #front row cubes
    for x in range(cubes):
       #move to pickup cubes
        arm.move_to(48, 152, 30)
        arm.move_to(48, 152, 25)
        arm.set_end_effector_magnet(True)
        #move to drop off cubes
        arm.move_to(48, 152, z)
        arm.move_to(150, xPos, z-15)
        arm.move_to(150, xPos, z-19)
        arm.set_end_effector_magnet(False)
        arm.move_to(168, 160, 100)
        xPos = xPos + 50

    stacks = 2
    z = 90
    yPos = 185
    for x in range(stacks):
        #move to pick up cube

        arm.move_to(48, 152, 30)
        arm.move_to(48, 152, 25)
        arm.set_end_effector_magnet(True)
        #move to drop off cube
        arm.move_to(48, 152, z)
        arm.move_to(200, yPos, z-15)
        arm.move_to(200, yPos, z-19)
        arm.set_end_effector_magnet(False)
        arm.move_to(168, 160, 100)
        yPos = yPos - 50
    xPos = 135

    #front row cubes
    for x in range(stacks):
       #move to pickup cubes
        arm.move_to(48, 152, 30)
        arm.move_to(48, 152, 25)
        arm.set_end_effector_magnet(True)
        #move to drop off cubes
        arm.move_to(48, 152, z)
        arm.move_to(150, xPos, z-15)
        arm.move_to(150, xPos, z-19)
        arm.set_end_effector_magnet(False)
        arm.move_to(168, 160, 100)
        xPos = xPos + 50
#increase height
    z = 130
    arm.move_to(48, 152, 30)
    arm.move_to(48, 152, 25)
    arm.set_end_effector_magnet(True)
    #move to drop off cubes
    arm.move_to(48, 152, 100)
    arm.move_to(145, 140, 90)
    arm.move_to(145, 140, 88)
    arm.set_end_effector_magnet(False)
    arm.move_to(168, 160, 100)

Build your lesson report

Checkpoint: is your evidence ready?
  • Check calculations, units, labels, and measurements against the activity requirements.
  • Record what actually happened, including unexpected results.
  • Explain what you changed and why; attach required drawings, photos, CAD, or code in your classroom assignment.

Submit the evidence specified in the activity and your classroom assignment. The report below collects your notes, calculations, observations, and reflections; attach any required drawings, photos, CAD, or code separately.

A PDF download is not a submission. Review it, then upload it and any required attachments through your classroom assignment system.