Code Monkey home page Code Monkey logo

viam-custom-module's Introduction

Viam Custom Model Example

A simple example of how to implement a custom motor model and how to extend it with a custom DoCommand in Python. To create the file structure and generate the boiler plate code segments, the Viam Module Generator was used.

Prerequisits

A robot instance has been created and is registered with the viam cloud backend.

Installation and Configuration

  1. Clone the Github repo
  2. Get the path to the run.sh file
  3. Go to Viam App
  4. Add a new module to the configuration: Name: mymotor and Executable Path: <-Your-Path-To->/run.sh
  5. Add a new component to the configuration:
    {
      "namespace": "rdk",
      "attributes": {},
      "depends_on": [],
      "type": "motor",
      "name": "mymotor",
      "model": "custom:motor:mymotor"
    }
  1. If not running already start the viam-server

Usage

  1. Create a .env file in the same directory as the run.sh file
  2. Add your credentials to it:
    ADDRESS=robot.organisation.viam.cloud
    SECRET=your-secret
  1. Run python robot.py -> you should see the following console output:
    mymotor is_moving return value: True
    Check the log entries on app.viam.com!
  1. In the viam server console output or via app.viam.com under Logs you should be able to find the following entry:
Command log with message executed!
  1. Feel free to play with the do_command client in robot.py and the execution part in mymotor.py to trigger a warning message in the logs or customize it to your needs.

viam-custom-module's People

Contributors

felixreichenbach avatar

Watchers

 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.