Difference between revisions of "Pololu Maestro Servo Controller"

From air
Jump to navigation Jump to search
 
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
   
  +
==Products==
  +
* Pololu [http://www.pololu.com/product/1350 Micro Maestro 6-Channel USB Servo Controller]
  +
* Pololu [http://www.pololu.com/product/1352 Mini Maestro 12-Channel USB Servo Controller]
   
  +
==User guide==
  +
* http://www.pololu.com/docs/0J40
  +
  +
==Dev Guide==
  +
* http://intel-software-academic-program.com/courses/diy/Intel_Academic_-_DIY_-_InternetOfThings/IntelAcademic_IoT_11_Pololu_USB_Controller.pdf
  +
  +
==Android==
  +
* https://github.com/pryan1068/android-pololu-maestro-ssc
  +
  +
==[[Node.js]]==
  +
https://www.npmjs.org/package/pololu-maestro
  +
  +
==C==
  +
http://www.pololu.com/docs/0J40/5.h.1
  +
  +
<pre>
  +
gcc setmaestro.c -o setmaestro
  +
./setmaestro /dev/tty.usbmodem00072841 0 6000
  +
</pre>
  +
  +
==Bash==
 
http://www.pololu.com/product/1350
 
http://www.pololu.com/product/1350
   
Line 52: Line 76:
   
 
</pre>
 
</pre>
  +
  +
==[[Robot Operating System]]==
  +
  +
* http://www.youtube.com/watch?v=NcO6oT-91F8
  +
* http://spinlock.blogspot.fr/2012/02/simple-servo-actuation-in-ros.html
  +
  +
===Python===
  +
<pre>
  +
#!/usr/bin/python
  +
import math, time, serial
  +
  +
def get_command(channel, target):
  +
target = target * 4
  +
serialBytes = chr(0x84)+chr(channel)+chr(target & 0x7F)+chr((target >> 7) & 0x7F)
  +
return serialBytes
  +
  +
ser = serial.Serial('/dev/ttyACM0')
  +
ser.write(chr(0xAA))
  +
ser.flush()
  +
  +
i=0.0
  +
while(i<2*math.pi):
  +
i = i+0.01
  +
print math.sin(i)
  +
ser.write(get_command(1,int((math.sin(i)*300)+1500)))
  +
ser.write(get_command(0,int((math.sin(i)*300)+1500)))
  +
  +
time.sleep(0.002)
  +
  +
ser.write(get_command(1,0))
  +
ser.write(get_command(0,0))
  +
  +
ser.close()
  +
</pre>
  +
  +
==Projets @ AIR==
  +
* [[CannonBall de voitures autonomes]]
  +
* [[Scanner 3D volant de batiments]]

Latest revision as of 17:35, 26 April 2014

Products

User guide

Dev Guide

Android

Node.js

https://www.npmjs.org/package/pololu-maestro

C

http://www.pololu.com/docs/0J40/5.h.1

gcc setmaestro.c -o setmaestro
./setmaestro /dev/tty.usbmodem00072841 0 6000

Bash

http://www.pololu.com/product/1350

> system_profiler SPUSBDataType
...
       Pololu Micro Maestro 6-Servo Controller:

          Product ID: 0x0089
          Vendor ID: 0x1ffb
          Version:  1.02
          Serial Number: 00072848
          Speed: Up to 12 Mb/sec
          Manufacturer: Pololu Corporation
          Location ID: 0x14300000 / 1
          Current Available (mA): 500
          Current Required (mA): 100
...


http://www.pololu.com/docs/0J40/5.h.4

#!/bin/bash
# Sends a Set Target command to a Pololu Maestro servo controller
# via its virtual serial port.
# Usage: maestro-set-target.sh DEVICE CHANNEL TARGET
# Linux example: bash maestro-set-target.sh /dev/ttyACM0 0 6000
# Mac OS X example: bash maestro-set-target.sh /dev/cu.usbmodem00234567 0 6000
# Windows example: bash maestro-set-target.sh '\\.\USBSER000' 0 6000
# Windows example: bash maestro-set-target.sh '\\.\COM6' 0 6000
# CHANNEL is the channel number
# TARGET is the target in units of quarter microseconds.
# The Maestro must be configured to be in USB Dual Port mode.
DEVICE=$1
CHANNEL=$2
TARGET=$3

byte() {
  printf "\\x$(printf "%x" $1)"
}

{
  byte 0x84
  byte $CHANNEL
  byte $((TARGET & 0x7F))
  byte $((TARGET >> 7 & 0x7F))
} > $DEVICE


Robot Operating System

Python

#!/usr/bin/python
import math, time, serial

def get_command(channel, target):
        target = target * 4
        serialBytes = chr(0x84)+chr(channel)+chr(target & 0x7F)+chr((target >> 7) & 0x7F)
        return serialBytes

ser = serial.Serial('/dev/ttyACM0')
ser.write(chr(0xAA))
ser.flush()

i=0.0
while(i<2*math.pi):
        i = i+0.01
        print math.sin(i)
        ser.write(get_command(1,int((math.sin(i)*300)+1500)))
        ser.write(get_command(0,int((math.sin(i)*300)+1500)))

        time.sleep(0.002)

ser.write(get_command(1,0))
ser.write(get_command(0,0))

ser.close()

Projets @ AIR