Specified Castle Gem Mission
Challenge: Inside the castle walls lie red, green, and blue gems. Your mission is to pick up one specified gem of each color and place them inside the red goal located outside the Castle walls. A Mission List lists the X and Y coordinates and Heading angle for the robot to pick up each specified gem. The object of the activity is to code the VR Robot to drive to collect each required gem based on the information in the Mission List, then place them into the red goal. The fastest time wins!
The Mission List is as follows:
|
Gem |
X position |
Y position |
Heading |
|---|---|---|---|
|
Blue Gem |
-250 |
-100 |
270° |
|
Green Gem |
250 |
-100 |
90° |
|
Red Gem |
-450 |
100 |
270° |
- Select the Disk Transport Playground.
- Declare three lists to store the X and Y coordinates and Heading angle for the robot to pick up the specified blue gem, green gem, and red gem respectively.
- Declare two variables to store the distance the robot needs to travel parallel to the X-axis and Y-axis, respectively.
- Code the VR Robot to drive to pick up the specified blue gem and place it into the red goal.
- Calculate the distance the robot needs to travel parallel to the X-axis using the corresponding X coordinate retrieved from the list and its current X position. Store the calculated value to the variable.
- Calculate the distance the robot needs to travel parallel to the Y-axis using the corresponding Y coordinate retrieved from the list and its current Y position. Store the calculated value to the variable.
- Drive the robot to pick up the blue gem using the variable values and the corresponding Heading data retrieved from the list.
- Drive the robot to drop the blue gem into the red goal using the variable values.
- Code the VR Robot to drive to pick up the specified green gem and place it into the red goal.
- Code the VR Robot to drive to pick up the specified red gem and place it into the red goal.
Helpful Hints
- Create a My Block with parameters to pick up a specified gem based on the X and Y coordinates and Heading information to make the project shorter and more easily readable.
- Matching Python command:

- Matching Python command:
- Use the energize Magnet block from the Magnet category and select the boost to attract an object to the Electromagnet.
- Matching Python command:

- Matching Python command:
- Use the function block from the Operators category and choose the abs function from a list of options to calculate the absolute value of distance.
- Matching Python command:

- Matching Python command: