Giter VIP home page Giter VIP logo

pololu-maestro's Introduction

Pololu Maestro USB Servo Controller library for Windows, Linux, and macOS

C/C++ CI GitHub Releases

Description

This package contains the code you need for making your own applications that control Pololu Maestro USB Devices. All of the code uses the devices' native USB interfaces.

The supported devices are:

  • Micro Maestro 6-Channel USB Servo Controller (#1350, #1351)
  • Mini Maestro 12-Channel USB Servo Controller (#1352, #1353)
  • Mini Maestro 18-Channel USB Servo Controller (#1354, #1355)
  • Mini Maestro 24-Channel USB Servo Controller (#1356, #1357)

Upgrading Firmware

See the firmwares subdirectory for the instructions.

Prerequisites

On all platforms

  • A compiler with C++11 support
  • CMake >= 3.11.0

On Linux

  • libusb-dev
  • python-dev

How to Use

C++

#include <maestro/Device.h>

std::vector<Maestro::Device> devices = Maestro::Device::getConnectedDevices();

devices[0].setAcceleration(0, 4);  // set servo 0 acceleration to 4
devices[0].setTarget(0, 6000);     // set servo to move to center position
devices[0].setSpeed(1, 10);        // set servo 1 speed to 10

Python

import maestro
devices = maestro.getConnectedDevices()

if len(devices) == 0:
    print("No Maestro devices connected")
    exit()

for device in devices:
    print(f"name: {device.getName()} #channels: {device.getNumChannels()}")
    for c in range(device.getNumChannels()):
        channel=device.getChannelSettings(c)
        print(f"#{c} mode: {channel.mode} min: {channel.minimum} max: {channel.maximum} speed: {channel.speed}")

# select first Maestro device
device=devices[0]
device.setAcceleration(0, 4) # set servo 0 acceleration to 4
device.setTarget(0, 6000)    # set servo to move to center position
device.setSpeed(1, 10)       # set servo 1 speed to 10

# compile and upload a script
with open('blink.txt', 'r') as content_file:
    script = content_file.read()

program = maestro.Program(script=script, isMiniMaestro=False)

device.writeScript(program.getByteList())

pololu-maestro's People

Contributors

mojocorp avatar zzx9636 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.