Home » Archives for macerobotics » Page 7

Author: macerobotics

Le robot MRPiZ en langage C

Un tutoriel pour programmer le robot mobile MRPiZ en langage C.

Lien pour l’API C : https://github.com/macerobotics/MRPiZ/tree/master/Software/C

Les fichiers doivent être placer dans des répertoires:

  • les fichiers .c dans le répertoire sources
  • les fichiers .h dans le répertoire header

 

Exemple n°1 : simple déplacement

Un exemple pour déplacer le robot MRPiZ:

[pastacode lang=”c” manual=”%23include%20%22MRPiZ.h%22%0A%0A%0Aint%20main(int%20argc%2C%20char*%20argv%5B%5D)%0A%7B%0A%0A%20%20init()%3B%0A%0A%20%20forward(25)%3B%0A%0A%20%20sleep(3)%3B%0A%0A%20%20back(25)%3B%0A%0A%20%20sleep(3)%3B%0A%0A%20%20stop()%3B%0A%7D” message=”” highlight=”” provider=”manual”/]

Compilation du fichier :

[pastacode lang=”c” manual=”gcc%20sources%2F*.c%20-I%20header%20-o%20Exemple1″ message=”” highlight=”” provider=”manual”/]

Exécution du programme :

[pastacode lang=”c” manual=”.%2FExemple1″ message=”” highlight=”” provider=”manual”/]

 

Exemple n°2 : lecture des capteurs laser

Un exemple pour la lecture des 3 capteurs ToF du robot :

[pastacode lang=”c” manual=”%23include%20%22MRPiZ.h%22%0A%0A%0Aint%20main(int%20argc%2C%20char*%20argv%5B%5D)%0A%7B%0Aint%20p2%2C%20p3%2C%20p4%3B%0Aint%20c%3D0%3B%0A%0A%20%20init()%3B%0A%0A%20%20for(c%3D0%3B%20c%20%3C%2010%3B%20c%2B%2B)%0A%20%20%7B%0A%20%20%20%20p2%20%3D%20proxSensor(2)%3B%0A%20%20%20%20p3%20%3D%20proxSensor(3)%3B%0A%20%20%20%20p4%20%3D%20proxSensor(4)%3B%0A%0A%20%20%20%20printf(%22Capteur%20p1%3D%25d%5Cn%22%2C%20p2)%3B%0A%20%20%20%20printf(%22Capteur%20p2%3D%25d%5Cn%22%2C%20p3)%3B%0A%20%20%20%20printf(%22Capteur%20p3%3D%25d%5Cn%22%2C%20p4)%3B%0A%20%20%0A%20%20%20%20sleep(1)%3B%0A%20%20%7D%0A%20%20%0A%7D” message=”” highlight=”” provider=”manual”/]

Exemple n°3 : lecture des encodeurs

Un exemple pour la lecture des 2 encodeurs du robot.

[pastacode lang=”c” manual=”%23include%20%22MRPiZ.h%22%0A%0A%0Aint%20main(int%20argc%2C%20char*%20argv%5B%5D)%0A%7B%0Aint%20eL%2C%20eR%3B%0Aint%20c%3B%0A%0A%20%20init()%3B%0A%0A%20%20for(c%3D0%3B%20c%20%3C%2010%3B%20c%2B%2B)%0A%20%20%7B%0A%09%20%20%0A%09forward(30)%3B%0A%09%0A%20%20%20%20eL%20%3D%20encoderLeft()%3B%0A%20%20%20%20eR%20%3D%20encoderRight()%3B%0A%0A%20%20%20%20printf(%22encoder%20left%3D%25d%5Cn%22%2C%20eL)%3B%0A%20%20%20%20printf(%22encoder%20right%3D%25d%5Cn%22%2C%20eR)%3B%0A%0A%20%20%20%20sleep(1)%3B%0A%20%20%7D%0A%20%20%0A%20%20stop()%3B%0A%0A%7D” message=”” highlight=”” provider=”manual”/]

 

Fin du tuto !

Control a mobile robot by using keyboard – Python

An example python program for control a mobile robot with keyboard:

  • keyboard control
  • serial communication

[pastacode lang=”python” manual=”%0A%23!%2Fusr%2Fbin%2Fpython%0A%23%20-*-%20coding%3A%20iso-8859-15%20-*-%0A%23%20Author%20%3A%20Mace%20Robotics%20(www.macerobotics.com)%0A%23%20Date%20%3A%2005%2F04%2F2020%0A%23%20Version%20%3A%200.1%0A%23%0Aimport%20serial%0Aimport%20keyboard%0Aimport%20time%0A%0Aprint(%22Control%20borvo%20with%20keyboard%22)%0A%0Aport%20%3D%20serial.Serial(‘COM6’)%0Aprint(port.name)%0A%0Aprint(%22wait..%22)%0Atry%3A%0A%20%20%23%20read%20keyboard%0A%20%20while%201%3A%0A%20%20%20%20if%20keyboard.is_pressed(‘8’)%3A%20%20%23%20if%20key%20’8’%20is%20pressed%20%0A%20%20%20%20%20%20print(‘forward’)%0A%20%20%20%20%20%20port.write(b’FOR!’)%0A%20%20%20%20%20%20time.sleep(0.5)%0A%20%20%20%20if%20keyboard.is_pressed(‘2’)%3A%20%20%23%20if%20key%20’2’%20is%20pressed%20%0A%20%20%20%20%20%20print(‘move%20back’)%0A%20%20%20%20%20%20port.write(b’BAC!’)%0A%20%20%20%20%20%20time.sleep(0.5)%0A%20%20%20%20if%20keyboard.is_pressed(‘4’)%3A%20%0A%20%20%20%20%20%20print(‘turn%20left’)%0A%20%20%20%20%20%20port.write(b’TUL!’)%09%20%0A%20%20%20%20%20%20time.sleep(0.5)%0A%20%20%20%20if%20keyboard.is_pressed(‘6’)%3A%20%20%0A%20%20%20%20%20%20print(‘turn%20right’)%0A%20%20%20%20%20%20port.write(b’TUR!’)%09%20%0A%20%20%20%20%20%20time.sleep(0.5)%0A%20%20%20%20if%20keyboard.is_pressed(‘5’)%3A%20%20%0A%20%20%20%20%20%20print(‘stop’)%0A%20%20%20%20%20%20port.write(b’STP!’)%09%20%0A%20%20%20%20%20%20time.sleep(0.5)%0A%0Aexcept%20KeyboardInterrupt%20as%20exception%3A%0A%20%20print(%22%5CnEnd%5Cn%22)%0A” message=”” highlight=”” provider=”manual”/]

Régulateur USB 5V pour dynamo de vélo

Un schéma électronique pour obtenir une tension 5V sur un connecteur USB à partir d’une dynamo de vélo. Une dynamo de vélo délivre une tension alternative monophasée de 6V et une puissance maximale de 3W.

Le schéma électronique

  • Pont de diode, diode zener 6.8V
  • Régulateur step-down LM2575,
  • Condensateur de sortie,
  • Led,
  • Connecteur USB

New design, quadruped – BORVO

Mace Robotics presents the new design for the BORVO quadruped robot, with more bio-inspired legs:

I use 2D CAD software (QCAD) for drawing the legs:

The robot uses 8 JX PDI-6221MG servo motors with a torque of 20 kg. Every leg is equipped with two servomotors with in parallel operation.

I use FreeCAD software to check the reverse kinematics calculations of the legs.

The robot uses a Teensys 3.5 microcontroller to program with Arduino IDE. For the moment, no inertial sensor or foot contacting sensors are used.