Upgrade to Pro — share decks privately, control downloads, hide ads and more …

HoloLensでドローンを遠隔操作してみた

gaomar
December 07, 2017

 HoloLensでドローンを遠隔操作してみた

HoloLensでドローンを遠隔操作してみた

gaomar

December 07, 2017
Tweet

More Decks by gaomar

Other Decks in Technology

Transcript

  1. υϩʔϯίϚϯυྫ // ཭཮ drone.takeOff(); // ண཮ drone.land(); // ্ঢ ※stepsͷ஋͸޷͖ʹม͍͑ͯͩ͘͞ɻ਺ࣈ

    ͕ଟ͍ͱ୔ࢁҠಈ͠·͢ drone.up( {steps: 10}); // Լ߱ drone.down( {steps: 10} ); // ӈટճ drone.clockwise( {steps: 10} ); // ࠨટճ drone.counterClockwise( {steps: 10} ); // ӈҠಈ drone.right( {steps: 10} ); // ࠨҠಈ drone.left( {steps: 10} ); // ஦ฦΓ drone.backFlip();
  2. public class TouchAction : MonoBehaviour, IInputClickHandler { string fb_url =

    “https://xxxxxxxx.firebaseio.com/xxxxxxxxxx/word.json”; public void OnInputClicked(InputClickedEventData eventData) { StartCoroutine(Put(fb_url, “\"཭ண཮\"")); } public IEnumerator Put(string url, string jsonStr) { var request = new UnityWebRequest(); request.url = url; byte[] body = Encoding.UTF8.GetBytes(jsonStr); request.uploadHandler = new UploadHandlerRaw(body); request.downloadHandler = new DownloadHandlerBuffer(); request.SetRequestHeader("Content-Type", "application/json; charset=UTF-8"); request.method = UnityWebRequest.kHttpVerbPUT; yield return request.Send(); if (!request.isNetworkError) { if (request.responseCode == 200) { Debug.Log("success"); Debug.Log(request.downloadHandler.text); } else { Debug.Log("failed"); } } } }
  3. ߋ৽৘ใ͕དྷͨΒରԠͨ͠ίϚϯυΛ࣮ߦ db.ref("/drone").on("value", function(changedSnapshot) { //஋औಘ var value = changedSnapshot.child("word").val(); if

    (value) { if (value.split(" ")[0] == '཭ண཮') { if (!drone.status.flying) { drone.takeOff(); } else { drone.land(); }