Files
micromelon-website/content/resources/activity-digger-and-tipper-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

159 lines
6.2 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: Digger and Tipper"
date: "2023-01-11"
categories: ["Activities", "Simulator Activities"]
tags: ["Colour Sensors", "Branching", "Iteration", "Algorithm Design", "Advanced"]
codingSkills: ["Branching", "Iteration", "Algorithm Design"]
roverConcepts: ["Colour"]
excerpt: "Use the digger and tipper attachments together to make your own construction site. Put the digger to work on a pile of material like beads or seeds, and use the tipper to transport it to a new location. SetupFirst, find some grain-like"
featuredImage: "/images/resources/activity-digger-and-tipper-attachment.jpg"
---
Use the [digger ](https://micromelon.com.au/store/p/micromelon-digger-attachment)and [tipper ](https://micromelon.com.au/store/p/micromelon-tipper-attachment)attachments together to make your own construction site. Put the digger to work on a pile of material like beads or seeds, and use the tipper to transport it to a new location.
### Setup
First, find some grain-like material, for example, jewellery beads or seeds. Then set up a small area with walls on three sides. This area will hold the grains, and the digger will come in from the opening to pick up the material. Position the tipper near the pile so the digger can load it up. Then have the tipper move to a new area outlined by tape to deposit this pile. Change the locations, materials, and number of robots to customise your construction site!
### 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.
#### Digger
**0) Servo Interpolation:**
```
def slow_servo(Left, Right):
# This is a function that slowly moves both servos to new positions
# Right - The new position of the right servo
# Left - The new position of the left servo
TIME = 400
STEP_TIME = 20
currentPosition = Servos.read()
lCurrent = currentPosition[0]
rCurrent = currentPosition[1]
steps = round(TIME / STEP_TIME)
if currentPosition[0] == Left:
lCurrent += 1
if currentPosition[1] == Right:
rCurrent += 1
lStepSize = steps / (Left - lCurrent)
rStepSize = steps / (Right - rCurrent)
for i in range(1, steps + 1):
Servos.setBoth(lCurrent + i / lStepSize, rCurrent + i / rStepSize)
delay((STEP_TIME / 1000))
```
Servo interpolation is a technique we implemented to smooth out the servo movements. This is because if the servos jerk around too much, the digger may drop the load. This technique is optional, as the normal servo block still works. If you wish to use smooth servos, switch to the text editor and copy the code below into it. Then switch back to blocks if desired.
#### 1) Setting the Constants:
![](/images/content/c98b73-d_constants.png)
First, we set the constants for the two servos on the digger.
The digger will need to go between a resting position, used to pick up material, a raised position, to hold materials, and a tip position to deposit the material.
For the resting position, we will define two constants:
- bucket_neutral should position the bucket, so it is flat on the ground
- arm_down should place the arms flat against the rover's body.
For the loading position, we will define another two constants:
- bucket_up should position the bucket, so the items dont fall out in the air but they also dont fall out the back either
- arm_up should place the arms so they are raised in the air.
For the tip position, we will define another two constants:
- bucket_down should tip the bucket fully forward to deposit its contents
- arm_tip should position the arm slightly forward
The constants we have provided might need to be tweaked for your specific rover. This can be done through trial and error to find the best values for you.
**2) Define the Functions:**
![](/images/content/946ed9-d_functions.png)
Next, well make some functions to make operating the arm easier. The three functions to be defined are Up, Tip, and Down. We define these functions simply to make the code cleaner. Each function is in charge of moving the servos to the correct positions to move the arm up, down, and to tip.
It can help to look at section (1) and see the constants are grouped in each of these functions. Remember that it is optional to use the slow_servo function. Simply replace it with the Set servo degrees block as an alternative.
#### **3) Prepare the Servos:**
![](/images/content/7499bb-d_down.png)
Back in the main code, start by setting the down position on the digger.
#### **4) Make Your Routine:**
![](/images/content/e33809-d_routine.png)
From here, you can choose how your digger operates depending on the layout of the construction site. Make sure to use the functions when making your sequence. The digger in our example acts out the following sequence:
- Moves forward into the pile
- Backs away a little from the pile
- Raises the arm
- Backs away completely from the pile
- Turns towards the tipper
- Moves forward towards the tipper
- Tips the load into the tipper
#### Complete Code:
Note that the slow_servo function is not included in this snippet.
![](/images/content/795493-d_complete.png)
####
#### Tipper
#### 1) Setting the Constants:
![](/images/content/5eee43-t_constants.png)
Similar to the digger, we need to set the tipper servo positions. tip_up is when the tray is fully tipped, and tip_rest is the resting position of the tray.
#### **2) Prepare the Servos:**
![](/images/content/9d29a9-t_sevo.png)
The servo is set to the rest position.
#### **3) Make Your Routine:**
![](/images/content/a6a70e-t_routine.png)
From here, you can choose how your tipper operates depending on the layout of the construction site. The tipper in our example acts out the following sequence after being loaded:
- Moves away from the digger
- Turns towards the pile
- Moves towards the pile
- Tips the load
#### Complete Code:
![](/images/content/ae3050-t_complete.png)
#### Tip:
Feel free to use the sensors on the robots to make your way around the construction site. Add tape on the ground for line follow and walls for proximity sensing. Additionally, the loads dont have to be grain-like either. Try using the digger to load up a meloncube.