Giter Site home page Giter Site logo

windfisch / libcopter Goto Github PK

View Code? Open in Web Editor NEW
5.0 3.0 1.0 110 KB

A C++ and Python library for completely controlling cheap chinese camera copters

Home Page: https://windfis.ch/libcopter/libcopter.html

Python 31.91% CMake 3.53% Makefile 0.17% C++ 63.77% Shell 0.63%
quadcopter uav camera drone opencv ros low-cost

libcopter's Introduction

libcopter, or rather libSG500 for now

This library supports various similar cheap chinese copters that are controlled via WiFi and have a camera on board. Currently, the SG500 and the JJRC blue crab drones are supported.

It is written in C++, and Python 3 bindings are available. Also, a ROS node is available for utilizing these drones with the Robot Operating System.

The goal of this library is to support controlling the drone as well as retrieving telemetry information and the video stream for further use in the OpenCV library.

Example

For a C++ example, see here.

Below is an untested python example:

#!/usr/bin/python3

import libcopter
import cv2 # opencv

copter = libcopter.SG500()
copter.initialize()

# If your drone is new, you need to calibrate it first.
# copter.recalibrate()

copter.takeoff()
while True:
	copter.command(0.5,0,0,0)  # go right
	imgs, _ = copter.poll_data()
	if len(imgs) > 0:
		cv2.imshow("img", imgs[-1].frame)
copter.land()

Miscellaneous

Currently, I'm still reverse engineering the drone. Most I've already figured out, but there is still some way to go. Find my reverse engineering attempts here.

There's a python script that can generate steering packets and can successfully take-off and land the copter.

Also, there's a video stream parser written in C++ that splits the stream into telemetry data and a video stream and parses both.

Troubleshooting

My (new) drone keeps flying upwards until it hits the ceiling and is uncontrollable. This is not a libcopter problem. You have to recalibrate() your drone first. The calibration data seems to persist over drone reboots.

libcopter's People

Contributors

windfisch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

cody82

libcopter's Issues

test failure behaviour

test behaviour on

  • WiFi association loss
  • TCP connection loss
  • no UDP packages for some time

Does not compile

On Ubuntu 19.04:

/usr/bin/ld: CMakeFiles/demo.dir/main.cpp.o: in function `boost::system::error_code::error_code()':
main.cpp:(.text._ZN5boost6system10error_codeC2Ev[_ZN5boost6system10error_codeC5Ev]+0x17): undefined reference to `boost::system::system_category()'
/usr/bin/ld: CMakeFiles/demo.dir/main.cpp.o: in function `boost::system::error_category::std_category::equivalent(int, std::error_condition const&) const':
main.cpp:(.text._ZNK5boost6system14error_category12std_category10equivalentEiRKSt15error_condition[_ZNK5boost6system14error_category12std_category10equivalentEiRKSt15error_condition]+0xb9): undefined reference to `boost::system::generic_category()'
/usr/bin/ld: main.cpp:(.text._ZNK5boost6system14error_category12std_category10equivalentEiRKSt15error_condition[_ZNK5boost6system14error_category12std_category10equivalentEiRKSt15error_condition]+0xf4): undefined reference to `boost::system::generic_category()'
/usr/bin/ld: CMakeFiles/demo.dir/main.cpp.o: in function `boost::system::error_category::std_category::equivalent(std::error_code const&, int) const':
main.cpp:(.text._ZNK5boost6system14error_category12std_category10equivalentERKSt10error_codei[_ZNK5boost6system14error_category12std_category10equivalentERKSt10error_codei]+0xb9): undefined reference to `boost::system::generic_category()'
/usr/bin/ld: main.cpp:(.text._ZNK5boost6system14error_category12std_category10equivalentERKSt10error_codei[_ZNK5boost6system14error_category12std_category10equivalentERKSt10error_codei]+0xf4): undefined reference to `boost::system::generic_category()'
/usr/bin/ld: main.cpp:(.text._ZNK5boost6system14error_category12std_category10equivalentERKSt10error_codei[_ZNK5boost6system14error_category12std_category10equivalentERKSt10error_codei]+0x1d5): undefined reference to `boost::system::generic_category()'
/usr/bin/ld: CMakeFiles/demo.dir/main.cpp.o: in function `boost::asio::error::get_system_category()':
main.cpp:(.text._ZN5boost4asio5error19get_system_categoryEv[_ZN5boost4asio5error19get_system_categoryEv]+0x5): undefined reference to `boost::system::system_category()'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/demo.dir/build.make:88: demo] Error 1
make[1]: *** [CMakeFiles/Makefile2:73: CMakeFiles/demo.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
`

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.