Skip to content
forked from remotv/controller

Open source software for pairing your robot with remo.tv

License

Notifications You must be signed in to change notification settings

mw46d/controller

 
 

Repository files navigation

remo.tv is an open telerobotics platform designed for controling and sharing control of robots online in real time.

WARNING: This software is currently under development, so you may encounter frequent issues as updates are made. You can check out the wiki for a more indepth view of what's currently supported.

This controller software is designed to run on your robot and will connect with our development server. It's tuned to support Raspberry Pi based robots, however there is extensive support for other hardware configurations.

Basic setup

If this is your first time working with a Raspberry Pi or Linux, we recommend following our initialization tutorial to get started.

Installing remotv control scripts on a Raspberry Pi

If doing things manually isn't your style, we made an optional guided installation script that handles mostly everything for you.

The RasPi will need the following things install so it can talk to your motors and talk to the internet. Make sure you don’t get any errors in the console when doing the step below. If you have an issue, you can run this line again, and that will usually fix it!

  1. Install the required software libraries and tools. Make sure you don’t get any errors in the console when doing the step below. If you have an issue, you can run this line again, and that will usually fix it!

    sudo apt update
    sudo apt upgrade -y
    sudo apt install ffmpeg python-serial python-dev libgnutls28-dev espeak python-smbus python-pip git
  2. Download the remotv control scripts from our github

    git clone https://github.com/remotv/controller.git ~/remotv
  3. Install python requirements

    sudo python -m pip install -r ~/remotv/requirements.txt
  4. Open the new remotv directory

    cd remotv
  5. Copy controller.sample.conf to controller.conf

    cp controller.sample.conf controller.conf

Configure the controller

  1. Edit the controller.conf file created in the previous section.

    nano controller.conf
  2. Configure the [robot] section

    • owner should be the username you have registered the robot under on the remo.tv site.
    • robot_key is the API key for your robot that you made on the site.
      • Your API key is LONG. It should look something like eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InJib3QtNTVjZjJmMjUtNjBhNS00ZDJkLTk5YzMtOGZmOGRiYWU4ZDQ1IiwiaWF0IjoxNTczNTExMDA2LCJzdWIiOiIifQ.LGXSBSyQ4T4X5xU_w3QJD6R3lLjrrkw_QktOIDzRW5U. If it is not this long, you have not copied the full key.
    • turn_delay is only used by the motor_hat and mdd10. This changes how long your bot turns for. I suggest you leave this at the default value until after you bot is moving.
    • straight_delay is only used by the motor_hat and mdd10. This changes how long your bot turns for. I suggest you leave this at the default value until after you bot is moving.
    • type should be the hardware type for the motor controller of your bot. Available types are currently.
      • adafruit_pwm
      • cozmo
      • gopigo2
      • gopigo3
      • l298n
      • maestro-serv
      • max7219
      • mc33926
      • mdd10
      • motor_hat
      • motozero
      • none
      • owi_arm
      • pololu
      • serial_board
      • telly
      • thunderborg
      • megapi_board
    • Configure your hardwares section. Each hardware type can have their own section it the controller. Look through the file for a section named the same as your hardware controller. If the section exists, read through it and adjust the variable as required.
  3. Configure the [camera] section

    • no-mic This allows the microphone to be disabled.
    • no-camera This allows the camera to be disabled.
    • type This sets the audio / video handler to use. Currently only ffmpeg and ffmpeg-arecord are supported.
    • x_res Sets the resolution for the x axis.
    • y_res Sets the resolution for the y axis.
    • camera_device Sets the device name for the camera.
    • audio_hw_num Set the audio hardware number for the microphone.
  4. Configure the [tts] section

    • tts_volume This is the volume level you want your bot to start with.
    • anon_tts This allows you to enable or disable anonymous users access to your bots TTS features.
    • filter_url_tts This option allows URLs pasted into chat to be blocked from the TTS function.
    • ext_chat This enables or disables the extended chat functions.
    • hw_hum This is the ALSA hardware number for your pi. 0 is the first sound card and should work for most bots.
    • type should be the type of TTS software you are using. The currently supported TTS types are. espeak was installed in the previous steps, and makes a good default tts.
      • espeak
      • fesitval
      • pico
      • Amazon Polly (polly)
      • cozmo_tts
      • google_cloud

Setting up your start_robot file on the Raspberry Pi

  1. Copy the start_robot script to your home directory.

    cp ~/remotv/scripts/start_robot ~
  2. Add the startup script to the crontab

    crontab -e

    Note: If you accidently use the wrong editor try

    EDITOR=nano crontab -e
  3. Insert the following text at the bottom

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

    Example:

    # Edit this file to introduce tasks to be run by cron.
    #
    # Each task to run has to be defined through a single line
    # indicating with different fields when the task will be run
    # and what command to run for the task
    #
    # To define the time you can provide concrete values for
    # minute (m), hour (h), day of month (dom), month (mon),
    # and day of week (dow) or use '*' in these fields (for 'any').#
    # Notice that tasks will be started based on the cron's system
    # daemon's notion of time and timezones.
    #
    # Output of the crontab jobs (including errors) is sent through
    # email to the user the crontab file belongs to (unless redirected).
    #
    # For example, you can run a backup of all your user accounts
    # at 5 a.m every week with:
    # 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
    #
    # For more information see the manual pages of crontab(5) and cron(8)
    #
    # m h  dom mon dow   command
    
    @reboot /bin/bash /home/pi/start_robot
  4. Now just plug in the Camera and USB Speaker and reboot

    sudo reboot

Hardware Compatibility

The following hardware is supported.

  • Adafruit Motor Hat
  • Adafruit PWM / Servo Hat
  • Anki Cozmo
  • Cytron MDD10 10 Amp Motor Driver
  • GoPiGo 2
  • GoPiGo 3
  • L298N Dual Motor Controller
  • Pololu Maestro Servo Controller (experimental)
  • MAX7219 SPI Led Driver
  • MotoZero 4 Motor Controller
  • MQTT Publish commands to a local MQTT Broker
  • OWI 535 Robotic Arm (USB controller)
  • Serial Based controllers (Parallaxy or Arduinos)
  • PiBorg ThunderBorg Motor Driver
  • Pololu Dual MC33926 Motor Driver (experimental)
  • Pololu DRV8835 Dual Motor Driver
  • MegaPi by Makeblock

Missing something? You can add it, open source! Instructions for adding new hardware can be found here.

Chat Commands

When ext_chat is enabled, the following chat commands are available. To use, just type them into the chat box on your bots page. These chat commands have no effect on how the site behaves, they only affect the bot. There are some functions that duplicate functions on the site. These changes are not saved and are lost on reboot.

  • .devmode X Set dev mode. In dev mode, only the owner can drive. If demode is set to mods, your local mods can also drive [on|off|mods].
  • .anon control X Sets if anonymous users can drive your bot [on|off].
  • .anon tts X Sets if anonymous users messages are passed to TTS [on|of].
  • .anon X Sets both anonymous control and tts access [on|off].
  • .tts X Mute the bots TTS [mute|unmute]
  • .ban NAME Ban user NAME from controlling your bots
  • .unban NAME remove user NAME from the ban list
  • .timeout NAME Timeout user NAME from controlling your bots for 5 minutes
  • .untimeout NAME remove user NAME from the timeout list.
  • .brightness X set the camera brightness [0..255]
  • .contrast X set the camera contrast [0..255]
  • .saturation X set the camera saturation [0..255]
  • .stationary Toggles stationary mode on and off. When enabled, forward / backward commands will be blocked.

Hardware modules can have their own hardware specific TTS commands.

Instructions for Specific Hardware Configurations

Cozmo

For Anki Cozmo on Mac or Linux, please see the intructions here. For Windows instructions, please see the instructions here.

GoPiGo3

For GoPiGo3, you will need to install the gopigo3 python module (which is different than older versions). It will need to be installed with the installation script from Dexter. Also, PYTHONPATH needs to be set to /home/pi/Dexter/GoPiGo3/Software/Python

Refer to this: https://github.com/DexterInd/GoPiGo3

sudo git clone http://www.github.com/DexterInd/GoPiGo3.git /home/pi/Dexter/GoPiGo3
sudo bash /home/pi/Dexter/GoPiGo3/Install/install.sh
sudo reboot

Adafruit Motor Hat

Install motor HAT software:

Adafruit PWM / Servo Hat

Install PWM / Servo hat software

Pololu Maestro Servo Controller

Install Maestro Servon controller library into the hardware/ subdirectory.

Pololu DRV8835 Motor Driver

Install DRV8835 Motor Driver library

Pololu MC33926 Motor Driver

Install MC33926 Motor Driver library

Check out the Wiki for more information

A note about the Raspi Cam Module

Sometimes enabling the Raspberry Pi Camera module in raspi-config doesn't completely load the kernel drivers for it. If you don't see /dev/video0 on your system, or controller.py complains about not finding it, then do the following:

  1. Enable the kernel module for your current session:
sudo modprobe bcm2835-v4l2
  1. Tell the operating system to load the kernel module at boot going forward:
sudo cat 'bcm2835-v4l2' >> /etc/modules

Now you should see video0 if you do ls /dev/ | grep video

About

Open source software for pairing your robot with remo.tv

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 98.5%
  • Shell 1.5%