ADM Python P.3

Workcell Math & Coordinate Offsets

Arithmetic operators and calculated robot positions.

Your lesson guide

Objective

Use +, -, *, and / with variables Create coordinate offsets Use calculations to reduce repeated hard-coded values

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.

Learning Targets

  • Use +, -, *, and / with variables
  • Create coordinate offsets
  • Use calculations to reduce repeated hard-coded values

How to Use This Page

  1. Read the short lesson.
  2. Attempt every Practice Check before revealing the answer.
  3. Complete Predict It and Fix It by tracing and correcting code.
  4. Complete Modify It and Program It by writing Workcell-style Python code.
  5. Use the Mastery Check before moving to the next lesson.
Learn It

Python Idea + Workcell Connection

Python can calculate robot positions instead of requiring every coordinate to be typed manually. This is useful when pickup locations are evenly spaced or when you need a safe height above a part.

For example, safe_z = pickup_z + safe_offset creates a safe approach position above the pickup height.

Calculated coordinates reduce mistakes and make patterns easier to adjust.

Worked Example

Trace This Code

Read every line and predict what the program would do before opening the practice check.

pickup_x = 100
pickup_y = 150
pickup_z = 45
safe_offset = 75

safe_z = pickup_z + safe_offset

arm.move_to(pickup_x, pickup_y, safe_z)
arm.move_to(pickup_x, pickup_y, pickup_z)
Practice Check A

Check Your Understanding

  1. What is safe_z?

    Check Answer

    120

  2. If safe_offset becomes 100, what is the new safe z-coordinate?

    Check Answer

    145

  3. Why is this better than typing 120 directly in many places?

    Check Answer

    Changing the offset or pickup height updates the calculated safe position everywhere it is used.

Rule: If you missed more than one question, reread Learn It and trace the example again before continuing.

1 · Predict It

Trace the Code

What value is stored in safe_z? Where will the arm move first?

Do first: Write your answer in your engineering notebook.

Reveal Self-Check

safe_z is 120. The arm first moves to (100, 150, 120).

2 · Fix It

Debug the Program

Find and correct every error before opening the answer.

part_spacing = 40
first_x = 80
second_x = first_x + part_spcing
Reveal Debugging Check

Correct the misspelled variable: second_x = first_x + part_spacing.

3 · Modify It

Change Working Code

Create a third pickup x-coordinate that is two part spacings away from the first position.

Success Check

  • Your code is syntactically correct.
  • The change affects only the intended Workcell behavior.
  • You can explain what changed and why.

Evidence: Paste the revised code into your engineering notebook.

4 · Program It

Build It Yourself

Build coordinate variables for three equally spaced pickup locations using one starting coordinate and one spacing variable.

Before You Finish

  • Trace the code once by hand.
  • Check variable names, colons, parentheses, and indentation.
  • Verify that the coordinates and logic match the written scenario.
  • Add useful comments.
Interactive Practice

Python Practice Lab

Edit the code, predict the output, then click Run Code. No physical Workcell is connected.

Browser Python

P.3 Practice

Ready
Output / Errors
Predict what the code will do, then click Run Code.

Tip: Press Ctrl+Enter (Cmd+Enter on Mac) to run. The mock arm object prints simulated Workcell actions instead of controlling hardware.

Practice Check B

Explain Your Code

Without looking back at Learn It, answer these in your notebook:

  1. What Python structure or idea did you use?
  2. What Workcell behavior would this code represent?
  3. What mistake would cause the code to behave incorrectly?
What a Strong Response Includes

A strong response names the Python idea accurately, connects it to a specific Workcell action or decision, and identifies a realistic syntax or logic error from this lesson.

Mastery Gate

Ready for the Next Lesson?

  • □ I can calculate coordinates from other variables.
  • □ I can use spacing and offsets instead of hard-coded values.
  • □ I can trace arithmetic before the arm moves.

Move on only when you can check every statement. If one is still uncertain, revisit the worked example or redo Fix It before continuing.

Command Reference

VEX Workcell Python API

Use the official VEX API only as a programming reference to verify method names and parameters. The examples use the configured arm name arm. No physical Workcell is required.

Open EXP Workcell Arm API

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.