Giter Club home page Giter Club logo

ksr10's Introduction

ksr10

https://github.com/mcarpenter/ksr10

This Ruby Gem provides a simple programming interface to the Velleman KSR10 robotic arm with USB control board. It's simple enough that it can be used from the REPL. The krs10 script uses pry so that you can just call the instance methods from the prompt. See the examples below.

For product details see:

Examples

API

require 'ksr10'

arm = Ksr10.new
arm.led(:on)
arm.elbow(:down, 0.5)
arm.gripper(:close, 1)
arm.stop

REPL

$ ksr10
[1] pry(#<Ksr10>)> led(:on)
=> #<Ksr10:0x000055da9db684b0
 @device=#<LIBUSB::Device 3/2 1267:0001 ? ? ? (Vendor specific (00,00))>,
 @state=1,
 @usb=#<LIBUSB::Context:0x000055da9db68488 @ctx=#<FFI::Pointer address=0x000055da9da582d0>, @hotplug_callbacks={}, @on_pollfd_added=nil, @on_pollfd_removed=nil>>
[2] pry(#<Ksr10>)> shoulder(:up, 0.4)
=> #<Ksr10:0x000055da9db684b0
 @device=#<LIBUSB::Device 3/2 1267:0001 ? ? ? (Vendor specific (00,00))>,
 @state=1,
 @usb=#<LIBUSB::Context:0x000055da9db68488 @ctx=#<FFI::Pointer address=0x000055da9da582d0>, @hotplug_callbacks={}, @on_pollfd_added=nil, @on_pollfd_removed=nil>>
[3] pry(#<Ksr10>)>

Install

sudo apt install libusb-1.0-0 ruby-dev
sudo gem install ksr10

Add the following lines to /etc/udev/rules.d/95-ksr10.rules so that unprivileged users can connect to the KSR10:

ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="1267", ATTR{idProduct}=="0000", MODE="0666"
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="1267", ATTR{idProduct}=="0001", MODE="0666"

If you find that the action is reversed (eg "up" is actually "down") then you can simply reverse the appropriate Dupont connector on the battery box to change the polarity.

Alternatives

ksr10's People

Contributors

mcarpenter avatar

Watchers

 avatar  avatar

Forkers

regelneef

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.