Projet de TPE !
#1
Posté 18 janvier 2012 - 04:29
Je m'explique :
Pour notre projet de TPE (moi et mes camarades ) nous avons prévu de faire un robot suiveur de ligne a l'aide de ce site : Ici (jusque la, rien de compliquer ^^) cependant un problème se pose.. nous voulons y ajouter un réflecteur optique cny70 afin qu'il suive bien une ligne, mais nous ne savons ni ou le placer, ni comment le programmer à l'aide du logiciel Picaxe Programming Editor et du programme déjà prêt a être ajouter (sans la partie concernant la cny70).
Si quelqu'un pouvez rapidement nous venir en aide ce serait vraiment sympa ^^
Merci d'avance
#3
Posté 14 février 2012 - 10:26
Donc apparemment réflecteur optique cny70 se branche sur de l'analogique ( c'est comme un capteur infrarouge sharp , et
détecteur d'obstacle ).
Après se qui serré bien , c'est de nous détallais le matériel que vous disposé , avec photo si possible , et aussi le code de
programmation que vous avais pu faire.
#4
Posté 15 février 2012 - 02:34
le matériel que je possède est le même que sur le lien que j'ai posté c'est à dire :
- PICAXE-28X1 Starter Pack
- L293D Motor Driver
- PICAXE Servo Upgrade Pack
- Sharp GP2D120 IR Sensor - 30cm / Analogique
2 Gear Motors with wheels (moteurs avec démultiplication et roues)
et enfin les cny70 !
une fois le tout monter le robot ressemble a peu près à ça (sans les réflecteurs optique) :
Pour la programmation voila ce que j'ai suivi :
main: readadc 0, b0 debug goto main Now take your hand in front of the robot´s head and notice how the variable b0 changes value. You can use the knowledge gained to decide what should happen and when (how close things should get before..) You may notice how things start to go "wrong" if stuff is too close to the "eyes"; The Sharp is made to work with objects 10-80 cm away. Things that are closer than 10 cm (4 inches) appear to be further way, which can be quite a challenge to program. You can get many other distance sensors that do not have this problem. However the Sharp is the cheapest, and easiest to program, so that's why I made such a "bad" choice for you, sorry <img src='http://www.robot-maker.com/forum/public/style_emoticons/default/wink.gif' class='bbc_emoticon' alt=';)' /> Look around and see what everyone else is using, before you decide on an upgrade. Now I advise you to put your robot up on a matchbox or similar, as the wheels will start turning. Enter this code into your editor, and press F5 while the robot is connected: high 4 low 5 One of the wheels should turn in one direction. Does your wheels turn forward? If so, this is the instruction for that wheel to turn forward. If the wheel is turning backwards, you can try this: low 4 high 5 To turn the other wheel, you need to enter high 6 low 7 (or the other way around for opposite direction.) What happens here is that by using only the options available to the microcontroller; power on or off (High / Low) on the pins, it is commanding the motor controller to set motor A or B in forward or reverse mode. low 4 low 5 low 6 low 7 stops all motors The servo you have already tried. All the way to one side is: servo 0, 75 wait 2 - the other side is: servo 0, 225 wait 2 - and centre: servo 0, 150 wait 2 Here is a small program that will (should, if all is well, and if you inserted the right parameters for high/low to suit your wiring to the motors) make the robot drive around, stop in front of things, look to each side to decide which is the best, turn that way, and drive towards new adventures. In the code I have made so called remarks: explaining you what is going on. You can write such comments or remarks yourself in the code, it is a good idea to keep track. They are written with an apostrophe (or single quote) sign. However, copying this text from here might alter that to something else, and you will have to fix that manually, sorry. Your programming editor has colour codes, that will help showing you what it recognizes as comments and what as code. Symbol dangerlevel = 70 ' how far away should thing be, before we react? symbol turn = 300 ' this sets how much should be turned symbol servo_turn = 700 ' This sets for how long time we should wait for the servo to turn (depending on it´s speed) before we measure distance main: ' the main loop readadc 0, b1 ' read how much distance ahead if b1 < dangerlevel then gosub nodanger ' if nothing ahead, drive forward else gosub whichway ' if obstacle ahead then decide which way is better end if goto main ' this ends the loop, the rest are only sub-routines nodanger:' this should be your combination to make the robot drive forward, these you most likely need to adjust to fit the way you have wired your robots motors high 5 : high 6 : low 4 : low 7 return whichway: gosub totalhalt ' first stop! 'Look one way: gosub lturn ' look to one side pause servo_turn ' wait for the servo to be finished turning readadc 0, b1 gosub totalhalt 'Look the other way: gosub rturn ' look to another side pause servo_turn ' wait for the servo to be finished turning readadc 0, b2 gosub totalhalt ' Decide which is the better way: if b1<b2 then gosub body_lturn else gosub body_rturn end if return body_lturn: high 6 : low 5 : low 7 : high 4 ' this should be your combination that turns the robot one way pause turn : gosub totalhalt return body_rturn: high 5 : low 6 : low 4 : high 7 ' this should be your combination that turns the robot the other way pause turn : gosub totalhalt return rturn: servo 0, 100 ' look to one side return lturn: servo 0, 200 ' look to the other side return totalhalt: low 4 : low 5 : low 6 : low 7 ' low on all 4 halts the robot! Servo 0,150 ' face forward wait 1 ' freeze all for one second return
voila ...
j'ai une autre question.. si les réflecteur optique cny70 se branche sur de l'analogique comment faudra il les souder pour qu'elle soit relier a la picaxe ?
#5
Posté 15 février 2012 - 05:11
j'ai une autre question.. si les réflecteur optique cny70 se branche sur de l'analogique comment faudra il les souder pour qu'elle soit relier a la picaxe ?
Pour le réflecteur optique cny70 vous le possédé en se moment???
car perso je ne les jamais testé donc ainsi que la carte picaxe.
Mais j'ai trouvais un lien qui vous indique les différente pin et broche , voila le lien
PS: veiller prendre la balise celle si pour implanté votre code sur la page ça ferra plus propre , merci.
#6
Posté 15 février 2012 - 06:08
d'apres le lien que vous m'avez envoyer il semble que les cny70 se place sur de l'analogique mais ou exactement je ne sais pas..
de plus j'aimerais savoir comment relier les pattes des cny70 a l'endroit ou elle doivent être souder.
#8
Posté 08 mai 2012 - 07:35
Il en est où ce projet maintenant ??
Si mon commentaire vous a plus laissez nous un avis !
Nouveau sur Robot Maker ?
Jetez un oeil aux blogs, aux tutoriels, aux ouvrages, au robotscope aux articles, à la boutique et aux différents services disponible !
En attendant qu'une bibliothèque de fichiers 3D soit mise en place n'hésitez pas à demander si vous avez besoin du fichier 3D d'un des produits de la boutique... On l'a peut être !
Si vous souhaitez un robot pilotable par internet n'hésitez pas à visiter www.vigibot.com et à lire le sous forum dédié à vigibot!
Répondre à ce sujet
0 utilisateur(s) li(sen)t ce sujet
0 members, 0 guests, 0 anonymous users