Code Monkey home page Code Monkey logo

runmyrobot's Introduction

runmyrobot

Open Robot Control Code For Connecting to RunMyRobot.com

RunMyRobot is a site for interacts with other using telepresence robots. User create their own robots and add them to the site. https://runmyrobot.com

Installing robot control and video scripts

The RasPi will need the following things install so it can talk to your motor and talk to the internet.

(1) Install motor HAT software:

(2) Install python serial, gnutls, python-dev, espeak, and python-smbus:

apt-get install python-serial python-dev libgnutls28-dev espeak python-smbus python-pip git

(3) Install socket.io client for python:

pip install socketIO-client

(4) Install alsa-lib

cd /usr/local/src 
wget ftp://ftp.alsa-project.org/pub/lib/alsa-lib-1.0.25.tar.bz2 
tar xjf alsa-lib-1.0.25.tar.bz2
cd /usr/local/src/alsa-lib-1.0.25 
./configure --host=arm-unknown-linux-gnueabi 
make -j4 
sudo make install

(5) Install x264

cd /usr/local/src
git clone git://git.videolan.org/x264
cd x264
./configure --host=arm-unknown-linux-gnueabi --enable-static --disable-opencl
make -j4
sudo make install

(6) Install FFmpeg

cd /usr/local/src
git clone https://github.com/FFmpeg/FFmpeg.git
cd FFmpeg
./configure --arch=armel --target-os=linux --enable-gpl --enable-libx264 --enable-nonfree --enable-gnutls --extra-libs=-ldl
make -j4
sudo make install

Bring you Bot to life: Programs to run on the Raspberry Pi

Start by cloning the runmyrobot repository

cd ~
git clone https://github.com/runmyrobot/runmyrobot
cd runmyrobot

Go to new robot page to create a robot. If you already have one, got to manage robots. There you'll find your Robot ID and Camera ID.

These two scripts need to be running in the background to bring your robot to life: controller.py, send_video.py. Here are instructions about how to start them.

Copy the 'start_robot' Script from runmyrobot/Scripts to the pi home folder

cp ~/runmyrobot/scripts/start_robot ~/

Edit the script so you can adjust some settings for controller.py and send_video.py:

nano ~/start_robot

Edit the YOURROBOTID to your robot ID.

Edit the YOURCAMERAID to your camera ID.

You are getting both IDs when you are creating a new bot on the website.

The second parameter on send_video.py 0 is assuming you have one camera plugged into your Pi and you are using it, which is usually the case.

There are more parameter possible for controller.py:

robot_id

Your Robot ID. Required

--env prod | dev

Environment for example dev or prod | default='prod'

--type motor_hat | serial | l298n | motozero

What type of motor controller should be used | default='motor_hat'

--serial-device /dev/ttyACM0

Serial device | default='/dev/ttyACM0'

--male

Use TTS with a male voice

--female

Use TTS with a female voice

--voice-number 1

What voice should be used | default=1

--led max7219

What LEDs should be used (if any) | default=none

--ledrotate 180

Rotates the LED matrix | default=none

Example start_robot:

cd /home/pi/runmyrobot
nohup scripts/repeat_start python controller.py YOURROBOTID --type motor_hat --male --voice-number 1 --led max7219 --ledrotate 180 &> /dev/null &
nohup scripts/repeat_start python send_video.py YOURCAMERAID 0 &> /dev/null &

Start script on boot

Use crontab to start the start_robot script on booting:
crontab -e

insert following line and save:

@reboot /bin/bash /home/pi/start_robot

That's it!

How does this work

We use ffmpeg to stream audio and socket.io to send control messages.

How to contribute

The is a community project. Making your own bot? Adding your own control stuff? Cool! We'd like to hear from you.

Hardware Compatibility

Adafruit Motor Hat

Serial Port based commands

GoPiGo

L298N

MotoZero

Missing something?, you can add it, open source!

Quicker install

Grab the source run the install.sh script in the runmyrobot/scripts folder

(This hasn't been tested yet.)

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.