Skip to content

amnonpaz/mrobot-controller

Repository files navigation

mRobot Controller

Python application for controlling the Zero Bot Pro (Original software here)

Features

  • Custom Configuration: Load configuration from a JSON file, including video and server settings.
  • Service pulishing: For DNS-SD publishing of the service
  • Video Streaming: Streams video from a specified device using GStreamer.
  • WebSocket server: For controlling:
    • Video stream start/stop
    • Motors TBD
    • LEDs TBD

Prerequisites

  • Python 3.6 or later, with:
    • PyGObject
    • websockets
    • asyncio
    • msgpack (for serializing/deserializing messages)
  • GStreamer With base, good, bad and ugly plugins packages

Installation

pip install --no-cache-dir -r requirements.txt
pip install .

See meta-mrobot Yocto layer for integrating with Yocto.

Using the application

To run the application, use the following command:

python -m mrobot_controller.app config/default.json

Running with docker:

docker-compose -f docker/docker-compose.yml up

Communication

Communication with the controller is done over websockets. The messages are serialized using messagepack, which has an extensive support for various programming languages. The server receives commands and sends response on each command. These messages have these structures:

Command structure:

{
	"command": string
	"parameters": dict
}

** Response structure**:

{
	"success": bool
	"response": string
}

Start video command

Command structure:

{
	"command": "video_start"
	"parameters": {
		"host": string,
		"port": int
	}
}

Stop video command

Command structure:

{
	"command": "video_stop"
	"parameters": {}
}