Commit 6f395352 authored by yuichitamiya's avatar yuichitamiya
Browse files

git rest 2 mp4 file

parent aec9074c
Pipeline #243806 passed with stage
in 39 seconds
......@@ -253,3 +253,4 @@ void KeyRelease() {
<video width="640" controls>
<source src="../../images/make/qt.mp4" type="video/mp4">
</video>
[video](../images/make/qt.mp4)
......@@ -159,12 +159,22 @@ void loop(){
![](../images/make/drone_sch.png){width=600}
![](../images/make/drone_brd.png){width=600}
![](../images/make/drone_top3.png){width=300}
![](../images/make/drone_holes_outline3.png){width=300}
![](../eagle/xiao_drone_controller/drone_top.png){width=300}
![](../eagle/xiao_drone_controller/drone_holes_outline.png){width=300}
Eagle [sch](../eagle/xiao_drone_controller/xiao_drone.sch)|[brd](../eagle/xiao_drone_controller/xiao_drone.brd)
---
## Hardware
![](../images/make/drone_controller.jpg){width=300}
![](../images/make/drone_controller2.jpg){width=300}
![](../images/make/drone_controller3.jpg){width=300}
![](../images/make/drone_controller4.jpg){width=300}
## Program
### Library
[TinyUSB_Mouse_and_Keyboard](https://github.com/cyborg5/TinyUSB_Mouse_and_Keyboard/)
......@@ -182,4 +192,346 @@ Eagle [sch](../eagle/xiao_drone_controller/xiao_drone.sch)|[brd](../eagle/xiao_d
### Arduino sketch
WIP:[download ino](../sketch/xiao_drone_controller/xiao_drone_controller.ino)
[download ino](../sketch/xiao_drone_controller/xiao_drone_controller.ino)
```
#include <TinyUSB_Mouse_and_Keyboard.h>
//IO Expander
#include <Wire.h>
#include <Adafruit_MCP23017.h>
Adafruit_MCP23017 mcp;
//Joystick pins
int horzPin_R = 0; // Analog output of horizontal joystick pin
int vertPin_R = 1;
int horzPin_L = 10; // Analog output of horizontal joystick pin
int vertPin_L = 9;
int vertValue_R, horzValue_R;
int vertValue_L, horzValue_L;
int threshold_small = 300;
int threshold_large = 800;
// Buttons
uint8_t pins[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
uint8_t pincount = sizeof(pins) / sizeof(pins[0]);
uint8_t Key0;
uint8_t Key1;
uint8_t Key2;
uint8_t Key3;
uint8_t Key4;
uint8_t Key5;
uint8_t Key6;
uint8_t Key7;
uint8_t Key8;
uint8_t Key9;
uint8_t Key10;
uint8_t Key11;
uint8_t Key12;
uint8_t Key13;
uint8_t Key14;
uint8_t Key15;
uint8_t KeyXiao2;
uint8_t KeyXiao8;
void setup() {
//keyboard
Keyboard.begin();
Serial.begin(9600);
pinMode(2, INPUT_PULLUP);//joystick button_R
pinMode(8, INPUT_PULLUP);//joystick button_L
/*Expander I2C address
A0 A1 A2 address
0 0 0 0x00
1 0 0 0x01
0 1 0 0x02
1 1 0 0x03
0 0 1 0x04
1 0 1 0x05
0 1 1 0x06
1 1 1 0x07
*/
//IO Expander
mcp.begin();// use default address 0
for (uint8_t i = 0; i < pincount; i++)
{
mcp.pinMode(pins[i], INPUT);// mcp.pinMode(0, INPUT);//A0=0,A7=7,B0=8,B7=15
mcp.pullUp(pins[i], HIGH); // mcp.pullUp(0, HIGH);// turn on a 100K pullup internally
}
pinMode(LED_BUILTIN, OUTPUT); // use the p13 LED as debugging
}
void loop() {
//Xiao joystick
vertValue_R = analogRead(vertPin_R);
horzValue_R = analogRead(horzPin_R);
vertValue_L = analogRead(vertPin_L);
horzValue_L = analogRead(horzPin_L);
//Xiao button
KeyXiao2 = digitalRead(2);//joystick button_R
KeyXiao8 = digitalRead(8);//jopystik button_L
//KeyXiao3 = digitalRead(3);//empty
//KeyXiao6 = digitalRead(6);//empty
//KeyXiao7 = digitalRead(7);//empty
//IO Expander
Key0 = mcp.digitalRead(0);
Key1 = mcp.digitalRead(1);
Key2 = mcp.digitalRead(2);
Key3 = mcp.digitalRead(3);
Key4 = mcp.digitalRead(4);
Key5 = mcp.digitalRead(5);
Key6 = mcp.digitalRead(6);
Key7 = mcp.digitalRead(7);
Key8 = mcp.digitalRead(8);
Key9 = mcp.digitalRead(9);
Key10 = mcp.digitalRead(10);
Key11 = mcp.digitalRead(11);
Key12 = mcp.digitalRead(12);
Key13 = mcp.digitalRead(13);
Key14 = mcp.digitalRead(14);
Key15 = mcp.digitalRead(15);
// Motor ON
if (vertValue_R > threshold_large && horzValue_R < threshold_small &&
vertValue_L < threshold_small && horzValue_L < threshold_small)
{
Serial.println("Motor ON:");
Key8_act();
} else {
// Joystic right
if (horzValue_R < threshold_small) {
Serial.print("<<:"); Serial.println(horzValue_R);
Key0_act();
}
if (horzValue_R > threshold_large) {
Serial.print(">>:"); Serial.println(horzValue_R);
Key1_act();
}
if (vertValue_R < threshold_small / 1.1) {
Serial.print("UP:"); Serial.println(vertValue_R);
Key2_act();
}
if (vertValue_R > threshold_large) {
Serial.print("DN:"); Serial.println(vertValue_R);
Key3_act();
}
//Joystic left
if (horzValue_L < threshold_small) {
Serial.print("D>:"); Serial.println(horzValue_L);
Key4_act();
}
if (horzValue_L > threshold_large) {
Serial.print("<A:"); Serial.println(horzValue_L);
Key5_act();
}
if (vertValue_L < threshold_small) {
Serial.print("Sv:"); Serial.println(vertValue_L);
Key6_act();
}
if (vertValue_L > threshold_large) {
Serial.print("W^:"); Serial.println(vertValue_L);
Key7_act();
}
//IO Extention
if (Key14 == LOW ) {//Pause
Keyboard.write('p');
delay(400);
Keyboard.releaseAll();
KeyRelease();
}
if (Key10 == LOW ) {//Shutter
Keyboard.write('h');
delay(400);
Keyboard.releaseAll();
KeyRelease();
}
if (Key6 == LOW ) {//record/stop
Keyboard.write('l');
delay(400);
Keyboard.releaseAll();
KeyRelease();
}
if (Key8 == LOW ) {//flight route
Keyboard.write(' ');//space
delay(400);
Keyboard.releaseAll();
KeyRelease();
}
if (Key4 == LOW ) {//return home/cancel
Keyboard.write('o');
delay(400);
Keyboard.releaseAll();
KeyRelease();
}
if (Key5 == LOW ) {//jump
Keyboard.write(' ');//space
delay(400);
Keyboard.releaseAll();
KeyRelease();
}
if (Key1 == LOW ) {//custom menu
Keyboard.press(KEY_RETURN);//enter
delay(400);
Keyboard.releaseAll();
KeyRelease();
}
if (Key3 == LOW ) {//Gimbal Upward
Keyboard.write('r');
delay(400);
Keyboard.releaseAll();
KeyRelease();
}
if (Key2 == LOW ) {//Gimbal Down
Keyboard.write('f');
delay(400);
Keyboard.releaseAll();
KeyRelease();
}
if (Key12 == LOW ) {//switch view
Keyboard.write('c');
delay(400);
Keyboard.releaseAll();
KeyRelease();
}
if (Key7 == LOW ) {//flight mode
Keyboard.write('v');
delay(400);
Keyboard.releaseAll();
KeyRelease();
}
if (Key11 == LOW ) {//switch btm drone/pilot
Keyboard.write('j');
delay(400);
Keyboard.releaseAll();
KeyRelease();
}
if (Key9 == LOW ) {//minimap
Keyboard.write('m');
delay(400);
Keyboard.releaseAll();
KeyRelease();
}
if (Key13 == LOW ) {//indroducton panel
Keyboard.write('i');
delay(400);
Keyboard.releaseAll();
KeyRelease();
}
if (Key0 == LOW ) {
// not connected
}
if (Key15 == LOW ) {
// not connected
}
if (KeyXiao2 == LOW ) {//joystick button_R
digitalWrite(LED_BUILTIN, HIGH);
delay(500);
digitalWrite(LED_BUILTIN, LOW);
}
if (KeyXiao8 == LOW ) {//joystick button_L
digitalWrite(LED_BUILTIN, HIGH);
delay(500);
digitalWrite(LED_BUILTIN, LOW);
}
}
}
void Key0_act() {
Keyboard.press(KEY_LEFT_ARROW);
delay(400);
Keyboard.releaseAll();
KeyRelease();
}
void Key1_act() {
Keyboard.press(KEY_RIGHT_ARROW);
delay(400);
Keyboard.releaseAll();
KeyRelease();
}
void Key2_act() {
Keyboard.press(KEY_UP_ARROW);
delay(400);
Keyboard.releaseAll();
KeyRelease();
}
void Key3_act() {
Keyboard.press(KEY_DOWN_ARROW);
delay(400);
Keyboard.releaseAll();
KeyRelease();
}
void Key4_act() {
Keyboard.write('d');
delay(400);
Keyboard.releaseAll();
KeyRelease();
}
void Key5_act() {
Keyboard.write('a');
delay(400);
Keyboard.releaseAll();
KeyRelease();
}
void Key6_act() {
Keyboard.write('s');
delay(400);
Keyboard.releaseAll();
KeyRelease();
}
void Key7_act() {
Keyboard.write('w');
delay(400);
Keyboard.releaseAll();
KeyRelease();
}
void Key8_act() {
Keyboard.press(KEY_LEFT_ARROW);
Keyboard.press(KEY_DOWN_ARROW);
Keyboard.write('d');
Keyboard.write('s');
delay(400);
Keyboard.releaseAll();
KeyRelease();
}
void KeyE0_act() {
Keyboard.write('0');
delay(400);
Keyboard.releaseAll();
KeyRelease();
}
void KeyRelease() {
Keyboard.releaseAll();
delay(500);
}
/*
*/
```
# record_the_way
# record_the_route
## Get Latitude and Longitude
## URLs
### Google map
Location of Fablab Kannai
......@@ -39,15 +39,73 @@ command + c //Copy
command + option + right_arrow //Jump to the previous open tab (spreadsheet)
```
---
## Get Latitude and Longitude
### Google spreadshet
<table>
<table border=1>
<tr>
<th>URL</th> <th>NC</th>
<th>URL</th> <th>NC</th><th>NC2</th><th>NC3</th><th>Latitude</th><th>Longitude</th><th>date</th>
</tr>
<tr>
<td>いちご</td> <td>甘い</td>
<td>PASTE URL HERE</td> <td>=REGEXEXTRACT(A2,"(..+?[@])(..+?[,])(..+?[,)])")</td><th></th><th></th><th>=SUBSTITUTE(C3,",","")</th><th>=SUBSTITUTE(D3,",","")</th><th>2021/06/14</th>
</tr>
<tr>
<td>レモン</td> <td>酸っぱい</td>
<td>https://earth.google.com/web/@35.5579311,139.77034635,4.43443482a,192.03288883d,35y,-33.48331106h,82.62728443t,-0r</td> <td>https://earth.google.com/web/@</td><th>35.5579311,</th><th>139.77034635,</th><th>35.5579311</th><th>139.77034635</th><th>2021/06/14</th>
</tr>
</table>
ref [Regular Expression Extracts](https://support.google.com/docs/answer/3098244?hl=en)
Spreadsheet: [stage3_Vancouver_Calgary(Yamnuska Wolfdog Sanctuary)](https://docs.google.com/spreadsheets/d/1ArvJ9HbsyfCoIlrQIvEssAKA86U2nPpBsOHndgZoNO0/edit?usp=sharing)
[Yamnuska Wolfdog Sanctuary](https://www.yamnuskawolfdogsanctuary.com/)
### Apps Script: macros
```
/** @OnlyCurrentDoc */
function update_data(){
colA_blank_cell();
copy_row();
gettoday();
}
function colA_blank_cell() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sh = ss.getActiveSheet();
var range = sh.getActiveRange();
var last_row = sh.getRange("A:A").getValues().filter(String).length;
sh.getRange((last_row + 1), 1).activate();
}
function copy_row() {
var spreadsheet = SpreadsheetApp.getActive();
var sheet = spreadsheet.getActiveSheet();
sheet.getRange(spreadsheet.getCurrentCell().getRow(), 1, 1, sheet.getMaxColumns()).activate();
sheet = spreadsheet.getActiveSheet();
sheet.getRange(spreadsheet.getCurrentCell().getRow() - 1, 1, 1, sheet.getMaxColumns()).copyTo(spreadsheet. getActiveRange(), SpreadsheetApp.CopyPasteType.PASTE_NORMAL, false);
spreadsheet.getCurrentCell().activate();
//delete copied URL cells
spreadsheet.getActiveRangeList().clear({contentsOnly: true, skipFilteredRows: true});
};
function gettoday() {
var spreadsheet = SpreadsheetApp.getActive();
var date = new Date();
//Logger.log(Utilities.formatDate( date, 'Asia/Tokyo', 'yyyyMMdd: hhmmss'));
var yyyy = date.getFullYear();
var mon = date.getMonth() + 1;
var dd = date.getDate();
var now = yyyy+"/"+mon+"/"+dd;
spreadsheet.getCurrentCell().offset(0, 6).activate();
spreadsheet.getCurrentCell().setValue(now);
// back to col-A
spreadsheet.getCurrentCell().offset(0, -6).activate();
};
```
![](../images/work/manage_macros.png){width=400}
......@@ -40,6 +40,31 @@ Item |Cost |Link
Fitness Bike |19,900JPY|[Amazon](https://www.amazon.co.jp/gp/product/B0836X1V95/ref=ppx_yo_dt_b_asin_title_o07_s00?ie=UTF8&psc=1)
Xiao |5.40USD|[Seeed](https://www.seeedstudio.com/Seeeduino-XIAO-Arduino-Microcontroller-SAMD21-Cortex-M0+-p-4426.html)
---
### Attached
![](../images/work/bike_controler.jpg){width=600}
![](../images/work/bike_mainboard.jpg){width=600}
---
### Video
#### Google Street View
<video width="640" controls>
<source src="../../images/work/bike_streetview.mp4" type="video/mp4">
</video>
[video](../images/work/bike_streetview.mp4)
#### Google Earth
<video width="640" controls>
<source src="../../images/work/bike_googleearth.mp4" type="video/mp4">
</video>
[video](../images/work/bike_googleearth.mp4)
......
......@@ -55,7 +55,7 @@
<layer number="45" name="Holes" color="7" fill="1" visible="no" active="yes"/>
<layer number="46" name="Milling" color="3" fill="1" visible="no" active="yes"/>
<layer number="47" name="Measures" color="7" fill="1" visible="no" active="yes"/>
<layer number="48" name="Document" color="51" fill="1" visible="yes" active="yes"/>
<layer number="48" name="Document" color="51" fill="1" visible="no" active="yes"/>
<layer number="49" name="Reference" color="7" fill="1" visible="no" active="yes"/>
<layer number="51" name="tDocu" color="7" fill="1" visible="yes" active="yes"/>
<layer number="52" name="bDocu" color="7" fill="1" visible="yes" active="yes"/>
......@@ -70,23 +70,23 @@
<layer number="96" name="Values" color="7" fill="1" visible="no" active="no"/>
<layer number="97" name="Info" color="7" fill="1" visible="no" active="no"/>
<layer number="98" name="Guide" color="6" fill="1" visible="no" active="no"/>
<layer number="116" name="centerDrill" color="0" fill="1" visible="yes" active="yes"/>
<layer number="116" name="centerDrill" color="0" fill="1" visible="no" active="yes"/>
</layers>
<board>
<plain>
<wire x1="1.27" y1="1.27" x2="62.21" y2="1.27" width="0" layer="20"/>
<wire x1="62.21" y1="1.27" x2="62.21" y2="36.5" width="0" layer="20"/>
<wire x1="1.27" y1="-1.27" x2="62.21" y2="-1.27" width="0" layer="20"/>
<wire x1="62.21" y1="-1.27" x2="62.21" y2="36.5" width="0" layer="20"/>
<wire x1="62.21" y1="36.5" x2="1.27" y2="36.5" width="0" layer="20"/>
<wire x1="1.27" y1="36.5" x2="1.27" y2="1.27" width="0" layer="20"/>
<wire x1="1.27" y1="36.5" x2="1.27" y2="-1.27" width="0" layer="20"/>
<polygon width="0.4064" layer="48">
<vertex x="5.08" y="2.54"/>
<vertex x="58.42" y="2.54" curve="90"/>
<vertex x="60.96" y="5.08"/>
<vertex x="5.08" y="0"/>
<vertex x="58.42" y="0" curve="90"/>
<vertex x="60.96" y="2.54"/>
<vertex x="60.96" y="33.02" curve="90"/>
<vertex x="58.42" y="35.56"/>
<vertex x="5.08" y="35.56" curve="90"/>
<vertex x="2.54" y="33.02"/>
<vertex x="2.54" y="5.08" curve="90"/>
<vertex x="2.54" y="2.54" curve="90"/>
</polygon>
<hole x="58.42" y="5.08" drill="3.2"/>
<hole x="58.42" y="33.02" drill="3.2"/>
......@@ -106,22 +106,22 @@
<circle x="58.42" y="22.86" radius="0.279" width="0.558" layer="116"/>
<circle x="58.42" y="20.32" radius="0.279" width="0.558" layer="116"/>
<circle x="58.42" y="17.78" radius="0.279" width="0.558" layer="116"/>
<circle x="15.24" y="27.94" radius="0.279" width="0.558" layer="116"/>
<circle x="17.78" y="27.94" radius="0.279" width="0.558" layer="116"/>
<circle x="15.24" y="25.4" radius="0.279" width="0.558" layer="116"/>
<circle x="17.78" y="25.4" radius="0.279" width="0.558" layer="116"/>
<circle x="15.24" y="22.86" radius="0.279" width="0.558" layer="116"/>
<circle x="17.78" y="22.86" radius="0.279" width="0.558" layer="116"/>
<circle x="15.24" y="20.32" radius="0.279" width="0.558" layer="116"/>
<circle x="17.78" y="20.32" radius="0.279" width="0.558" layer="116"/>
<circle x="15.24" y="17.78" radius="0.279" width="0.558" layer="116"/>
<circle x="17.78" y="17.78" radius="0.279" width="0.558" layer="116"/>
<circle x="15.24" y="15.24" radius="0.279" width="0.558" layer="116"/>
<circle x="17.78" y="15.24" radius="0.279" width="0.558" layer="116"/>
<circle x="15.24" y="12.7" radius="0.279" width="0.558" layer="116"/>
<circle x="17.78" y="12.7" radius="0.279" width="0.558" layer="116"/>
<circle x="15.24" y="10.16" radius="0.279" width="0.558" layer="116"/>
<circle x="17.78" y="10.16" radius="0.279" width="0.558" layer="116"/>
<circle x="30.48" y="5.08" radius="0.279" width="0.558" layer="116"/>
<circle x="30.48" y="2.54" radius="0.279" width="0.558" layer="116"/>
<circle x="27.94" y="5.08" radius="0.279" width="0.558" layer="116"/>
<circle x="27.94" y="2.54" radius="0.279" width="0.558" layer="116"/>
<circle x="25.4" y="5.08" radius="0.279" width="0.558" layer="116"/>
<circle x="25.4" y="2.54" radius="0.279" width="0.558" layer="116"/>
<circle x="22.86" y="5.08" radius="0.279" width="0.558" layer="116"/>
<circle x="22.86" y="2.54" radius="0.279" width="0.558" layer="116"/>
<circle x="20.32" y="5.08" radius="0.279" width="0.558" layer="116"/>
<circle x="20.32" y="2.54" radius="0.279" width="0.558" layer="116"/>
<circle x="17.78" y="5.08" radius="0.279" width="0.558" layer="116"/>
<circle x="17.78" y="2.54" radius="0.279" width="0.558" layer="116"/>
<circle x="15.24" y="5.08" radius="0.279" width="0.558" layer="116"/>
<circle x="15.24" y="2.54" radius="0.279" width="0.558" layer="116"/>
<circle x="12.7" y="5.08" radius="0.279" width="0.558" layer="116"/>
<circle x="12.7" y="2.54" radius="0.279" width="0.558" layer="116"/>
<circle x="5.08" y="27.94" radius="0.279" width="0.558" layer="116"/>
<circle x="7.62" y="27.94" radius="0.279" width="0.558" layer="116"/>
<circle x="5.08" y="25.4" radius="0.279" width="0.558" layer="116"/>
......@@ -871,10 +871,10 @@ design rules under a new name.</description>
<attribute name="POPULARITY" value="7" x="11.43" y="21.59" size="1.778" layer="27" rot="R270" display="off"/>
<attribute name="VALUE" x="6.985" y="34.29" size="1.27" layer="27" rot="R270"/>
</element>
<element name="JP2" library="pinhead" package="2X08" package3d_urn="urn:adsk.eagle:package:22481/2" value="" x="16.51" y="19.05" smashed="yes" rot="R270">
<attribute name="NAME" x="19.685" y="29.21" size="1.27" layer="25" ratio="10" rot="R270"/>
<attribute name="POPULARITY" value="6" x="16.51" y="19.05" size="1.778" layer="27" rot="R270" display="off"/>
<attribute name="VALUE" x="12.065" y="29.21" size="1.27" layer="27" rot="R270"/>
<element name="JP2" library="pinhead" package="2X08" package3d_urn="urn:adsk.eagle:package:22481/2" value="" x="21.59" y="3.81" smashed="yes" rot="R180">
<attribute name="NAME" x="36.83" y="5.715" size="1.27" layer="25" ratio="10" rot="R180"/>
<attribute name="POPULARITY" value="6" x="21.59" y="3.81" size="1.778" layer="27" rot="R180" display="off"/>
<attribute name="VALUE" x="31.75" y="8.255" size="1.27" layer="27" rot="R180"/>
</element>
<element name="JP3" library="pinhead" package="2X08" package3d_urn="urn:adsk.eagle:package:22481/2" value="" x="6.35" y="19.05" smashed="yes" rot="R270">
<attribute name="NAME" x="9.525" y="29.21" size="1.27" layer="25" ratio="10" rot="R270"/>
......@@ -919,35 +919,41 @@ design rules under a new name.</description>
<contactref element="JP2" pad="12"/>
<contactref element="JP2" pad="14"/>
<contactref element="JP2" pad="16"/>
<wire x1="5.08" y1="27.94" x2="5.08" y2="25.4" width="0.4064" layer="16"/>
<wire x1="5.08" y1="25.4" x2="5.08" y2="22.86" width="0.4064" layer="16"/>
<wire x1="5.08" y1="22.86" x2="5.08" y2="20.32" width="0.4064" layer="16"/>
<wire x1="5.08" y1="20.32" x2="5.08" y2="17.78" width="0.4064" layer="16"/>
<wire x1="5.08" y1="17.78" x2="5.08" y2="15.24" width="0.4064" layer="16"/>
<wire x1="5.08" y1="15.24" x2="5.08" y2="12.7" width="0.4064" layer="16"/>
<wire x1="4.953" y1="27.94" x2="5.08" y2="27.94" width="0.4064" layer="16"/>
<wire x1="10.16" y1="34.925" x2="26.67" y2="34.925" width="0.4064" layer="16"/>
<wire x1="17.78" y1="27.94" x2="17.78" y2="25.4" width="0.4064" layer="16"/>
<wire x1="17.78" y1="25.4" x2="17.78" y2="22.86" width="0.4064" layer="16"/>
<wire x1="17.78" y1="22.86" x2="17.78" y2="20.32" width="0.4064" layer="16"/>
<wire x1="17.78" y1="20.32" x2="17.78" y2="17.78" width="0.4064" layer="16"/>
<wire x1="17.78" y1="17.78" x2="17.78" y2="15.24" width="0.4064" layer="16"/>