sphero-rallye-server

command module
v0.0.0-...-df177ff Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 3, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

README

sphero-rallye-server

Server for sphero-rallye game written in golang.

Usage

To start the server just run:

    sudo go run main.go

Or to build an executable and run that:

    go build main.go
    sudo ./main

To compile executable for ARM to run server on a Raspberry Pi:

    GOARM=7 GOARCH=arm GOOS=linux go build main.go

The server uses Gobot library to control sphero robots of players. In order to connect to all spheros correctly the server needs to know the bluetooth id's of all spheros. One need to configure them in config file (see below) under rallye.players[0-n].bluetoothId.

The server needs a running mqtt broker to communicate with. The address of the broker can be configured in config files ./conf/conf.json or /etc/rallye-rallye-server/conf.json.

In config file one can define the length of one round of the game in seconds.

The server reads and writes to/from several mqtt topics:

MQTT Writes
End time of the next round

In the end of each round the server will send the end time of each round to the topic <global topic prefix>/roundEnd. Date will be formatted with RFC1123Z (e.g. Tue, 28 Aug 2018 13:35:01 +0200).

Were

  • <global topic prefix> can be configured in config file under path mqtt.topicPrefix
Next possible Action types for each player

In the end of each round the server will produce a number of random ActionTypes for each of the participatory players. As well number of actions per round as the participatory players can be configured in config file.

The number of possible ActionTypes will be published to different topics for each player: <global topic prefix>/<player name>/possibleActionTypes. The possible types are ROLL, ROTATE and SET_RGB.

Where

  • <global topic prefix> can be configured in config file under path mqtt.topicPrefix
  • <player name> can be configured under path rallye.players[0-n].name
Error informations for players

While processing next actions, send by players (see next section) errors may occur. Informations about these errors are sent to the mqtt topic <global topic prefix>/<player name>/errors.

Where

  • <global topic prefix> can be configured in config file under path mqtt.topicPrefix
  • <player name> can be configured under path rallye.players[0-n].name
MQTT Reads

Player clients may send their next actions to the topic <global topic prefix>/<player name>/plannedActions.

Where

  • <global topic prefix> can be configured in config file under path mqtt.topicPrefix
  • <player name> can be configured under path rallye.players[0-n].name

Expected format is the following:

    [
            {"ActionType": "ROTATE", "Config": {"heading": 0}},
            {"ActionType": "ROLL", "Config": {"durationInSecs": 1, "speed": 100}},
            {"ActionType": "SET_RGB", "Config": {"red": 0, "green": 255, "blue": 0}}
    ]

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL