mirror of
https://github.com/CopterExpress/clover.git
synced 2026-05-26 11:43:25 +00:00
492 lines
16 KiB
HTML
492 lines
16 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<title>Clover Blocks</title>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
|
<link rel="stylesheet" href="main.css">
|
|
<link rel="icon" href="data:,">
|
|
<link rel="stylesheet" href="highlight/styles/monokai-sublime.css">
|
|
<script src="highlight/highlight.pack.js"></script>
|
|
<script src="roslib.js"></script>
|
|
<script src="blockly/blockly_compressed.js"></script>
|
|
<script src="blockly/python_compressed.js"></script>
|
|
<script src="blockly/blocks_compressed.js"></script>
|
|
<script src="blockly/msg/js/en.js"></script>
|
|
<script type="module" src="main.js"></script>
|
|
</head>
|
|
|
|
<body data-tab="blocks">
|
|
<ul id="tabs">
|
|
<li class="selected" data-tab="blocks">Blocks</li>
|
|
<li data-tab="python">Python</li>
|
|
</ul>
|
|
|
|
<div id="tools">
|
|
<div class="disconnected">Disconnected</div>
|
|
<div class="backend-fail">Failed to contact with <code>clover_blocks</code> node, see <a href="../clover/docs/en/blocks.html#configuration" target="_blank">configuration</a> documentation.</div>
|
|
<div id="running">Running...</div>
|
|
<select id="program-name" title="Files are saved in <package_path>/programs/.">
|
|
<option value="" disabled selected><Unsaved></option>
|
|
<option value="@clear">Clear...</option>
|
|
<option style="font-style: italic;" value="@save">Save... (Ctrl+S)</option>
|
|
<optgroup label="User" data-type="user"></optgroup>
|
|
<optgroup label="Examples" data-type="example"></optgroup>
|
|
</select>
|
|
<button onclick="runProgram()" disabled id="run" disabled title="Run the program">Run</button>
|
|
<button onclick="stopProgram()" title="Stop the program">Stop</button>
|
|
<button onclick="land()" title="Stop the program and land">Land</button>
|
|
</div>
|
|
|
|
<div id="notifications"></div>
|
|
|
|
<div id="blockly" class="content"></div>
|
|
<pre id="python" class="content" contenteditable oncut="return false" onpaste="return false" onkeydown="if(!event.metaKey) return false" spellcheck="false"></pre>
|
|
|
|
<xml xmlns="https://developers.google.com/blockly/xml" id="toolbox" style="display: none">
|
|
<category name="Flight" colour="#870b99">
|
|
<block type="take_off">
|
|
<value name="ALT"><shadow type="math_number"><field name="NUM">1</field></shadow></value>
|
|
</block>
|
|
<block type="navigate">
|
|
<value name="X"><shadow type="math_number"><field name="NUM">0</field></shadow></value>
|
|
<value name="Y"><shadow type="math_number"><field name="NUM">0</field></shadow></value>
|
|
<value name="Z"><shadow type="math_number"><field name="NUM">0</field></shadow></value>
|
|
<value name="LAT"><shadow type="math_number"><field name="NUM">47.397503</field></shadow></value>
|
|
<value name="LON"><shadow type="math_number"><field name="NUM">8.544945</field></shadow></value>
|
|
<value name="SPEED"><shadow type="math_number"><field name="NUM">0.5</field></shadow></value>
|
|
<value name="ID"><shadow type="math_number"><field name="NUM">0</field></shadow></value>
|
|
</block>
|
|
<block type="land"></block>
|
|
<block type="set_yaw">
|
|
<value name="YAW"><shadow type="angle"></shadow></value>
|
|
</block>
|
|
<block type="wait">
|
|
<value name="TIME"><shadow type="math_number"><field name="NUM">3</field></shadow></value>
|
|
</block>
|
|
<block type="wait_arrival"></block>
|
|
<block type="setpoint">
|
|
<value name="VX"><shadow type="math_number"><field name="NUM">0</field></shadow></value>
|
|
<value name="VY"><shadow type="math_number"><field name="NUM">0</field></shadow></value>
|
|
<value name="VZ"><shadow type="math_number"><field name="NUM">0</field></shadow></value>
|
|
<value name="PITCH"><shadow type="math_number"><field name="NUM">0</field></shadow></value>
|
|
<value name="ROLL"><shadow type="math_number"><field name="NUM">0</field></shadow></value>
|
|
<value name="YAW"><shadow type="math_number"><field name="NUM">0</field></shadow></value>
|
|
<value name="THRUST"><shadow type="math_number"><field name="NUM">0.5</field></shadow></value>
|
|
<value name="ID"><shadow type="math_number"><field name="NUM">0</field></shadow></value>
|
|
</block>
|
|
<!-- <block type="key_pressed"></block> -->
|
|
</category>
|
|
<category name="State" colour="#ff9a00">
|
|
<block type="get_position">
|
|
<field name="FRAME_ID">ARUCO_MAP</field>
|
|
<value name="ID"><shadow type="math_number"><field name="NUM">0</field></shadow></value>
|
|
</block>
|
|
<block type="get_yaw">
|
|
<field name="FRAME_ID">ARUCO_MAP</field>
|
|
<value name="ID"><shadow type="math_number"><field name="NUM">0</field></shadow></value>
|
|
</block>
|
|
<block type="get_attitude"></block>
|
|
<block type="global_position"></block>
|
|
<block type="distance">
|
|
<value name="X"><shadow type="math_number"><field name="NUM">0</field></shadow></value>
|
|
<value name="Y"><shadow type="math_number"><field name="NUM">0</field></shadow></value>
|
|
<value name="Z"><shadow type="math_number"><field name="NUM">0</field></shadow></value>
|
|
<value name="ID"><shadow type="math_number"><field name="NUM">0</field></shadow></value>
|
|
</block>
|
|
<block type="get_time"></block>
|
|
<block type="arrived"></block>
|
|
<block type="rangefinder_distance"></block>
|
|
<block type="mode"></block>
|
|
<block type="armed"></block>
|
|
<block type="voltage"></block>
|
|
</category>
|
|
<category name="LED" colour="#02d754">
|
|
<block type="set_effect">
|
|
<value name="COLOR"><shadow type="colour_picker"></shadow></value>
|
|
</block>
|
|
<block type="set_led">
|
|
<value name="INDEX"><shadow type="math_number"><field name="NUM">0</field></shadow></value>
|
|
<value name="COLOR"><shadow type="colour_picker"></shadow></value>
|
|
</block>
|
|
<block type="led_count"></block>
|
|
</category>
|
|
<category name="GPIO" colour="#5b97cc">
|
|
<block type="gpio_read">
|
|
<value name="PIN"><shadow type="math_number"><field name="NUM">1</field></shadow></value>
|
|
</block>
|
|
<block type="gpio_write">
|
|
<value name="PIN"><shadow type="math_number"><field name="NUM">1</field></shadow></value>
|
|
<value name="LEVEL"><shadow type="logic_boolean"></shadow></value>
|
|
</block>
|
|
<block type="set_servo">
|
|
<value name="PIN"><shadow type="math_number"><field name="NUM">1</field></shadow></value>
|
|
<value name="PWM"><shadow type="math_number"><field name="NUM">1500</field></shadow></value>
|
|
</block>
|
|
<block type="set_duty_cycle">
|
|
<value name="PIN"><shadow type="math_number"><field name="NUM">1</field></shadow></value>
|
|
<value name="DUTY_CYCLE"><shadow type="math_number"><field name="NUM">0.5</field></shadow></value>
|
|
</block>
|
|
</category>
|
|
<sep></sep>
|
|
<category name="Logic" colour="#5b80a5">
|
|
<block type="controls_if"></block>
|
|
<block type="logic_compare">
|
|
<field name="OP">EQ</field>
|
|
</block>
|
|
<block type="logic_operation">
|
|
<field name="OP">AND</field>
|
|
</block>
|
|
<block type="logic_negate"></block>
|
|
<block type="logic_boolean">
|
|
<field name="BOOL">TRUE</field>
|
|
</block>
|
|
<block type="logic_null"></block>
|
|
<block type="logic_ternary"></block>
|
|
</category>
|
|
<category name="Loops" colour="#5ba55b">
|
|
<block type="controls_repeat_ext">
|
|
<value name="TIMES">
|
|
<shadow type="math_number">
|
|
<field name="NUM">10</field>
|
|
</shadow>
|
|
</value>
|
|
</block>
|
|
<block type="controls_whileUntil">
|
|
<field name="MODE">WHILE</field>
|
|
</block>
|
|
<block type="controls_for">
|
|
<field name="VAR" id="SMJ.7:a)p9(!mF0x)WK~">i</field>
|
|
<value name="FROM">
|
|
<shadow type="math_number">
|
|
<field name="NUM">1</field>
|
|
</shadow>
|
|
</value>
|
|
<value name="TO">
|
|
<shadow type="math_number">
|
|
<field name="NUM">10</field>
|
|
</shadow>
|
|
</value>
|
|
<value name="BY">
|
|
<shadow type="math_number">
|
|
<field name="NUM">1</field>
|
|
</shadow>
|
|
</value>
|
|
</block>
|
|
<block type="controls_forEach">
|
|
<field name="VAR" id="#hg!+5qncbZDpf;c6Qiw">j</field>
|
|
</block>
|
|
<block type="controls_flow_statements">
|
|
<field name="FLOW">BREAK</field>
|
|
</block>
|
|
</category>
|
|
<category name="Math" colour="#5b67a5">
|
|
<block type="math_number">
|
|
<field name="NUM">0</field>
|
|
</block>
|
|
<block type="math_arithmetic">
|
|
<field name="OP">ADD</field>
|
|
<value name="A">
|
|
<shadow type="math_number">
|
|
<field name="NUM">1</field>
|
|
</shadow>
|
|
</value>
|
|
<value name="B">
|
|
<shadow type="math_number">
|
|
<field name="NUM">1</field>
|
|
</shadow>
|
|
</value>
|
|
</block>
|
|
<block type="math_single">
|
|
<field name="OP">ROOT</field>
|
|
<value name="NUM">
|
|
<shadow type="math_number">
|
|
<field name="NUM">9</field>
|
|
</shadow>
|
|
</value>
|
|
</block>
|
|
<block type="math_trig">
|
|
<field name="OP">SIN</field>
|
|
<value name="NUM">
|
|
<shadow type="math_number">
|
|
<field name="NUM">45</field>
|
|
</shadow>
|
|
</value>
|
|
</block>
|
|
<block type="math_constant">
|
|
<field name="CONSTANT">PI</field>
|
|
</block>
|
|
<block type="math_number_property">
|
|
<mutation divisor_input="false"></mutation>
|
|
<field name="PROPERTY">EVEN</field>
|
|
<value name="NUMBER_TO_CHECK">
|
|
<shadow type="math_number">
|
|
<field name="NUM">0</field>
|
|
</shadow>
|
|
</value>
|
|
</block>
|
|
<block type="math_round">
|
|
<field name="OP">ROUND</field>
|
|
<value name="NUM">
|
|
<shadow type="math_number">
|
|
<field name="NUM">3.1</field>
|
|
</shadow>
|
|
</value>
|
|
</block>
|
|
<block type="math_on_list">
|
|
<mutation op="SUM"></mutation>
|
|
<field name="OP">SUM</field>
|
|
</block>
|
|
<block type="math_modulo">
|
|
<value name="DIVIDEND">
|
|
<shadow type="math_number">
|
|
<field name="NUM">64</field>
|
|
</shadow>
|
|
</value>
|
|
<value name="DIVISOR">
|
|
<shadow type="math_number">
|
|
<field name="NUM">10</field>
|
|
</shadow>
|
|
</value>
|
|
</block>
|
|
<block type="math_constrain">
|
|
<value name="VALUE">
|
|
<shadow type="math_number">
|
|
<field name="NUM">50</field>
|
|
</shadow>
|
|
</value>
|
|
<value name="LOW">
|
|
<shadow type="math_number">
|
|
<field name="NUM">1</field>
|
|
</shadow>
|
|
</value>
|
|
<value name="HIGH">
|
|
<shadow type="math_number">
|
|
<field name="NUM">100</field>
|
|
</shadow>
|
|
</value>
|
|
</block>
|
|
<block type="math_random_int">
|
|
<value name="FROM">
|
|
<shadow type="math_number">
|
|
<field name="NUM">1</field>
|
|
</shadow>
|
|
</value>
|
|
<value name="TO">
|
|
<shadow type="math_number">
|
|
<field name="NUM">100</field>
|
|
</shadow>
|
|
</value>
|
|
</block>
|
|
<block type="math_random_float"></block>
|
|
</category>
|
|
<category name="Text" colour="#5ba58c">
|
|
<block type="text">
|
|
<field name="TEXT"></field>
|
|
</block>
|
|
<block type="text_join">
|
|
<mutation items="2"></mutation>
|
|
</block>
|
|
<block type="text_append">
|
|
<field name="VAR" id="SmwB.@#2p5}McHySTA:V">item</field>
|
|
<value name="TEXT">
|
|
<shadow type="text">
|
|
<field name="TEXT"></field>
|
|
</shadow>
|
|
</value>
|
|
</block>
|
|
<block type="text_length">
|
|
<value name="VALUE">
|
|
<shadow type="text">
|
|
<field name="TEXT">abc</field>
|
|
</shadow>
|
|
</value>
|
|
</block>
|
|
<block type="text_isEmpty">
|
|
<value name="VALUE">
|
|
<shadow type="text">
|
|
<field name="TEXT"></field>
|
|
</shadow>
|
|
</value>
|
|
</block>
|
|
<block type="text_indexOf">
|
|
<field name="END">FIRST</field>
|
|
<value name="VALUE">
|
|
<block type="variables_get">
|
|
<field name="VAR" id="C^Ay41*aH0(G-jwM$x4w">text</field>
|
|
</block>
|
|
</value>
|
|
<value name="FIND">
|
|
<shadow type="text">
|
|
<field name="TEXT">abc</field>
|
|
</shadow>
|
|
</value>
|
|
</block>
|
|
<block type="text_charAt">
|
|
<mutation at="true"></mutation>
|
|
<field name="WHERE">FROM_START</field>
|
|
<value name="VALUE">
|
|
<block type="variables_get">
|
|
<field name="VAR" id="C^Ay41*aH0(G-jwM$x4w">text</field>
|
|
</block>
|
|
</value>
|
|
</block>
|
|
<block type="text_getSubstring">
|
|
<mutation at1="true" at2="true"></mutation>
|
|
<field name="WHERE1">FROM_START</field>
|
|
<field name="WHERE2">FROM_START</field>
|
|
<value name="STRING">
|
|
<block type="variables_get">
|
|
<field name="VAR" id="C^Ay41*aH0(G-jwM$x4w">text</field>
|
|
</block>
|
|
</value>
|
|
</block>
|
|
<block type="text_changeCase">
|
|
<field name="CASE">UPPERCASE</field>
|
|
<value name="TEXT">
|
|
<shadow type="text">
|
|
<field name="TEXT">abc</field>
|
|
</shadow>
|
|
</value>
|
|
</block>
|
|
<block type="text_trim">
|
|
<field name="MODE">BOTH</field>
|
|
<value name="TEXT">
|
|
<shadow type="text">
|
|
<field name="TEXT">abc</field>
|
|
</shadow>
|
|
</value>
|
|
</block>
|
|
<block type="text_print">
|
|
<value name="TEXT">
|
|
<shadow type="text">
|
|
<field name="TEXT">abc</field>
|
|
</shadow>
|
|
</value>
|
|
</block>
|
|
<block type="text_prompt_ext">
|
|
<mutation type="TEXT"></mutation>
|
|
<field name="TYPE">TEXT</field>
|
|
<value name="TEXT">
|
|
<shadow type="text">
|
|
<field name="TEXT">abc</field>
|
|
</shadow>
|
|
</value>
|
|
</block>
|
|
</category>
|
|
<category name="Lists" colour="#745ba5">
|
|
<block type="lists_create_with">
|
|
<mutation items="0"></mutation>
|
|
</block>
|
|
<block type="lists_create_with">
|
|
<mutation items="3"></mutation>
|
|
</block>
|
|
<block type="lists_repeat">
|
|
<value name="NUM">
|
|
<shadow type="math_number">
|
|
<field name="NUM">5</field>
|
|
</shadow>
|
|
</value>
|
|
</block>
|
|
<block type="lists_length"></block>
|
|
<block type="lists_isEmpty"></block>
|
|
<block type="lists_indexOf">
|
|
<field name="END">FIRST</field>
|
|
<value name="VALUE">
|
|
<block type="variables_get">
|
|
<field name="VAR" id="+/w.~s(u:tRiXNBG5eR#">list</field>
|
|
</block>
|
|
</value>
|
|
</block>
|
|
<block type="lists_getIndex">
|
|
<mutation statement="false" at="true"></mutation>
|
|
<field name="MODE">GET</field>
|
|
<field name="WHERE">FROM_START</field>
|
|
<value name="VALUE">
|
|
<block type="variables_get">
|
|
<field name="VAR" id="+/w.~s(u:tRiXNBG5eR#">list</field>
|
|
</block>
|
|
</value>
|
|
</block>
|
|
<block type="lists_setIndex">
|
|
<mutation at="true"></mutation>
|
|
<field name="MODE">SET</field>
|
|
<field name="WHERE">FROM_START</field>
|
|
<value name="LIST">
|
|
<block type="variables_get">
|
|
<field name="VAR" id="+/w.~s(u:tRiXNBG5eR#">list</field>
|
|
</block>
|
|
</value>
|
|
</block>
|
|
<block type="lists_getSublist">
|
|
<mutation at1="true" at2="true"></mutation>
|
|
<field name="WHERE1">FROM_START</field>
|
|
<field name="WHERE2">FROM_START</field>
|
|
<value name="LIST">
|
|
<block type="variables_get">
|
|
<field name="VAR" id="+/w.~s(u:tRiXNBG5eR#">list</field>
|
|
</block>
|
|
</value>
|
|
</block>
|
|
<block type="lists_split">
|
|
<mutation mode="SPLIT"></mutation>
|
|
<field name="MODE">SPLIT</field>
|
|
<value name="DELIM">
|
|
<shadow type="text">
|
|
<field name="TEXT">,</field>
|
|
</shadow>
|
|
</value>
|
|
</block>
|
|
<block type="lists_sort">
|
|
<field name="TYPE">NUMERIC</field>
|
|
<field name="DIRECTION">1</field>
|
|
</block>
|
|
</category>
|
|
<category name="Colour" colour="#a5745b">
|
|
<block type="colour_picker">
|
|
<field name="COLOUR">#ff0000</field>
|
|
</block>
|
|
<block type="colour_random"></block>
|
|
<block type="colour_rgb">
|
|
<value name="RED">
|
|
<shadow type="math_number">
|
|
<field name="NUM">100</field>
|
|
</shadow>
|
|
</value>
|
|
<value name="GREEN">
|
|
<shadow type="math_number">
|
|
<field name="NUM">50</field>
|
|
</shadow>
|
|
</value>
|
|
<value name="BLUE">
|
|
<shadow type="math_number">
|
|
<field name="NUM">0</field>
|
|
</shadow>
|
|
</value>
|
|
</block>
|
|
<block type="colour_blend">
|
|
<value name="COLOUR1">
|
|
<shadow type="colour_picker">
|
|
<field name="COLOUR">#ff0000</field>
|
|
</shadow>
|
|
</value>
|
|
<value name="COLOUR2">
|
|
<shadow type="colour_picker">
|
|
<field name="COLOUR">#3333ff</field>
|
|
</shadow>
|
|
</value>
|
|
<value name="RATIO">
|
|
<shadow type="math_number">
|
|
<field name="NUM">0.5</field>
|
|
</shadow>
|
|
</value>
|
|
</block>
|
|
</category>
|
|
<sep></sep>
|
|
<category name="Variables" colour="#a55b80" custom="VARIABLE"></category>
|
|
<category name="Functions" colour="#995ba5" custom="PROCEDURE"></category>
|
|
</xml>
|
|
</body>
|
|
|
|
</html>
|