hexapode avec arduino shield adafruit
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- ALBAN1978
- Posts: 24
- Joined: Sat Jan 30, 2016 6:01 pm
hexapode avec arduino shield adafruit
J'ai terminer la construction de mon hexapode voir photo ci-dessous, je n'est aucune idée de la programmation. J'ai en ma possession une carte arduino R3 et adafruit. Si quelqu'un aurai un exemple a me fournir déjà préparer qui et configurer pour pouvoir changer les angles et la vitesse de chaque servomoteur. Ou si quelqu'un pourrez me donner de l'aide à commencer la configuration de mon hexapode.
Merci a l'attente de toute réponse.
- adafruit_support_bill
- Posts: 88149
- Joined: Sat Feb 07, 2009 10:11 am
Re: hexapode avec arduino shield adafruit
Via Google Translate:
Revision 4 from this project uses the Servo shield. But his leg geometry looks quite different.
http://letsmakerobots.com/node/40095
Is this robot your own design, or from a plan? Inverse kinematics for multi-legged robots depend a lot of the specific leg geometry. And in the case of a quadruped as in the photo, there is also the issue of balance.Hello ,
I finished building my hexapod see photo below , I was no idea of programming. I have in my possession a map R3 and Arduino Adafruit . If someone will give me an example has already prepared and set that in order to change the angles and the speed of each actuator. Or if someone can give me help to start my hexapod configuration .
Thank you was waiting for any response .
Revision 4 from this project uses the Servo shield. But his leg geometry looks quite different.
http://letsmakerobots.com/node/40095
- ALBAN1978
- Posts: 24
- Joined: Sat Jan 30, 2016 6:01 pm
Re: hexapode avec arduino shield adafruit
adafruit_support_bill wrote:Via Google Translate:Is this robot your own design, or from a plan? Inverse kinematics for multi-legged robots depend a lot of the specific leg geometry. And in the case of a quadruped as in the photo, there is also the issue of balance.Hello ,
I finished building my hexapod see photo below , I was no idea of programming. I have in my possession a map R3 and Arduino Adafruit . If someone will give me an example has already prepared and set that in order to change the angles and the speed of each actuator. Or if someone can give me help to start my hexapod configuration .
Thank you was waiting for any response .
Revision 4 from this project uses the Servo shield. But his leg geometry looks quite different.
http://letsmakerobots.com/node/40095
bonjour le héxapode a été mon avec diférent model vue sur le net ,sinon il tien bien sur c est 4 pate,mé le probleme c est que je n est pa de programe pour le faire avancer car je ne trouve rien sur le net avec la carte adafruit.
- adafruit_support_bill
- Posts: 88149
- Joined: Sat Feb 07, 2009 10:11 am
Re: hexapode avec arduino shield adafruit
Unfortunately, we do not have any example code for a robot like yours.hello hexapod was my with diferent model view on the net , otherwise it tien course c is 4 dough , mé the problem c is I n pa programe to advance it because I can not find anything on the net with the Adafruit card .
- Franklin97355
- Posts: 23940
- Joined: Mon Apr 21, 2008 2:33 pm
Re: hexapode avec arduino shield adafruit
See if you can find something that can help here.
- ALBAN1978
- Posts: 24
- Joined: Sat Jan 30, 2016 6:01 pm
Re: hexapode avec arduino shield adafruit
merci pour ta recherche.franklin97355 wrote:See if you can find something that can help here.
j ai trouvé un code qui pourrai corespondre a se que je cherche,et je voudrai savoir si se code marche avec une télécommande, pour controlé l'héxapode ?
voici le code.
Code: Select all
http://forums.adafruit.com/viewtopic.php?f=31&t=88942
- adafruit_support_bill
- Posts: 88149
- Joined: Sat Feb 07, 2009 10:11 am
Re: hexapode avec arduino shield adafruit
That link is to this thread. Did you mean to post a different one?thank you for your search.
I found a code that could be a corespondre I seek, and I want to know if code is running with a remote control for Hexapod controlled ?
here is the code .
- ALBAN1978
- Posts: 24
- Joined: Sat Jan 30, 2016 6:01 pm
Re: hexapode avec arduino shield adafruit
adafruit_support_bill wrote:That link is to this thread. Did you mean to post a different one?thank you for your search.
I found a code that could be a corespondre I seek, and I want to know if code is running with a remote control for Hexapod controlled ?
here is the code .
bonjour je voudrai savoir si se code pour héxapode marche avec une télécommande ?
Code: Select all
/ * Code de BANNED quadrupède
Par Robbie Nakata
Dernière mise à jour 12 Décembre, 2012
* /
/ *
Le programme suivant est utilisé pour BANNED le mouvement d'une jambe du quadrupède 3DOF
Le code est encore un travail en cours et je l'ai fait de mon mieux pour avoir des commentaires descriptifs
mais il wil sans doute à être déroutant au premier abord. Si vous avez des questions ou des commentaires,
écrivez-moi à [email protected]*/
#include <Servo.h>
#define rightFront 1
rightback #define 2
#define leftFront 3
LeftBack #define 4
// Les longueurs physiques des composants des jambes. Ils sont égaux pour tous les quatre jambes
deux hanches = 1.619;
à double fémur = 2;
à double tibia = 4,664;
à double pi = 3.14;
// Les variables suivantes déterminent la façon large les jambes sont répartis les uns des autres
// postion par défaut pour Y
à double centerY = 4;
// postion par défaut pour X
à double centerX = 3;
à double xVal = -pi / 4;
à double RFx2, RFy2, RFz2;
// Ce sont presque toujours la position actuelle de la jambe de l'quarduped. Je essaie de toujours mettre à jour ceux-ci dans une fonction pour que d'autres fonctions "savent" les positions actuelles
à double RFx, RFY, RFZ;
à double RBx, RBY, RBZ;
à double LFx, daf, LFZ;
à double LBX, LBY, LBZ;
// Avant droit Servo (1)
Servo RF0;
Servo RF1;
Servo RF2;
// Retour Servo (2)
Servo RB0;
Servo RB1;
Servo RB2;
// Front de Gauche Servo (3)
Servo LF0;
Servo LF1;
Servo LF2;
// Arrière gauche Servo (4)
LB0 d'asservissement;
LB1 d'asservissement;
LB2 d'asservissement;
Fonction / * minuteries pour les millis () pour certains mouvements. Je l'avais réservation initiale voulu utiliser seulement millis () mais a trouvé retard simplifie la programmation de manière significative.
Je peut ou non résoudre ce problème à l'avenir. * /
à long tNow unsigned = 0;
unsigned = 0; à long dit
à long tNowSM unsigned = 0;
à long tOldSM unsigned = 0;
à long tNow1 unsigned = 0;
à long tOld1 unsigned = 0;
// compteurs
int j = 0;
int compteur = 0;
omble inByte;
void setup () {
// joindre tous les servos
RB0.attach (7);
RB1.attach (6);
RB2.attach (5);
RF0.attach (8);
RF1.attach (9);
RF2.attach (13);
LB0.attach (10);
LB1.attach (11);
LB2.attach (12);
LF0.attach (2);
LF1.attach (3);
LF2.attach (4);
Serial.begin (9600);
// Position à partir de la mise sous tension
fullMove (0,0,4);
}
// Boucle permet de BANNED les différentes fonctions du robot en utilisant le moniteur de série. Ceci est juste pour les tests, finalement, je vais créer un autre
// BANNED et ont aussi des capteurs pour le BANNED autonome
void loop () {
// Vérifie si il ya de nouvelles données en série
si (Serial.available ()) {
inByte Serial.read = ();
Serial.println (inByte);
}
// déplace le corps de robot autour d'un cercle
if (inByte == 'a') {
autour (1.5,3);
}
// Les trois fonctions suivantes sont les fonctions de marche fluage de la démarche de base. En variant le nombre d'étapes dans shiftWalk (étapes, le temps), vous pouvez BANNED la vitesse de la grait
else if (inByte == 'q') {
shiftWalk (50,10);
}
else if (inByte == 'w') {
shiftWalk (25,10);
}
else if (inByte == 'e') {
shiftWalk (13,10);
}
//Pas encore fini
else if ('s' inByte ==) {
// SineWalk (100, .1,10,3,1);
}
// centre du robot
else if (inByte == 'c') {
fullMove (0,0,4);
}
// déplacer le robot de haut en bas en utilisant IK
else if (inByte == 'u') {
vers le haut (3,5);
}
// Tourner le corps de robots avant et en arrière
else if (inByte == 'L') {
faire tourner (25);
tourner (-50);
faire tourner (25);
}
else if (inByte == 'r') {
SmoothMove (3, LFx, daf, 4-2,50,10);
}
else if (inByte == 't') {
SmoothMove (1, RFx, RFY, RFZ-2,50,10);
}
else if (inByte == 'f') {
SmoothMove (4, LBX, LBY, 4-2,50,10);
SmoothMove (2, RBx, RBY, 4-2,50,10);
}
else if (inByte == 'g') {
SmoothMove (2, RBx, RBY, 4-2,50,10);
}
else if (inByte == 'z') {
tourner (25,10);
}
}
// Cette fonction fait tourner le corps de robot à partir de la position actuelle de «degré», puis de nouveau. Ce qui finira par être utilisé pour balayer un capteur, pour l'instant il n'a pas beaucoup d'effet.
Rotation (int degré) {
int RFcur = RF0.read ();
int RBcur = RB0.read ();
int LFcur = LF0.read ();
int LBcur = LB0.read ();
Serial.println (RFcur);
si (degré> 0) {
for (int count1 = 0; count1 <degré; count1 ++) {
RFcur + = 1;
RBcur + = 1;
LFcur + = 1;
LBcur + = 1;
RF0.write (RFcur);
RB0.write (RBcur);
LF0.write (LFcur);
LB0.write (LBcur);
retard (10);
}
}
autre{
for (int count1 = 0; count1> degré; count1 -) {
RFcur- = 1;
RBcur- = 1;
LFcur- = 1;
LBcur- = 1;
RF0.write (RFcur);
RB0.write (RBcur);
LF0.write (LFcur);
LB0.write (LBcur);
retard (10);
}
}
}
// Déplacer une jambe de la position actuelle à la nouvelle position en douceur à l'aide de petites chages angle divisé en "étapes" tous t1 millisecondes
annuler SmoothMove (int servoNumber, double x, double y, double z, int t1, int étapes) {
// RF
si (servoNumber == 1) {
// comment grand chaque étape est
à double dx = (x-RFx) / étapes;
à double dy = (y-RFY) / étapes;
à double dz = (z-RFZ) / étapes;
// déplace la jambe le long de chaque axe par le delta correspondant, puis attend t1 répétitions
for (int i = 0; i <= étapes; i ++) {
RFx + = dx;
JPV + = dy;
RFZ + = dz;
moveServos2RF (RFx, RFY, RFZ);
retard (t1);
}
}
// RB
else if (servoNumber == 2)
{
à double dx = (x-RBx) / étapes;
à double dy = (y-RBY) / étapes;
à double dz = (z-RBZ) / étapes;
for (int i = 0; i <= étapes; i ++) {
RBx + = dx;
RBY + = dy;
RBZ + = dz;
moveServos2RB (RBx, RBY, RBZ);
retard (t1);
}
}
// LF
if (servoNumber == 3)
{
à double dx = (x-LFx) / étapes;
à double dy = (y-DAF) / étapes;
à double dz = (z-LLZOA) / étapes;
for (int i = 0; i <= étapes; i ++) {
LFx + = dx;
LFY + = dy;
LFZ + = dz;
moveServos2LF (LFx, daf, LLZOA);
retard (t1);
}
}
//KG
else if (servoNumber == 4)
{
à double dx = (x-LBX) / étapes;
à double dy = (y-LBY) / étapes;
à double dz = (z-LBZ) / étapes;
for (int i = 0; i <= étapes; i ++) {
LBX + = dx;
LBY + = dy;
LBZ + = dz;
moveServos2LB (LBX, LBY, LBZ);
retard (t1);
}
}
else if (servoNumber == 0) {
}
}
// Ceci est la démarche de fluage primaire que je l'ai développé. Il utilise les fonctions de SmoothMove divisé en un certain nombre de "marches" avec un "temps" de retard entre chaque étape
shiftWalk (int étapes, le temps d'int) {
// position de départ verticale
à double z = 3;
// Comment loin de lever la jambe pour chaque mouvement
à double dz = -2;
// déplacer tout le corps vers l'avant et vers la gauche. Cela provoque le robot d'avancer 1 pouce
// et prépare pour les jambes gauche pour déplacer
smoothFullMove (2, -1, z, 2,1, z, étapes * 2, le temps);
print3 (LBX, LBY, LBZ);
// Déplace arrière gauche jambe puis vers l'avant puis vers le bas
SmoothMove (4, LBX, LBY, z + dz, étapes, le temps); // moveServos2LB (3,5,1);
SmoothMove (4,1,5, z + dz, étapes, le temps); // moveServos2LB (1,5,1);
SmoothMove (4,1,5, z, étapes, le temps); // moveServos2LB (0,5,3);
// Déplace la jambe gauche avant vers le haut puis vers l'avant puis vers le bas
SmoothMove (3, -1,5, z + dz, étapes, le temps); // moveServos2LF (-1,5,0);
SmoothMove (3, -3,5, z + dz, étapes, le temps); // moveServos2LF (-3,5,1);
SmoothMove (3, -3,5, z, étapes, le temps); // moveServos2LF (-3,5,3);
// déplacer tout le corps vers l'avant et vers la droite. Cela provoque le robot d'avancer 1 pouce
// et prépare pour les bonnes jambes pour se déplacer
smoothFullMove (2,1, z, 2, 1, z, étapes * 2, le temps);
// Déplace jambe arrière jusqu'à l'avant puis vers le bas, puis
SmoothMove (2,3,5, z + dz, étapes, le temps); // moveServos2LB (3,5,1);
SmoothMove (2,1,5, z + dz, étapes, le temps); // moveServos2LB (1,5,1);
SmoothMove (2,1,5, z, étapes, le temps); // moveServos2LB (0,5,3);
// Déplace patte avant droite vers le haut puis vers l'avant puis vers le bas
SmoothMove (1, -1,5, z + dz, étapes, le temps); // moveServos2LF (-1,5,0);
SmoothMove (1, -3,5, z + dz, étapes, le temps); // moveServos2LF (-3,5,1);
SmoothMove (1, -3,5, z, étapes, le temps); // moveServos2LF (-3,5,3);
}
/ * FONCTIONS IK MOVE * /
// déplace le robot verticalement à partir de Z1 à Z2 et puis retour à z1
annuler jusqu'à (Double z1, double Z2) {
à double z = z1;
tandis que (z <= z2) {
fullMove (0,0, z);
retard (25);
z + = 1.
}
tandis que (z> = z1) {
fullMove (0,0, z);
retard (25);
z - = 1;.
}
}
// déplace le robot dans un cercle de rayon r et à une hauteur z
vide autour (Double R, double z) {
doubles x = 0;
while (x <= 2 * 3.14) {
fullMove (r * cos (x), r * sin (x), z);
retard (50);
= x + 1.
}
}
// Déplace le corps de robot à l'ensemble de la position x, y, z. Notez que ce résultat en mouvements saccadés très
annuler fullMove (double x, double y, double z) {
à double droitier = centerY-y;
à double Lefty = centerY + y;
doubles FrontX = x-centerX;
à double Backx = x + centerX;
RFx = x-centerX;
JPV = centerY-y;
RFZ = z;
RBx = x + centerX;
RBY = centerY-y;
RBZ = z;
Lfx = x-centerX;
LFY = centerY + y;
LFZ = z;
LBX = x + centerX;
LBY = centerY + y;
LBZ = z;
moveServosRF (gamma (RFx, RFY, RFZ), alpha (RFx, RFY, RFZ), bêta (RFx, RFY, RFZ));
moveServosRB (gamma (RBx, RBY, RBZ), alpha (RBx, RBY, RBZ), bêta (RBx, RBY, RBZ));
moveServosLF (gamma (LFx, daf, LLZOA), alpha (LFx, daf, LLZOA), bêta (LFx, daf, LLZOA));
moveServosLB (gamma (LBX, LBY, LBZ), alpha (LBX, LBY, LBZ), bêta (LBX, LBY, LBZ));
}
// Déplace l'ensemble du corps de x0, y0, z0 à x, y, z en douceur avec "étapes" étapes séparées par millisecondes t1. Ceci est utile pour décaler le centre de gravité
annuler smoothFullMove (Double x0, double y0, double z0, double x, double y, double z, int t1, int étapes) {
à double dx = (x-x0) / étapes;
à double dy = (y-y0) / étapes;
à double dz = (z-z0) / étapes;
for (int i = 0; i <étapes; i ++) {
x0 + = dx;
= y0 + dy;
Z0 + = dz;
fullMove (X0, Y0, Z0);
retard (t1);
}
}
// utilisée pour attacher les jambes aux servos à la bonne position
Calibrer void () {
RB0.write (90);
RB1.write (0);
RB2.write (90);
RF0.write (90);
RF1.write (0);
RF2.write (90);
LB0.write (90);
LB1.write (0);
LB2.write (90);
LF0.write (90);
LF1.write (0);
LF2.write (90);
}
calibrate2 void () {
moveServosRF (90,90,90);
moveServosRB (90,90,90);
moveServosLF (90,90,90);
moveServosLB (90,90,90);
}
// fonction de débogage pour imprimer trois ints
print3 void (int i, int o, p int) {
Serial.print (i);
Serial.print ("\ t");
Serial.print (o);
Serial.print ("\ t");
Serial.println (p);
}
/ *** Cinématique inverse *** /
// IK pour le gamma (coxa angle)
int gamma (double x, double y, double a) {
double G = atan (x / y);
retour int (g * 57,3) 90;
}
// IK pour la bêta (angle du fémur)
à double bêta (double x, double y, double a) {
double G = atan (x / y);
x / = cos (g);
// pari double = ACOS ((pow (x, 2) + pow (y, 2) + pow (A, 2) -pow (c, 2) -pow (b, 2)) / (- 2 * c * b));
pari double = ACOS ((pow (A, 2) + pow (y-hanches, 2) -pow (tibia, 2) -pow (fémur, 2)) / (- 2 * * fémur tibia));
retour int (pari * 57,3);
}
// IK pour l'alpha (angle du tibia)
double-alpha (double x, double y, double a) {
double G = atan (x / y);
x / = cos (g);
à double L2 = sqrt (pow (A, 2) + pow (y-hanches, 2));
à double ALP1 = atan ((y-coxa) / a);
à double alp2 = ACOS ((pow (tibia, 2) -pow (fémur, 2) -pow (L2,2)) / (- 2 * fémur * L2));
à double ALP = ALP1 + alp2;
retour int (ALP * 57,3);
}
/ ** Fonctions de déplacement ** /
// Le "moveServos2XX" suivant déplacer la pointe des pieds correspondant aux points x, y, z. Cela a probablement pu être combiné avec le
// fonctions "moveServosXX", mais ont été écrites après tant qu'ils appellent simplement ces fonctions.
moveServos2RB void (double x, double y, double z) {
//
RBX = x;
RBY = y;
RBZ = z;
moveServosRB (gamma (RBx, RBY, RBZ), alpha (RBx, RBY, RBZ), bêta (RBx, RBY, RBZ));
}
annuler moveServos2RF (double x, double y, double z) {
RFx = x;
JPV = y;
RFZ = z;
moveServosRF (gamma (RFx, RFY, RFZ), alpha (RFx, RFY, RFZ), bêta (RFx, RFY, RFZ));
}
annuler moveServos2LB (double x, double y, double z) {
LBX = x;
LBY = y;
LBZ = z;
// Serial.print ("alpha");
// Serial.println (alpha (LBX, LBY, LBZ));
moveServosLB (gamma (LBX, LBY, LBZ), alpha (LBX, LBY, LBZ), bêta (LBX, LBY, LBZ));
}
annuler moveServos2LF (double x, double y, double z) {
Lfx = x;
LFY = y;
LFZ = z;
moveServosLF (gamma (LFx, daf, LLZOA), alpha (LFx, daf, LLZOA), bêta (LFx, daf, LLZOA));
}
// Les fonctions suivantes "moveServosXX" déplacer les servos dans une jambe aux angles donnés. gamma (G), alpha (a) et bêta (b) tel que défini dans le modèle IK
moveServosRB (int g, int a, int b) {
// Les étalonnages suivants ont été déterminées expérimentalement pour obtenir les angles d'aligner avec les équations IK
g = (g);
a = (180-a + 10);
b = (b + 10);
RB0.write (g);
RB1.write (a);
RB2.write (b);
// si hors de portée
si (g> 180 g || <0 || a> 180 || a <0 || b> || 180 b <0)
Serial.println ("Erreur RB");
// Print3 (g, a, b);
}
// déplacer les articulations du servo RF à angles g, a, b et
annuler moveServosRF (int g, int a, int b) {
// Les étalonnages suivants ont été déterminées expérimentalement pour obtenir les angles d'aligner avec les équations IK
g = (g);
a = (180-a + 10);
b = (b + 10);
RF0.write (g);
RF1.write (a);
RF2.write (b);
// si hors de portée
si (g> 180 g || <0 || a> 180 || a <0 || b> || 180 b <0)
Serial.println ("erreur de RF");
}
// déplacer les articulations du servo LB à angles g, a, b et
annuler moveServosLB (int g, int a, int b) {
// Les étalonnages suivants ont été déterminées expérimentalement pour obtenir les angles d'aligner avec les équations IK
g = 180-g-10;
a = 180-a + 5;
b = b + 5;
LB0.write (g);
LB1.write (a);
LB2.write (b);
// si hors de portée
si (g> 180 g || <0 || a> 180 || a <0 || b> || 180 b <0) {
Serial.println ("Erreur LB");
}
}
// déplace les joints dans le servo de LF à angles g, a, b et
annuler moveServosLF (int g, int a, int b) {
// Les étalonnages suivants ont été déterminées expérimentalement pour obtenir les angles d'aligner avec les équations IK
g = 180 g + 5;
a = 180-a-7;
b = b + 15;
LF0.write (g);
LF1.write (a);
LF2.write (b);
// si hors de portée
si (g> 180 g || <0 || a> 180 || a <0 || b> || 180 b <0)
Serial.println ("Erreur LF");
}
/ ** TRAVAUX EN FONCTIONS DE PROGRÈS ** /
// Déplace le corps de robot à l'ensemble de la position x, y, z
annuler partMove (double x, double y, double z, int legNoMove) {
à double droitier = centerY-y;
à double Lefty = centerY + y;
doubles FrontX = x-centerX;
à double Backx = x + centerX;
si (== legNoMove 0) {
RFx = x-centerX;
JPV = centerY-y;
RFZ = z;
RBx = x + centerX;
RBY = centerY-y;
RBZ = z;
Lfx = x-centerX;
LFY = centerY + y;
LFZ = z;
LBX = x + centerX;
LBY = centerY + y;
LBZ = z;
moveServosRF (gamma (RFx, RFY, RFZ), alpha (RFx, RFY, RFZ), bêta (RFx, RFY, RFZ));
moveServosRB (gamma (RBx, RBY, RBZ), alpha (RBx, RBY, RBZ), bêta (RBx, RBY, RBZ));
moveServosLF (gamma (LFx, daf, LLZOA), alpha (LFx, daf, LLZOA), bêta (LFx, daf, LLZOA));
moveServosLB (gamma (LBX, LBY, LBZ), alpha (LBX, LBY, LBZ), bêta (LBX, LBY, LBZ));
}
// Déplacer toutes jambes, mais avant droite
else if (== legNoMove 1) {
RBx = x + centerX;
RBY = centerY-y;
RBZ = z;
Lfx = x-centerX;
LFY = centerY + y;
LFZ = z;
LBX = x + centerX;
LBY = centerY + y;
LBZ = z;
// MoveServosRF (gamma (RFx, RFY, RFZ), alpha (RFx, RFY, RFZ), bêta (RFx, RFY, RFZ));
moveServosRB (gamma (RBx, RBY, RBZ), alpha (RBx, RBY, RBZ), bêta (RBx, RBY, RBZ));
moveServosLF (gamma (LFx, daf, LLZOA), alpha (LFx, daf, LLZOA), bêta (LFx, daf, LLZOA));
moveServosLB (gamma (LBX, LBY, LBZ), alpha (LBX, LBY, LBZ), bêta (LBX, LBY, LBZ));
}
// Déplacer toutes jambes, mais de retour
else if (== legNoMove 2) {
RFx = x-centerX;
JPV = centerY-y;
RFZ = z;
Lfx = x-centerX;
LFY = centerY + y;
LFZ = z;
LBX = x + centerX;
LBY = centerY + y;
LBZ = z;
moveServosRF (gamma (RFx, RFY, RFZ), alpha (RFx, RFY, RFZ), bêta (RFx, RFY, RFZ));
// MoveServosRB (gamma (RBx, RBY, RBZ), alpha (RBx, RBY, RBZ), bêta (RBx, RBY, RBZ));
moveServosLF (gamma (LFx, daf, LLZOA), alpha (LFx, daf, LLZOA), bêta (LFx, daf, LLZOA));
moveServosLB (gamma (LBX, LBY, LBZ), alpha (LBX, LBY, LBZ), bêta (LBX, LBY, LBZ));
}
// Déplacer toutes jambes, mais avant gauche
else if (== legNoMove 3) {
RFx = x-centerX;
JPV = centerY-y;
RFZ = z;
RBx = x + centerX;
RBY = centerY-y;
RBZ = z;
LBX = x + centerX;
LBY = centerY + y;
LBZ = z;
moveServosRF (gamma (RFx, RFY, RFZ), alpha (RFx, RFY, RFZ), bêta (RFx, RFY, RFZ));
moveServosRB (gamma (RBx, RBY, RBZ), alpha (RBx, RBY, RBZ), bêta (RBx, RBY, RBZ));
// MoveServosLF (gamma (LFx, daf, LLZOA), alpha (LFx, daf, LLZOA), bêta (LFx, daf, LLZOA));
moveServosLB (gamma (LBX, LBY, LBZ), alpha (LBX, LBY, LBZ), bêta (LBX, LBY, LBZ));
}
// Déplacer toutes jambes, mais l'arrière gauche
else if (== legNoMove 4) {
RFx = x-centerX;
JPV = centerY-y;
RFZ = z;
RBx = x + centerX;
RBY = centerY-y;
RBZ = z;
Lfx = x-centerX;
LFY = centerY + y;
LFZ = z;
moveServosRF (gamma (RFx, RFY, RFZ), alpha (RFx, RFY, RFZ), bêta (RFx, RFY, RFZ));
moveServosRB (gamma (RBx, RBY, RBZ), alpha (RBx, RBY, RBZ), bêta (RBx, RBY, RBZ));
moveServosLF (gamma (LFx, daf, LLZOA), alpha (LFx, daf, LLZOA), bêta (LFx, daf, LLZOA));
// MoveServosLB (gamma (LBX, LBY, LBZ), alpha (LBX, LBY, LBZ), bêta (LBX, LBY, LBZ));
}
}
// Les travaux en cours, ne fait rien en ce moment
tour (int étapes, le temps d'int) {
à double z = 3;
à double dz = -2;
smoothFullMove (2, -1, z, 2,1, z, 25 * 2,10);
SmoothMove (4, LBX, LBY, z + dz, étapes, le temps);
SmoothMove (4, LBX-2, LBY * atan (LBX / LBY), z + dz, étapes, le temps);
retard (3000);
}
/ * sineWalk void (de temps int, double INCR, int étapes, double, double z r) {
tNow = millis ();
à double Dely = 1;
à double delX = 1;
à double Delz = 1;
// amplitude de l'onde sinusoïdale
r = 1;
si (tNow-dit> temps) {
si (xVal <pi / 4) {
fullMove (xVal, r * sin (xVal), z);
xVal + = incr;
Serial.println ("si déclaration d'une");
}
else if (xVal> = 3.14 / 4 && xVal <3.14 / 2) {
partMove (R * cos (xval), r * sin (xVal), z, 4);
SmoothMove (4, LBX, LBY, LBZ-Delz, le temps / 2, étapes);
xVal + = incr;
Serial.println ("si déclaration de deux");
}
autre{
xVal = 0;
Serial.println ("si la déclaration de réinitialisation");
}
dit = tNow;
}
} * /
- adafruit_support_bill
- Posts: 88149
- Joined: Sat Feb 07, 2009 10:11 am
Re: hexapode avec arduino shield adafruit
The code you posted appears to use the serial port for commands. This shield will allow you to communicate via the serial port using Bluetooth.hello I will want to know if code for hexapod walking with a remote control ?
https://www.adafruit.com/products/1628
- ALBAN1978
- Posts: 24
- Joined: Sat Jan 30, 2016 6:01 pm
Re: hexapode avec arduino shield adafruit
merci pour l infoadafruit_support_bill wrote:The code you posted appears to use the serial port for commands. This shield will allow you to communicate via the serial port using Bluetooth.hello I will want to know if code for hexapod walking with a remote control ?
https://www.adafruit.com/products/1628
- ALBAN1978
- Posts: 24
- Joined: Sat Jan 30, 2016 6:01 pm
Re: hexapode avec arduino shield adafruit
bonjour comment faire pour ajouté ma carte adafruit Shields a mon programme ? car sa ne marche pas.merci pour vos reponce.
#include <Adafruit_PWMServoDriver.h>
#include <Adafruit_PWMServoDriver.h>
Code: Select all
#include <Servo.h>
Servo hancheAD; // Déclaration des moteurs
Servo femurAD;
Servo patteAD;
Servo hancheRG;
Servo femurRG;
Servo patteRG;
Servo hancheAG;
Servo femurAG;
Servo patteAG;
Servo hancheRD;
Servo femurRD;
Servo patteRD;
int distD, distG, distM, trig = 48, echo = 49; // Déclaration des variables de distance Droite Gauche et Mileu
void setup() {
hancheAD.attach(0); // déclaration des servos AD = Avant Droit RG = aRrière Gauche
femurAD.attach(1);
patteAD.attach(2);
hancheRG.attach(9);
femurRG.attach(10);
patteRG.attach(11);
hancheAG.attach(3);
femurAG.attach(4);
patteAG.attach(5);
hancheRD.attach(6);
femurRD.attach(7);
patteRD.attach(8);
}
void loop() {
repos();
delay(1000);
marcheAV(500);
}
void repos(){ // position au démarrage du robot
femurAD.write(180); // Monter fémur avant droit
delay(150); // Laisser le temps au fémur de monter
patteAD.write(180); // Patte à la verticale
hancheAD.write(90); // position repos à 45° par rapport au socle
femurAD.write(90); // Descendre fémur
delay(150);
femurRG.write(0);
patteRG.write(0);
hancheRG.write(90);
femurRG.write(90);
delay(150);
femurAG.write(0);
delay(150);
patteAG.write(0);
hancheAG.write(90);
femurAG.write(90);
delay(150);
femurRD.write(180);
delay(150);
patteRD.write(180);
hancheRD.write(90);
femurRD.write(90);
delay(150);
}
void marcheAV(int vitesse){
patteAD.write(180);
femurAD.write(180); // Monte Fémur avant droit et arriere gauche.
femurRG.write(0);
delay(vitesse);
hancheAD.write(100); // Avance les hanches avant droite et arrière gauche
hancheRG.write(80);
hancheRD.write(80); // Recule les hanches avant gauche et arrière droite
hancheAG.write(100);
delay(vitesse);
femurAD.write(90);
femurRG.write(90);
delay(vitesse);
femurRD.write(180);
femurAG.write(0);
delay(vitesse);
hancheAD.write(80);
hancheRG.write(100);
hancheAG.write(80);
hancheRD.write(100);
delay(vitesse);
femurRD.write(90);
femurAG.write(90);
delay(vitesse);
}
- adafruit_support_bill
- Posts: 88149
- Joined: Sat Feb 07, 2009 10:11 am
Re: hexapode avec arduino shield adafruit
I don't understand the question. Google Translate does not always work very well.hello how to added my adafruit map Shields my program? because its not pas.merci walking for your reponce .
- ALBAN1978
- Posts: 24
- Joined: Sat Jan 30, 2016 6:01 pm
Re: hexapode avec arduino shield adafruit
adafruit_support_bill wrote:I don't understand the question. Google Translate does not always work very well.hello how to added my adafruit map Shields my program? because its not pas.merci walking for your reponce .
comment ajouté ma carte adafruit a mon code?
- Disciple
- Posts: 852
- Joined: Tue Jan 06, 2015 8:13 pm
Re: hexapode avec arduino shield adafruit
I think the question is how to adapt the code to function using the servo shield. The tutorial might be helpful.
Hallelujah!
Disciple
Hallelujah!
Disciple
- adafruit_support_bill
- Posts: 88149
- Joined: Sat Feb 07, 2009 10:11 am
Re: hexapode avec arduino shield adafruit
Yes. The tutorial is the best place to start. https://learn.adafruit.com/adafruit-16- ... rvo-shield
Also look at the example code in the library: https://github.com/adafruit/Adafruit-PW ... er-Library
You will need to replace the
with:
You will also need to add:
All of the calls to "attach()" in your setup are not necessary.
You will need to convert all the calls to servo.write() onto calls to pwm.setPWM().
https://learn.adafruit.com/adafruit-16- ... mfreq-freq
Also look at the example code in the library: https://github.com/adafruit/Adafruit-PW ... er-Library
You will need to replace the
Code: Select all
#include <Servo.h>
Code: Select all
#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>
Code: Select all
// called this way, it uses the default address 0x40
Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();
// you can also call it with a different address you want
//Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver(0x41);
// Depending on your servo make, the pulse width min and max may vary, you
// want these to be as small/large as possible without hitting the hard stop
// for max range. You'll have to tweak them as necessary to match the servos you
// have!
#define SERVOMIN 150 // this is the 'minimum' pulse length count (out of 4096)
#define SERVOMAX 600 // this is the 'maximum' pulse length count (out of 4096)
You will need to convert all the calls to servo.write() onto calls to pwm.setPWM().
https://learn.adafruit.com/adafruit-16- ... mfreq-freq
Please be positive and constructive with your questions and comments.