Files
micromelon-website/content/resources/activity-claw-attachment.mdx
Tim Hadwen 1f8c46597b Site audit: fix broken images, add activity metadata, clean up content
- Remove broken image references from 25 MDX files (deleted spacer/content images)
- Add codingSkills and roverConcepts frontmatter to 24 activity pages
- Fix "Activity Demonstration" headings in 15 activity files (plain text -> h3)
- Remove unused "All" category from 89 MDX files
- Decode HTML entities (> <  ) in 9 content files
- Escape bare < > characters in MDX to fix build errors
- Standardize contact email to contact@micromelon.com.au
- Add missing description to rover-repair-request metadata
- Include previous session work: about-us updates, difficulty filtering,
  LearningPathway component, expanded schools list, new product/resource images

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 21:49:15 +10:00

80 lines
3.9 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "Activity: Claw Attachment"
date: "2023-07-31"
categories: ["Activities", "Simulator Activities"]
tags: ["Colour Sensors", "Branching", "Iteration", "Algorithm Design", "Advanced"]
codingSkills: ["Branching", "Iteration", "Algorithm Design"]
roverConcepts: ["Colour"]
excerpt: "Use the claw to grab the Meloncube and perform delivery tasks in a warehouse scenario. Use the colour sensors on the robot to read colour codes for delivery instructions. SetupThe initial activity can be to have an indicator line on the"
featuredImage: "/images/resources/activity-claw-attachment.jpg"
---
Use the claw to grab the Meloncube and perform delivery tasks in a warehouse scenario. Use the colour sensors on the robot to read colour codes for delivery instructions.
### Setup
The initial activity can be to have an indicator line on the ground using tape, which the robot starts behind. The Meloncube can be placed 30cm in front of this line, and students can be tasked to grab the cube and bring it back over the line. Depots can then be introduced to create a warehouse scenario.
Any object can be used in place of our Meloncube, however, if you wish to use it, head on over to Printables or Thingiverse to download the print file:
[Printables: MelonCube](https://www.printables.com/model/639390-micromelon-meloncube)
[Thingiverse: MelonCube](https://www.thingiverse.com/thing:6284246)
Depots are walled square areas for the rover to deposit a Meloncube in. The walls can be constructed from tape on the ground or solid materials in a 20cm x 15cm area. Use the diagrams below as a reference for the layout of the depots. A number can be allocated to each depot, and students can deliver the cube to each depot on demand.
Add coloured tape to the previous challenge to add more complexity. The tape could indicate which depot the cube must be delivered to. The rover can use the colour sensor to detect the colour of the tape and use the appropriate delivery instructions. A final extension challenge is leaving the cube in one of the depots and having the rover retrieve it and put it behind the indicator line.
![](/images/content/e4ab6e-activity-1.png)
![](/images/content/431736-activity-2.png)
![](/images/content/da48a1-activity-3.png)
![](/images/content/7f2610-challenge.png)
### Heres Our Approach
**Constant -** A constant is a variable that never changes when the code is run. In python, we write this in all capitals with underscores between words.
#### 1) Setting the Constants:
![](/images/content/0f139c-constants.png)
Start by defining two constants: the servo claw open and close positions. Trial and error will have to be used to find the correct settings for your rover.
#### 2) Grab and Release:
![](/images/content/c0adb9-functions.jpg)
Next, make two functions for *grab* and *release. *While these functions only have the Move Servo block, doing this makes it easier to understand the code.
#### **3) Data Input:**
![](/images/content/8ba438-input.png)
In the main code, well make a variable named Input, which will request the depot number to deliver the cube.
If youre using colour indicators instead, the input request can be replaced with an if else statement that detects the colour and sets the input to a depot number.
#### **4) Secure the Cube:**
![](/images/content/217152-move.png)
Once the robot has acquired the delivery instructions, the robot will approach the cube and use the *grab* function to pick up the meloncube.
#### 5) Delivering the Cube:
![](/images/content/b591f2-depot.png)
Depending on how your depots are set up, create delivery instructions using movement blocks to deliver the cube. Finish off the code by releasing the cube.
#### Complete Code:
![](/images/content/66fe8b-capture.png)
**Tip:**
You can add tracks on the ground for the rover to line-follow or create maze walls to allow the use of the IR sensors for navigation.