Project

ksr10

0.0
No commit activity in last 3 years
No release in over 3 years
Interface and control script for the Velleman KSR-10 robotic arm.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 0.6, >= 0.6.4
~> 0.12, >= 0.12.2
 Project Readme

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