Code Monkey home page Code Monkey logo

roverpylot's Introduction

RoverPylot

Pilot the Brookstone Rover 2.0 and Rover Revolution from Python

Instructions

This repository contains a Python API and demo program allowing you to control the Brookstone Rover 2.0 spy tank and Rover Revolution spy vehicle from your laptop or PC. To get started, you should get hold of a Rover 2.0 or Revolution (of course) and a Playstation PS3 controller or clone, and install the repository (sudo python setup.py install for Linux users), as well as PyGame and either OpenCV for Python (Rover 2.0) or ffmpeg (Rover Revolution). Join the Rover's ad-hoc wifi network from your computer. Then run either the ps3rover20.py or ps3revolution.py script from the repository. This script will allow you to drive the Rover around and watch its streaming video, as shown here. I have run this script successfully on Linux (Ubuntu), but I can't vouch for what happens on Windows or OS X, on which Python packages become much trickier. Remember, the Rover 20 is a tank, so you control it by moving the left and right sticks back and forth. If you used an inexpensive clone of the P3 controller you may have to do some adjusting of the axis and button settings at the top of the script to make it work.

Once you're up and running with the ps3rover.py or ps3revolution.py script, look at its source code (and run pydoc on rover.py) to see how RoverPylot works and how you can modify it to do other interesting things. This blog post explains how I hacked the Rover 2.0, and this blog post shows a clever application using Skype.

Known issues

  1. The ps3rover20.py script will report a harmless error about extraneous bytes in the JPEG image.

  2. The ps3revolution.py script will often show a blurred/smudged image. This happens because, whereas the Rover 2.0 sends JPEG images, the Revolution sends H.264 video. I couldn't find a Python package for decoding and displaying H.264 on the fly, so I wrote little workaround that saves the video to a temporary file, which from which the script then reads. You can tweak the performance of this setup by playing with the FRAMERATE and DELAY_SEC parameters at the top of the script.

Tips for Windows

Rob Crawley has put a lot of work into getting RoverPylot to work smoothly on Windows 10. Here are his changes:

  1. Original:

    # Create a named temporary file for video stream
    tmpfile = tempfile.NamedTemporaryFile()


    Changed to:
    tmpfile = tempfile.NamedTemporaryFile(mode='w+b', bufsize=0 , suffix='.avi', prefix='RoverRev', dir='\Python27\RoverRev_WinPylot', delete=False)

  2. Original:
    # Wait a few seconds, then being playing the tmp video file
    cmd = 'ffplay -window_title Rover_Revolution -framerate %d %s' % (FRAMERATE, tmpfile.name)


    Changed to:
    cmd = '/Python27/ffmpeg/bin/ffplay.exe -x 640 -y 480 -window_title Rover_Revolution -framerate %d %s' % (FRAMERATE, tmpfile.name)

Your files paths may be different than those listed below, so make your changes accordingly

Copyright and licensing

Copyright and licensing information can be found in the header of each source file. Please contact me with any questions or suggestions.

roverpylot's People

Contributors

simondlevy avatar

Watchers

 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.