Showing posts with label PYTHON. Show all posts
Showing posts with label PYTHON. Show all posts

RC SERVO ROBOT ARM: Weekend project

This is our weekend project: a simple RC servo robot arm. 


Host controller is Mac using Python scripting, while servo controller is a spare Fubarino SD.




I tried with MSP430 Launchpad, but Serial + 3 servos was over the capability of this little Mac-hated board. Fubarino is a cherry plenty of power, and the ported SoftwareServo library from ChipKit is stable and effective.
Fubarino accepts directly joint angle in ms. Python script uses a simple Inverse Kinematics (Updated versione: math credits to COŞKUN YETİM):

def ik(self, position):
#ARM LENGHTS
l1 = self.arm1
l2 = self.arm2

#END EFFECTOR POSITION IN RESPECT OF ORIGIN NODE
x = position.x - self.home_position.x
y = position.y - self.home_position.y

#TO LIMIT END POSITION WITHIN ARM REACHABLE CIRCLE
dist = min(l1+l2, sqrt(x*x + y*y))
dub = sqrt(x*x + y*y) / dist
x /= dub
y /= dub

#SIMPLE, NO?
thetar = acos(x/dist)
theta1 = acos((l1*l1 + x*x + y*y - l2*l2) / (2*l1*dist)) + thetar
theta2 = pi - acos((l1*l1 + l2*l2 - (x*x + y*y))/(2*l1*l2))

self.set(180-degrees(theta1), 180-degrees(theta2))

Graphic is provided by a simple Svg to path script. The library used (svg.path) can provide point coordinates for Line, Arc, CubicBezier and QuadraticBezier without pain. All graphic may be created within Inkscape.


Overall code may be downloaded at this link.

CNC EMBROIDERY: 100 € tondi tondi

Per controllare questa piccola macchina ho deciso di sperimentare i nuovi prodotti embedded, in attesa di avere per le mani una scheda affidabile per linuxcnc.



Per l'interfaccia utente ho deciso di affidarmi al RASPBERRY PI. Ho visto che è stato aperto un thread su LINUXCNC per utilizzare questa scheda come hardware dedicato, ma ritengo che al momento non sia perseguibile.

Finalmente PYTHON! (http://www.python.org)

L'idea è di implementare un web server per la gui con CHERRYPY (http://www.cherrypy.org), con i tanti cavalli di python sotto il cofano. Per la gestione delle traiettorie e dei motori proverò GRBL (https://github.com/grbl/grbl), con un opportuno fork per gestire la rotazione del volantino invece dell'asse z.

Facciamo qualche conto (al 27.12.2012):
RASPBERRY PI: € 32.00
ARDUINO UNO: € 20.00
3x POSTEP25: € 48.00
TOTALE: € 100.00

Popular posts