praveen-palanisamy / duckietown-slimremote

Low-overhead low-latency high-frequency remote control library for the robot via ZMQ and OpenCV

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

duckietown-slimremote

Docker Hub

The duckietown-slimremote is a slim control interface for teleoperating a Duckiebot. It relays control inputs from a laptop to the Duckiebot and publishes images from the Duckiebot's onboard camera to a graphical user interface.

This library is integrated in the following applications:

Docker

If your Duckiebot is running HypriotOS/DuckieOS, you can run duckietown-slimremote in a Docker container.

The following command will start the motor contoller and image server:

docker run -dit --privileged duckietown/duckietown-slimremote

Building

To build the image locally (i.e. on an x86 laptop), run the following command from root directory of this project:

docker build --file docker/robot/Dockerfile --tag duckietown/duckietown-slimremote .

TODO: more documentation on the remote side of this, i.e. how does somebody connect to this docker?

Manual Installation

On the robot:

First you need to compile the most recent version of OpenCV.

After that, clone and install this repo:

git clone https://github.com/duckietown/duckietown-slimremote.git && \
cd duckietown-slimremote && \
sudo pip3 install -e . # Install to root user in developer mode

Once the repo is installed you can start the robot controller:

duckietown-start-robot2

To quit the robot controller, press Ctrl+c.

On the PC:

To run duckietown-slimremote on a PC or Mac, use the same installation procedure as the robot, however the OpenCV version is not important and the standard package manager should suffice (e.g. on Mac OS you can use brew install opencv3 --with-contrib --with-python3 --without-python for Python 3 bindings).

Running

To launch duckietown-slimremote, run the following command from the project root directory:

python3 tests/12-test-keyboard-controller.py

This will open a GUI controller that displays the robot's camera, and in which you drive the Duckiebot via the arrow keys (,,,), which are mapped to motor oututs.

API

The main remote control class is duckietown_slimremote.pc.robot.RemoteRobot, whose primary interface is the following three methods:

RemoteRobot.step(action, with_observation=True)

Executes a single motor command. Action is either a tuple, list, or numpy array of two elements. Returns an observation that is an RGB image (unless with_observation = False) in the shape (160,128,3). This is a blocking call and is rate limited by the image observation frequency, currently capped at 60Hz.

RemoteRobot.observe()

Returns the last seen observation without taking an action. Like step(action, with_observation=True), this returns an RGB image and is blocking call, capped at 60Hz.

RemoteRobot.reset():

Stops the robot (sends a [0,0] action).

Communication & Architecture

image depicting the different components and how they interact

About

Low-overhead low-latency high-frequency remote control library for the robot via ZMQ and OpenCV

License:Other


Languages

Language:Python 99.4%Language:Dockerfile 0.6%