Differences

This shows you the differences between two versions of the page.

Link to this comparison view

en:robot:intro [2009/03/05 12:28] – created raivo.sellen:robot:intro [2020/07/20 12:00] (current) – external edit 127.0.0.1
Line 1: Line 1:
 +====== Distance Lab robot ======
  
 +Robot can be equipped with different payload:
 +  * Manipulator (fig. 1)
 +  * Simple radar (fig. 2)
 +  * Camera
 +
 +{{http://www.mehhatroonika.ee/images/user/device/platvorm1.jpg|Platvorm1}}
 +
 +Fig. 1 Robot with manipulator
 +
 +{{http://www.mehhatroonika.ee/images/user/device/platvorm2.jpg|Platvorm2}}
 +
 +Fig. 2 Robot with IR radar
 +
 +
 +===== Basic navigation =====
 +
 +
 +<code c>
 +#define F_CPU 14745600UL //CPU Frequency (influences delay function)
 +#include <avr/io.h>
 +#include <util/delay.h>
 +
 +
 +int init(){
 + DDRD = 0xFF;// set port direction (output)
 + PORTD = 0x00;// initialize port
 +
 + //Pamperi lülitid
 + DDRC = 0x00;// set port direction (input)
 + PORTC = 0x00;// initialize port 
 +
 + DDRA = 0x00;// set port direction (input)
 + PORTA = 0x00;// initialize port
 +
 + DDRB = 0xFF;// set port direction (output)
 + PORTB = 0x00;// initialize port
 +
 + DDRG = 0xFF;  // set port direction (output)
 + PORTG = 0x00;// initialize port - pins-s low
 +return 0;
 +}
 +
 +int edasi(){
 + PORTD=0x02; //vasak edasi
 + PORTB=0x80; //parem edasi
 +return 0;
 +}
 +
 +int tagasi(){
 + PORTD=0x01; //vasak tagasi
 + PORTB=0x10; //parem tagasi
 +return 0;
 +}
 +
 +int stop(){
 + PORTD=0x00; //vasak stop
 + PORTB=0x00; //parem stop
 +return 0;
 +}
 +
 +int poore_vasak(){
 + PORTD=0x01; //vasak tagasi
 + PORTB=0x80; //parem edasi
 +return 0;
 +}
 +
 +int poore_parem(){
 + PORTD=0x02; //vasak edasi
 + PORTB=0x10; //parem tagasi
 +return 0;
 +}
 +
 +int main (void){
 +
 + init();
 +
 + while(1){
 +
 + edasi();
 +
 + if (bit_is_set(PINA, 0)||bit_is_set(PINA, 1)) {
 + tagasi();
 + _delay_ms(500);
 + poore_parem();
 + _delay_ms(1000);
 + }
 +
 + if (bit_is_set(PINA, 2)||bit_is_set(PINA, 3)) {
 + tagasi();
 + _delay_ms(500);
 + poore_vasak();
 + _delay_ms(1000);
 + }
 +
 + if (bit_is_set(PINC, 4)||bit_is_set(PINC, 5)||bit_is_set(PINC, 6)||bit_is_set(PINC, 7)) {
 + stop();
 + _delay_ms(1000);
 + }
 + }
 +}
 +</code>
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0