Go Down

Topic: AX12 Hexapod Robot and other projects. (Read 16063 times) previous topic - next topic

pabloxid

Mar 09, 2011, 07:53 pm Last Edit: Mar 09, 2011, 07:59 pm by pabloxid Reason: 1
Hi friends, I want to show some Arduino-based projects I did.

An Arduino Mega controlled hexapod robot, with 18 Dynamixel AX-12 motors:

http://www.youtube.com/watch?v=1odLbzQ2hWI


This uses the Arduino Dynamixel library:

http://www.youtube.com/watch?v=3kMAj-sadNo


Some Arduino DMX lighting:

http://www.youtube.com/watch?v=avbWu-v_cZo


And finally, an Artificial Neural Network based voice recognition system, running completely in the Wiring board (that is almost identical to Arduino), without the aid of an external PC:

http://www.youtube.com/watch?v=IpRbdIheUlc


Thanks for your attention, greetings to everyone.

Federico

Beautiful!
Could you share some info and code about the IK? How do you work with it?
Again, beautiful!
F
Federico - Sideralis
Arduino &C: http://www.sideralis.org
Foto: http://blackman.amicofigo.com

pabloxid

Hi Federico, thank you very much for your comment.

Yes, of course, I can paste the code here. By the way: you speak Spanish? Because the code comments are all in Spanish, and I speak very bad English.

First, there are some definitions and pre-computed constants to speed up calculations.
Code: [Select]
// tipos
typedef struct {float x; float z;} COORD2D;
typedef struct {float x; float y; float z;} COORD3D;
typedef struct {COORD3D patas[6];} POSICION;
typedef struct {int gama; int alfa; int beta;} ANGULOS;

// propiedades del robot
#define BAUDRATE   1000000                // velocidad de comunicación de los AX12
#define DIST       5.0                    // distancia entre el eje del primer motor y el segundo (en cm)
#define MUSLO      8.2                    // longitud del "muslo" (en cm)
#define TIBIA      11.7                   // longitud de la "tibia" (en cm)
#define SEPARA     8.75                   // separación entre las inserciones de las patas (en cm)
#define ORIGEN     9.6                    // distancia entre el origen de la x y el centro del tronco (en cm)
#define ANG_SCALE  614                    // unidades angulares, equivalente a PI o 180º
#define ANG_ZERO   518                    // offset angular (teóricamente tendría que ser 512, pero ya ves...)
#define TICK       .004                   // duración del tick en segundos
#define VEL_MAX    684                    /* velocidad máxima de la escala en grados/segundo. (Nota: 119rpm según la info actualizada de Dynamixel, lo que equivale a 684º/s. No obstante, el motor no pasa de los 300º/s, por lo que adquiere su velocidad máxima por la mitad de la escala. */

// constantes para acelerar el cálculo
float const doublea = 2 * MUSLO;
float const doubleab = 2 * MUSLO * TIBIA;
float const sqaplussqb = sq (MUSLO) + sq (TIBIA);
float const sqaminussqb = sq (MUSLO) - sq (TIBIA);
float const vel_scale = 184200.0 / (TICK*VEL_MAX*ANG_SCALE);         /* velocidad(AX12) = unidades_angulares*vel_scale/ticks */
byte const overflow = 256 - (TICK*14000);                        // valor inicial del contador para el timer2


Then there is a pair of routines, one that converts Cartesian coordinates to angles, and the other does the reverse:
Code: [Select]
ANGULOS alfabetagama (COORD3D P) {     
  // convierte las coordenadas cartesianas en los ángulos correspondientes
  // recibe: xn, y, z; devuelve giro (gama), cadera (alfa), rodilla (beta) 
  // fundamento: teorema de pitágoras + teorema del coseno (ver figura)
 
  P.x = abs (P.x);        // pequeño truco para abarajar la simetría del eje x
  ANGULOS A;
 
  // fase 1, calculamos "x" y el ángulo "gama"
  // DIST es la distancia entre el eje del primer motor y el segundo
  float x = hypot (P.z, P.x+DIST) - DIST;   // P.x = xn                           
  A.gama = ANG_SCALE*(atan(P.z/(P.x+DIST)))/PI;                   
 
  // fase 2, calculamos alfa y beta
  // ver constantes definidas al principio
  float sqx = sq(x); float sqy = sq(P.y);
  float cosalfa = (sqx + sqy + sqaminussqb) / (doublea*sqrt(sqx + sqy));          // coseno del angulo que forman el "muslo" y la hipotenusa
  float cosbeta = (sqaplussqb - sqx - sqy) / doubleab;                         // coseno del angulo que forman "muslo" y "tibia"
  A.alfa = ANG_SCALE*(acos(cosalfa) + atan(P.y/x))/PI;
  A.beta = ANG_SCALE/2 - ANG_SCALE*acos(cosbeta)/PI;
 
  return A; 
}

COORD3D xyz (int angulos[]) {                   // "cinemática directa"
  float rad [3];
  for (byte i=0; i<3; i++) {
    rad[i] = PI * angulos[i] / ANG_SCALE;        // convierte a radianes
  }
  // rad[0] = gama; rad[1] = alfa; rad[2] = beta
  float sqc = sqaplussqb - (doubleab * cos(rad[2]-PI/2));
  float c = sqrt(sqc);
  float cosalfa = (sqc + sqaminussqb) / (doublea*c);
  float delta = rad[1] - acos(cosalfa);
  float x = c * cos(delta);
  return (COORD3D) {(x+DIST)*cos(rad[0]) - DIST, c*sin(delta), (x+DIST)*sin(rad[0])};
}

cr0sh


Hi Federico, thank you very much for your comment.

Yes, of course, I can paste the code here. By the way: you speak Spanish? Because the code comments are all in Spanish, and I speak very bad English.


Personally, your english seems fine to me; certainly better than my spanish! Your comments and such, even in spanish, are fairly clear, and I can make out what most of them are; I imagine that google translate could take care of the rest...

:)
I will not respond to Arduino help PM's from random forum users; if you have such a question, start a new topic thread.

Federico

I am Italian and I studied spanish for few years, so I think it's fine. Now that I think about it, did you previously released part of this work? I am pretty sure that I have already seen the "voice command" part...

I am really interested in building  a robot like this, but I have never started because of the price of the servos :-/
Federico - Sideralis
Arduino &C: http://www.sideralis.org
Foto: http://blackman.amicofigo.com

pabloxid

1 year ago I developed the voice recognition, but I think had I not shown here in this forum.

Yes, the AX-12 cost $ 45 each.

davidbrowne

Your work is incredible! Are you working as a hobby, in academia or in industry?

pabloxid

Thanks, david.

I do as a hobby... but if you offer me any job I accept it ;)

Federico


1 year ago I developed the voice recognition, but I think had I not shown here in this forum.



I think I found it on hackaday.com
Federico - Sideralis
Arduino &C: http://www.sideralis.org
Foto: http://blackman.amicofigo.com

pabloxid

Hi :)

I updated my website, and posted the documentation of my project along with its sources:

http://www.pablogindel.com/trabajos/samsa-ii-2010/

Regards,
Pabloxid.

Federico

Federico - Sideralis
Arduino &C: http://www.sideralis.org
Foto: http://blackman.amicofigo.com

stekkestim123

Hi

I was wondering if it is possible to make this (with the used code) with normal (budget $15/pcs) servo's instead of these special servo's.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy