Aller au contenu


Beetlejuice

Inscrit(e) (le) 09 sept. 2012
Déconnecté Dernière activité nov. 22 2021 05:19
-----

Sujets que j'ai initiés

squelette robot humanoide

16 septembre 2012 - 10:57

Salut,

Je me demandais si l'un de vous aurait des schemas, dessin ou autre plans montrant comment est articulé un robot ...

A part quelque modèle de pince, je n'ai rien trouvé sur google .

Comment fabriquer une main, un bras, une jambe, etc ...



Merci

Image IPB

[Résolu] Comparaison de deux string qui ne fonctionne pas ;

12 septembre 2012 - 01:57

Salut,

Voila j'ai un petit soucis. J'ai modifier un robosapien en lui ajoutant une carte arduino 2009 .
Mon programme permet , soit de faire echo de la telecommande d'origine, soit de prendre le controle avec l'arduino.

Tout fonctionne bien, que ce soit avec la telecommande ou en envoyant des commande avec l'arduino ( interphaser entre le recepteur IR et la carte mere du robot ) .

Cependant pour mes test, je souhaite entrer des commandes dans le moniteur serie et c'est la que ça cloche :

L'entrée est bien stockée dans ma variable string , mais la condition if ne semble pas etre respectée pour que le changement de la valeur a envoyer a l' IR du robot se fasse :


if (inputString == "RSTurnRight") serialCommand= 0x80;


Avec des " serial.print " j'ai pu débugger et voir qu'effectivement la valeur de serialCommand ne change pas .

J'ai essayé :

if (inputString == "RSTurnRight")
{
serialCommand= 0x80;
}

Mais ça ne change rien ...

Quelqu'un a une idée de mon erreur ?

Voici le code complet :

int IRIn = 2;            // We will use an interrupt
int IROut= 3;            // Where the echoed command will be sent from

boolean RSEcho=true;      // Should Arduino Echo RS commands
boolean RSUsed=true;      // Has the last command been used
volatile int RSBit=9;     // Total bits of data
volatile int RSCommand;   // Single byte command from IR
int bitTime=516;          // Bit time (Theoretically 833 but 516)
                          // works for transmission and is faster
int last;                 // Previous command from IR
String inputString = "";         // a string to hold incoming data
boolean stringComplete = false;  // whether the string is complete
int serialCommand(0xEF); // Command sent via serial


void setup()                    
{
  pinMode(IRIn, INPUT);     
  pinMode(IROut, OUTPUT);
  pinMode(10,OUTPUT);
  digitalWrite(IROut,HIGH);
  attachInterrupt(0,RSReadCommand,RISING);
  last=0xEF; // Set last command as " noOp "
  Serial.begin(115200);
}

// Receive a bit at a time.
void RSReadCommand() 
{
  delayMicroseconds(833+208);  // about 1 1/4 bit times
  int bit=digitalRead(IRIn); 
  if (RSBit==9) 
  { // Must be start of new command
    RSCommand=0;
    RSBit=0;
    RSUsed=true;
  }
  if (RSBit<8) 
  { 
    RSCommand<<=1;
    RSCommand|=bit;
  }
  RSBit++;
  if (RSBit==9) RSUsed=false;
}

// send the whole 8 bits
void RSSendCommand(int command) {
  digitalWrite(IROut,LOW);
  delayMicroseconds(8*bitTime);
  for (int i=0;i<8;i++) {
    digitalWrite(IROut,HIGH);  
    delayMicroseconds(bitTime);
    if ((command & 128) !=0) delayMicroseconds(3*bitTime);
    digitalWrite(IROut,LOW);
    delayMicroseconds(bitTime);
    command <<= 1;
  }
  digitalWrite(IROut,HIGH);
  delay(250); // Give a 1/4 sec before next
}

void loop() 
{ 
  if (!RSUsed) 
  {
    if (RSCommand==0x8E && last==0x8E) 
    {
      RSEcho=!RSEcho;
    }
    last=RSCommand;
    // print code received from the remote
    Serial.print("IR Code : ");
    Serial.println(RSCommand);
    if (!RSEcho)
    {
      digitalWrite(10,HIGH);  // Turn on LED let us know we have control our wedge                                         
      Serial.println("Arduino control ON ");
    }

    else 
    {
      digitalWrite(10,LOW);   // No longer in control
      Serial.println("Arduino control OFF ");
      RSSendCommand(RSCommand);
    }

    RSUsed=true;
  }


  while (Serial.available()) 
  {
    // get the new byte:
    char inChar = (char)Serial.read(); 
    // add it to the inputString:
    inputString += inChar;
    // if the incoming character is a newline, set a flag
    // so the main loop can do something about it:
    if (inChar == '\n') 
    {
      Serial.print ("inputString value: " );
      Serial.println (inputString);

      if (inputString == "RSTurnRight") serialCommand= 0x80;
      if (inputString == "RSRightArmUp") serialCommand= 0x81;
      if (inputString == "RSRightArmOut") serialCommand= 0x82;
      if (inputString == "RSTiltBodyRight") serialCommand= 0x83;
      if (inputString == "RSRightArmDown") serialCommand= 0x84;
      if (inputString == "RSRightArmIn") serialCommand= 0x85;
      if (inputString == "RSWalkForward") serialCommand= 0x86;
      if (inputString == "RSWalkBackward") serialCommand= 0x87;
      if (inputString == "RSTurnLeft") serialCommand= 0x88;
      if (inputString == "RSLeftArmUp") serialCommand= 0x89;
      if (inputString == "RSLeftArmOut") serialCommand= 0x8A;
      if (inputString == "RSTiltBodyLeft") serialCommand= 0x8B;
      if (inputString == "RSLeftArmDown") serialCommand= 0x8C;
      if (inputString == "RSLeftArmIn") serialCommand= 0x8D;
      if (inputString == "RSStop") serialCommand= 0x8E;
      if (inputString == "RSWakeUp") serialCommand= 0xB1;
      if (inputString == "RSBurp") serialCommand= 0xC2;
      if (inputString == "RSRightHandStrike") serialCommand= 0xC0;
      if (inputString == "RSNoOp") serialCommand= 0xEF;
      Serial.print (" Value sent : " );
      Serial.println (serialCommand,HEX);

      RSSendCommand(serialCommand);
      Serial.println (" Command sent to robosapien " );
      // clear the string:
      inputString = "";
    }
  }
}


Presentation de Beetlejuice

12 septembre 2012 - 07:01

Salut a tous,

Je m'appelle Fred, 36 ans ( 37 dans deux mois ;) ), J'habite Sollies-Pont dans le var (83 ), Marier et pere de trois filles .


Niveau formation, j'ai uniquement infographie, mais etant très autodidacte, je me débrouille très bien dans les domaines de l'informatique .

Mon travail ... Eh bien aucun ! J'ai ouvert un cyber café qui est vite devenu aussi depannage informatique, centre de cours pour debutants et beaucoup d'autres services tel que des montages vidéo ou de la création de site web . Je l'ai gardé 5 ans est ça marchait très bien , malheureusement j'ai du fermer il y a 3 ans a cause d'une maladie articulaire qui fait qu'aujourd'hui je suis handicapé et ne peux plus travailler .

Mes passions, eh bien la robotique bien sur, la moto , l' informatique,l'electronique, et je m'ainteresse aussi a la domotique ; Mais tout cela est très lié :D

Les robots que je possede ... J'ai la base d'un cybot ( robot a 3 roues ) que j'ai équipé d'une carte arduino 2009 et de quelques capteurs pour le rendre autonome , et je viens de faire l'acquisition d'un robosapien V1 en panne pour seulement 5 euro ! qu'il a été très simple de réparer ( soudure seches ) et qui lui aussi c'est vu offrir une carte arduino et pour le moment un capteur IR sharp . Je commence tout juste a le découvrir, mais j'adore ce robot :D

En bref :

-Le film que vous préférez : Léon et pratiquement tous les films avec jean réno ou adam sandler

-Le roman que vous préférez : C'est quoi un roman ? Un truc sans image ? :rolleyes: Les ouvrages que je lis sont soit informatique, robotique, electronique , soit les BD moto comme le joe bar team .

-Qu'est ce qu'il faudrait faire dans le domaine de la robotique: Baisser le tarifs des pièces !

-Comment voyez vous la robotique dans le futur: Omniprésente . Et mangeuse d'emploi . Beaucoup d'androide d'aide a la personne .



Voila ! Wow, c'est la première fois que je fait une présentation aussi longue !