Code Monkey home page Code Monkey logo

icantbelieveitsnotvaletudo's Introduction

valetudo

I can't belive it's not Valetudo

This is a simple map generation companion service for Valetudo which does all the heavy lifting. Since both CPU and memory are limited on the robot, PNG generation for third-party components has been moved here. The service receives raw map data from the robot via MQTT, renders a map and publishes the resulting PNG image via MQTT.

Feel free to open PRs with improvements.

Installation

I can't belive it's not Valetudo is built with JavaScript and requires Node.js and npm to run.

Installation is easy: Clone this repository and run npm install to install dependencies. Then run npm start to start the service. If you prefer running services in containers, this repository includes a dockerfile for you.

Configuration

To configure I can't belive it's not Valetudo, create a file called config.json in the working directory. You can also run npm start to automatically create a default configuration file. If you are running in docker, map the configuration file to /app/config.json .

A basic example configuration would look like this:

{
    "mapSettings": {
        "drawPath": true,
        "drawCharger": true,
        "drawRobot": true,
        "scale": 2
    },
    "mqtt" : {
        "identifier": "rockrobo",
        "topicPrefix": "valetudo",
        "autoconfPrefix": "homeassistant",
        "broker_url": "mqtt://user:[email protected]",
        "caPath": "",
        "mapDataTopic": "valetudo/robot/MapData/map-data",
        "minMillisecondsBetweenMapUpdates": 10000,
        "publishMapImage": true
    },
    "webserver": {
        "enabled": false,
        "port": 3000
    }
}

Integration with FHEM, ioBroker, etc

If you set webserver.enabled to true, the map PNG will be available at http://host:port/api/map/image so you can display a map with any home automation software that allows fetching images from a URL. By default, the image data is published via MQTT to the topic set in mqtt.mapDataTopic.

Advanced Map Configuration

The appearance of the map is configured by the mapSettings

object. The default settings already produce a nice map, but you can use these advanced settings to further customize the map for better integration into your home automation.

Scaling

Since the map data has a resolution of approximately 5 cm per pixel, the resulting images have a relatively low resolution. The map is therefore scaled up by a factor of 2 by default. The scaling factor can be configured by setting mapSettings.scale to the desired value.

To avoid blurred edges, the scaling is done with nearest-neighbor interpolation.

Rotating

Rotating the map can be achieved by setting the mapSettings.rotate to the desired value.

Colors

The map is rendered using a blueish color map by default. The colors of the floor, hard and weak obstacles as well as the robot's path can be set via the mapSettings.colors object, e.g. (other settings omitted for brevity):

{
    "mapSettings": {
        "colors": {
            "floor": "transparent",
            "obstacle": "hsl(120, 20%, 50%)",
            "path": "#333333"
        }
    },
    "mqtt" : {
    }
}

All valid CSS color values are accepted.

New Map Colors

You can now set colors for the new Valetudo Maps too - however - only hex values are supported. If you need to set the opacity you can do so using 8 digit hex code. Since new Valetudo maps are using segments, new field in config has been added (other settings omitted for brevity):

{

    "mapSettings": {
        "colors": {
            "floor": "#0000FF",
            "obstacle": "#33333380",
            "segments": ["#000000", "FF0000", "00FF00", "0000FF"],
            "path": "#FFFFFF"
        }
    },
    "mqtt" : {
    }

}

icantbelieveitsnotvaletudo's People

Contributors

hypfer avatar mikispag avatar svenfestersen avatar klada avatar alexkn avatar bschneppe avatar depau avatar jackgruber avatar trancefam avatar jerome-labidurie avatar poeschl avatar romanreibnagel avatar timbru31 avatar tinkerdudeno1 avatar

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.