Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
6f95189
update year
celestial-starfruit Oct 20, 2024
ca5a890
update team names
celestial-starfruit Oct 20, 2024
541fcd0
change team names in zones.md
celestial-starfruit Oct 20, 2024
2ab143f
blockly marker update - idk its midnight and isn't tested
celestial-starfruit Oct 20, 2024
6ea27dc
update zone.md example code
celestial-starfruit Oct 21, 2024
73eafa4
missed a potato name
celestial-starfruit Oct 21, 2024
e21fa72
update robocon header image
celestial-starfruit Oct 21, 2024
1ffd73f
patch passphrase
celestial-starfruit Oct 22, 2024
2458e63
change "side" to "leg"
celestial-starfruit Oct 22, 2024
0d0f3e4
link + servo index changes
celestial-starfruit Oct 22, 2024
f4a92ff
part of last update
celestial-starfruit Oct 22, 2024
997487d
Change vision.md to remove reference to potato
MostlyTurquoise Oct 26, 2024
c2c1514
Update servos.md for 2025, fr this time
MostlyTurquoise Oct 26, 2024
d83bb40
Remove duplicate servo mode set
MostlyTurquoise Oct 26, 2024
06c9d4a
BLOCKLYYYY 2025
MostlyTurquoise Oct 26, 2024
7469794
Updated markers file to be correct as pdf not zip
what-does-that-do Oct 31, 2024
3ec417f
Removed markers.zip
what-does-that-do Oct 31, 2024
5505f43
Adds target_type documentation, and updates definitions of markers to…
what-does-that-do Oct 31, 2024
4f91b98
Added target_type to tip
what-does-that-do Nov 1, 2024
6efc18a
Added 2025 rulebook
what-does-that-do Nov 1, 2024
cfdcf6d
Removed getting to robocon (it's corrupted)
what-does-that-do Nov 1, 2024
c61d8e9
Updated code example to not use potatoes!!
what-does-that-do Nov 1, 2024
1ef9f2f
Minor change to example
what-does-that-do Nov 1, 2024
6d3067b
Added target_type blocks
what-does-that-do Nov 1, 2024
9ed5f4e
MostlyTurquoise Nov 1, 2024
b1e1c03
Update README.md for correct logo file name
what-does-that-do Nov 4, 2024
20a083f
Add logo with sponsors image
what-does-that-do Nov 4, 2024
b38c6d2
Add fix blockly bugs and add to toolbox.
MostlyTurquoise Nov 2, 2024
05b4804
Merge branch '2025-changes' of https://github.com/systemetric/sheep i…
MostlyTurquoise Nov 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion app/components/editor/blockly/Blockly.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,31 @@ export default Vue.extend({
// noinspection TypeScriptUnresolvedFunction
this.workspace.addChangeListener(() => {
// noinspection TypeScriptUnresolvedFunction
let blocklyGeneratedCode:string = Blockly.Python.workspaceToCode(this.workspace);
// I apologise in advance - this is gonna be hacky...
let definesAtStart:string[] = []
let pwmUses = blocklyGeneratedCode.match(/R\.servos\[[0-3]\]\ \=\ /g);
for(let i = 0; i < pwmUses.length; i++){
let pwmIndex = pwmUses[i][9];
let pythonLine = `R.servos[${pwmIndex}].mode = PWM_SERVO`;
if(!definesAtStart.includes(pythonLine)){
definesAtStart.push(pythonLine);
}
}
this.code = `from robot import *
import time

R = Robot()
${definesAtStart.join("\n")}

${Blockly.Python.workspaceToCode(this.workspace)}
${blocklyGeneratedCode}

while True:
time.sleep(1)
`;



if (this.saveTimeout) clearTimeout(this.saveTimeout);
if (this.workspace) {
this.$store.commit(MUTATION_UPDATE_PROJECT, {
Expand Down
118 changes: 90 additions & 28 deletions app/components/editor/blockly/blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function loadMovementBlocks(Blockly) {
init: function() {
this.appendDummyInput()
.appendField("Set motor")
.appendField(new Blockly.FieldNumber(1, 0, 2, 1), "MOTOR_INDEX");
.appendField(new Blockly.FieldNumber(1, 0, 1, 1), "MOTOR_INDEX");
this.appendValueInput("MOTOR_PERCENT")
.setCheck("Number")
.appendField("to");
Expand Down Expand Up @@ -148,7 +148,7 @@ function loadMovementBlocks(Blockly) {
init: function() {
this.appendDummyInput()
.appendField("Set servo")
.appendField(new Blockly.FieldNumber(1, 0, 4, 1), "SERVO_INDEX");
.appendField(new Blockly.FieldNumber(1, 0, 3, 1), "SERVO_INDEX");
this.appendValueInput("SERVO_POSITION")
.setCheck("Number")
.appendField("to the");
Expand Down Expand Up @@ -258,7 +258,7 @@ function loadGPIOBlocks(Blockly) {
init: function() {
this.appendDummyInput()
.appendField("Set the mode of GPIO")
.appendField(new Blockly.FieldNumber(1, 0, 4, 1), "GPIO_INDEX")
.appendField(new Blockly.FieldNumber(1, 0, 3, 1), "GPIO_INDEX")
.appendField("to")
.appendField(
new Blockly.FieldDropdown([
Expand Down Expand Up @@ -436,6 +436,19 @@ function loadVisionBlocks(Blockly) {
}
};

Blockly.Blocks["vision_marker_target_type"] = {
init: function() {
this.appendValueInput("MARKER")
.setCheck("Marker")
.appendField("Marker target type of");
this.setInputsInline(false);
this.setOutput(true, "MarkerTargetType");
this.setColour(markerTeamHue);
this.setTooltip("");
this.setHelpUrl("");
}
};

Blockly.Python["vision_see"] = function(block) {
const code = `R.see()`;
return [code, Blockly.Python.ORDER_NONE];
Expand Down Expand Up @@ -485,6 +498,16 @@ function loadVisionBlocks(Blockly) {
const code = `${value_marker}.info.owning_team`;
return [code, Blockly.Python.ORDER_NONE];
};

Blockly.Python["vision_marker_target_type"] = function(block) {
const value_marker = Blockly.Python.valueToCode(
block,
"MARKER",
Blockly.Python.ORDER_ATOMIC
);
const code = `${value_marker}.info.target_type`;
return [code, Blockly.Python.ORDER_NONE];
};
}

function loadMarkerBlocks(Blockly) {
Expand All @@ -500,92 +523,131 @@ function loadMarkerBlocks(Blockly) {
}
};

Blockly.Blocks["vision_marker_type_potato"] = {
Blockly.Blocks["vision_marker_type_target"] = {
init: function() {
this.appendDummyInput().appendField("Potato");
this.appendDummyInput().appendField("Target");
this.setOutput(true, "MarkerType");
this.setColour(markerTypeHue);
this.setTooltip("");
this.setHelpUrl("");
}
};

Blockly.Blocks["vision_marker_team_hot_potato"] = {
Blockly.Blocks["vision_marker_team_sheep"] = {
init: function() {
this.appendDummyInput().appendField("Hot Potato");
this.appendDummyInput().appendField("Sheep");
this.setOutput(true, "MarkerTeam");
this.setColour(markerTeamHue);
this.setTooltip("");
this.setHelpUrl("");
}
};

Blockly.Blocks["vision_marker_team_russet"] = {
Blockly.Blocks["vision_marker_team_ruby"] = {
init: function() {
this.appendDummyInput().appendField("Russet");
this.appendDummyInput().appendField("Ruby");
this.setOutput(true, "MarkerTeam");
this.setColour(markerTeamHue);
this.setTooltip("");
this.setHelpUrl("");
}
};
Blockly.Blocks["vision_marker_team_sweet"] = {
Blockly.Blocks["vision_marker_team_jade"] = {
init: function() {
this.appendDummyInput().appendField("Sweet");
this.appendDummyInput().appendField("Jade");
this.setOutput(true, "MarkerTeam");
this.setColour(markerTeamHue);
this.setTooltip("");
this.setHelpUrl("");
}
};
Blockly.Blocks["vision_marker_team_maris_piper"] = {
Blockly.Blocks["vision_marker_team_topaz"] = {
init: function() {
this.appendDummyInput().appendField("Maris Piper");
this.appendDummyInput().appendField("Topaz");
this.setOutput(true, "MarkerTeam");
this.setColour(markerTeamHue);
this.setTooltip("");
this.setHelpUrl("");
}
};
Blockly.Blocks["vision_marker_team_purple"] = {
Blockly.Blocks["vision_marker_team_diamond"] = {
init: function() {
this.appendDummyInput().appendField("Purple");
this.appendDummyInput().appendField("Diamond");
this.setOutput(true, "MarkerTeam");
this.setColour(markerTeamHue);
this.setTooltip("");
this.setHelpUrl("");
}
};
Blockly.Blocks["vision_marker_target_type_sheep"] = {
init: function() {
this.appendDummyInput().appendField("Sheep");
this.setOutput(true, "MarkerTargetType");
this.setColour(markerTeamHue);
this.setTooltip("");
this.setHelpUrl("");
}
};
Blockly.Blocks["vision_marker_target_type_gem"] = {
init: function() {
this.appendDummyInput().appendField("Gem");
this.setOutput(true, "MarkerTargetType");
this.setColour(markerTeamHue);
this.setTooltip("");
this.setHelpUrl("");
}
};
Blockly.Blocks["vision_marker_target_type_lair"] = {
init: function() {
this.appendDummyInput().appendField("Lair");
this.setOutput(true, "MarkerTargetType");
this.setColour(markerTeamHue);
this.setTooltip("");
this.setHelpUrl("");
}
};

Blockly.Python["vision_marker_type_arena"] = function() {
const code = "robot.MARKER_TYPE.ARENA";
const code = "MARKER_TYPE.ARENA";
return [code, Blockly.Python.ORDER_NONE];
};

Blockly.Python["vision_marker_type_potato"] = function() {
const code = "robot.MARKER_TYPE.POTATO";
Blockly.Python["vision_marker_type_target"] = function() {
const code = "MARKER_TYPE.TARGET";
return [code, Blockly.Python.ORDER_NONE];
};

Blockly.Python["vision_marker_team_hot_potato"] = function() {
const code = "robot.TEAM.ARENA";
Blockly.Python["vision_marker_team_sheep"] = function() {
const code = "TEAM.ARENA";
return [code, Blockly.Python.ORDER_NONE];
};

Blockly.Python["vision_marker_team_russet"] = function() {
const code = "robot.TEAM.RUSSET";
Blockly.Python["vision_marker_team_ruby"] = function() {
const code = "TEAM.RUBY";
return [code, Blockly.Python.ORDER_NONE];
};
Blockly.Python["vision_marker_team_jade"] = function() {
const code = "TEAM.JADE";
return [code, Blockly.Python.ORDER_NONE];
};
Blockly.Python["vision_marker_team_topaz"] = function() {
const code = "TEAM.TOPAZ";
return [code, Blockly.Python.ORDER_NONE];
};
Blockly.Python["vision_marker_team_diamond"] = function() {
const code = "TEAM.DIAMOND";
return [code, Blockly.Python.ORDER_NONE];
};
Blockly.Python["vision_marker_team_sweet"] = function() {
const code = "robot.TEAM.SWEET";
Blockly.Python["vision_marker_target_type_sheep"] = function() {
const code = "TARGET_TYPE.SHEEP";
return [code, Blockly.Python.ORDER_NONE];
};
Blockly.Python["vision_marker_team_maris_piper"] = function() {
const code = "robot.TEAM.MARIS_PIPER";
Blockly.Python["vision_marker_target_type_gem"] = function() {
const code = "TARGET_TYPE.GEM";
return [code, Blockly.Python.ORDER_NONE];
};
Blockly.Python["vision_marker_team_purple"] = function() {
const code = "robot.TEAM.PURPLE";
Blockly.Python["vision_marker_target_type_lair"] = function() {
const code = "TARGET_TYPE.LAIR";
return [code, Blockly.Python.ORDER_NONE];
};
}
Expand Down
34 changes: 22 additions & 12 deletions app/components/editor/blockly/toolbox.xml
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@
<sep></sep>
<category name="Movement" colour="#a55b5b">
<block type="motors_set_power">
<field name="MOTOR_INDEX">1</field>
<field name="MOTOR_INDEX">0</field>
<value name="MOTOR_PERCENT">
<shadow type="math_number">
<field name="NUM">20</field>
Expand Down Expand Up @@ -347,7 +347,7 @@
</block>
<block type="motors_reset"></block>
<block type="servo_set_position">
<field name="SERVO_INDEX">1</field>
<field name="SERVO_INDEX">0</field>
<value name="SERVO_POSITION">
<shadow type="math_number">
<field name="NUM">50</field>
Expand All @@ -358,22 +358,22 @@
</category>
<category name="GPIO" colour="#5b80a5">
<block type="gpio_set_mode">
<field name="GPIO_INDEX">1</field>
<field name="GPIO_INDEX">0</field>
<field name="GPIO_MODE">OUTPUT</field>
</block>
<block type="gpio_write_digital">
<field name="GPIO_INDEX">1</field>
<field name="GPIO_INDEX">0</field>
<value name="GPIO_STATE">
<shadow type="logic_boolean">
<field name="BOOL">TRUE</field>
</shadow>
</value>
</block>
<block type="gpio_read_digital">
<field name="GPIO_INDEX">1</field>
<field name="GPIO_INDEX">0</field>
</block>
<block type="gpio_read_analog">
<field name="GPIO_INDEX">1</field>
<field name="GPIO_INDEX">0</field>
</block>
</category>
<category name="Vision" colour="#80a55b">
Expand Down Expand Up @@ -401,7 +401,7 @@
</value>
</block>
<block type="vision_marker_type_arena"></block>
<block type="vision_marker_type_potato"></block>
<block type="vision_marker_type_target"></block>

<block type="controls_forEach">
<field name="VAR" id=";)moF_=/[]v+i@k*^`Aq" variabletype="">i</field>
Expand All @@ -418,10 +418,20 @@
</block>
</value>
</block>
<block type="vision_marker_team_hot_potato"></block>
<block type="vision_marker_team_russet"></block>
<block type="vision_marker_team_sweet"></block>
<block type="vision_marker_team_maris_piper"></block>
<block type="vision_marker_team_purple"></block>
<block type="vision_marker_team_sheep"></block>
<block type="vision_marker_team_ruby"></block>
<block type="vision_marker_team_jade"></block>
<block type="vision_marker_team_topaz"></block>
<block type="vision_marker_team_diamond"></block>
<block type="vision_marker_target_type">
<value name="MARKER">
<block type="variables_get">
<field name="VAR" id=";)moF_=/[]v+i@k*^`Aq" variabletype="">marker</field>
</block>
</value>
</block>
<block type="vision_marker_target_type_gem"></block>
<block type="vision_marker_target_type_sheep"></block>
<block type="vision_marker_target_type_lair"></block>
</category>
</xml>
Binary file removed docs/.vuepress/public/GettingToRoboCon.pdf
Binary file not shown.
Binary file added docs/.vuepress/public/markers.pdf
Binary file not shown.
3 changes: 0 additions & 3 deletions docs/.vuepress/public/markers.zip

This file was deleted.

Binary file added docs/.vuepress/public/roboconRulebook.pdf
Binary file not shown.
8 changes: 4 additions & 4 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ position: 1
---
# Getting Started

Welcome to the docs for **Robocon 2024**!
Welcome to the docs for **Robocon 2025**!

We suggest you first grasp the idea of the [rules](http://robot.local/docs/RoboCon-2024-Rulebook.pdf).
We suggest you first grasp the idea of the [rules](http://robot.local/docs/roboconRulebook.pdf).
:::tip

If you are viewing this page on your BrainBox then please check the website for the latest revision.

:::

![Game logo](/images/roboconHeader.jpg)
![Game logo](/images/logo-with-sponsors.png)
Once you've done that, you'll need to turn your robot on.

To begin, get familiar with the kit provided. It includes : <!--StartFragment-->
Expand Down Expand Up @@ -42,4 +42,4 @@ You can also access these docs from your robot. Go to <http://robot.local/docs>

If you have any questions related to the competition, the brainboxes, or any ideas or struggles you have, feel free to [drop us an email](mailto:[email protected]) - we are happy to help!

<!--END_PI_REMOVE-->
<!--END_PI_REMOVE-->
2 changes: 1 addition & 1 deletion docs/hello-gpio.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ On the side of your BrainBox, there are 4 regular pins and a "+5V" and "-" pin.
GPIO outputs are already protected by a 1k Ohm current limiting resistor, you can connect LEDs directly!
:::

If you want to put an LED on your robot, for testing or just for looks, you'll need to plug the short side of the LED into the `-` (ground) pin, and the long side of the LED into any regular pin (such as 1). Then, use the following code to set up the pin in `OUTPUT` mode and turn the LED on:
If you want to put an LED on your robot, for testing or just for looks, you'll need to plug the short leg of the LED into the `-` (ground) pin, and the long leg of the LED into any regular pin (such as 1). Then, use the following code to set up the pin in `OUTPUT` mode and turn the LED on:

```python
import robot
Expand Down
Binary file added docs/images/logo-with-sponsors.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/roboconHeader.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion docs/markers.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@ position: 7
---
# Markers

You can download a zip of all of the markers [here](/docs/markers.zip).
You can download a pdf of all of the markers [here](/docs/markers.pdf).

- Ruby markers are on pages 1-9
- Arena markers are from page 10 onwards
3 changes: 2 additions & 1 deletion docs/patching-the-robot.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ Your robot will restart as part of the patching process, so you will lose connec
:::

### This patch's passphrase is:
This joke is just pomme de terrible.
Why are dragons good at music?
They know lots of scales
Loading