Giter Site home page Giter Site logo

quadkit's Introduction

QuadKit

A simple set of interfaces for communicating with your Wi-Fi enabled quadcopter.

QuadKit powers SCARAB, an RC controller for iOS. Read about the making of QuadKit: Building a Quadcopter Controller for iOS and Open-Sourcing the Internals

Carthage compatible

Installation

Add this to your Cartfile:

github "gabrieloc/QuadKit"

Integration

Ensure any project using this framework includes QuadKit.framework and SwiftSocket.framework as embedded binaries.

To connect to your quadcopter, create an instance of QuadClient and call -connect:. Ensure that your device has been connected to the Wi-Fi network created by your quadcopter, before attempting to connect. Once a connection has been established, the client expects to be passed an InputState object via -updateInput:, in response to user interaction.

Example

let client = QuadClient()
let inputState = InputState()
let thrustControl = UIControl()

func connectClient() {
	if let error = client.connect() {
		// Error connecting
	}
	thrustControl.enabled = true
}

func thrustControlTouched(_ thrustControl: UIControl) {
	inputState.thrust = thrustControl.selected ? 1.0 : 0.0
	client.updateInput(with inputState)
}

iOS and macOS samples can be found inside the Examples/ directory.

Contributing

While the format for input data appears to be generic across models (needs to be verified), it's possible that handshake data isn't. For this reason, BindingSupport defines a protocol QuadcopterModel, which individual models can use for providing this data.

Handshake data can be found by running a tool like tcpdump or Wireshark to get a packet trace, and collecting the first few packets your device sends your quadcopter in the software provided by it's manufacturer.

Example

  1. Connect your device via USB and create a RVI: $ rvictl -s (DEVICE UDID)
  2. Ensure the remote interface was created by running: $ ifconfig -l and verifying rvi0 exists
  3. Turn on your quadcopter and join it's Wi-Fi network
  4. In a tool like Wireshark, begin capturing rvi0
  5. Open the software provided by your quadcopter's manufacturer and access the input controls
  6. Stop capturing and find what looks like identification data. It should consistently look the same every time you try to connect the app, and will appear before you begin receiving any form of input or video data
  7. Create a new class in QuadKit representing your quadcopter model, and have it adopt QuadcopterModel
  8. In your class' implementation of -identification, return the data your recorded in the form of byte arrays

Reference

Apple provides step by step instructions for creating using various network debugging tools: Technical Q&A QA1176: Getting a Packet Trace.

For more information on the protocol, refer to Jim Hung's Hubsan X4 H107L Quadcopter Control Protocol Specification, or his excellent reverse engineering series, Reverse Engineering a Hubsan X4 Quadcopter.

quadkit's People

Contributors

gabrieloc avatar

Watchers

Michael jentsch avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.