Difference between revisions of "Main Page"

From
Jump to: navigation, search
(Le 3 leggi della robotica)
(Informazioni e materiale utile)
 
(92 intermediate revisions by the same user not shown)
Line 1: Line 1:
   ____ ___  _  _ _____ _  _ ____  ___ _____    
+
 
   / ___/ _ \| \ | |_  _| | | | __ ) / _ \_  _|  
+
   ____ ___  _  _ _____ _  _ ____  ___ _____ ____
  | |  | | | |  \| | | | | | | |  _ \| | | || |    
+
   / ___/ _ \| \ | |_  _| | | | __ ) / _ \_  _/ ___|
  | |__| |_| | |\  | | | | |_| | |_) | |_| || |  
+
  | |  | | | |  \| | | | | | | |  _ \| | | || | \___ \
   \____\___/|_| \_| |_|  \___/|____/ \___/ |_|  
+
  | |__| |_| | |\  | | | | |_| | |_) | |_| || | ___) |
 +
   \____\___/|_| \_| |_|  \___/|____/ \___/ |_| |____/
 
                                                                          
 
                                                                          
               CONTUbernio roBOTics
+
               '''CONTUbernio robotics and roBOTS'''
 +
 
 +
----
  
 
= ROBOTS =
 
= ROBOTS =
Line 22: Line 25:
 
* ...
 
* ...
  
== THYMIO ==
+
= THYMIO =
=== Programmi preimpostati ===
+
== Programmi preimpostati ==
  
 
{| class="wikitable"
 
{| class="wikitable"
 +
|+Programmi preimpostati sui thymio
 +
 
! COMPORTAMENTO !! COLORE!! SPIEGAZIONE
 
! COMPORTAMENTO !! COLORE!! SPIEGAZIONE
 
|-
 
|-
Line 38: Line 43:
 
|-
 
|-
 
! CURIOSO
 
! CURIOSO
| bianco || inseguitore di linea
+
| blu || inseguitore di linea
 
|-
 
|-
 
! OBBEDIENTE
 
! OBBEDIENTE
Line 47: Line 52:
 
|}
 
|}
  
 +
# [https://www.youtube.com/watch?v=BwkZ-Df0hdg Découverte du robot éducatif Thymio 2]
 
# [https://www.thymio.org/it:thymiostarting iniziare con il thymio]
 
# [https://www.thymio.org/it:thymiostarting iniziare con il thymio]
  
=== Inseguitore di linea ===
+
== VPL base ==
 +
 
 +
=== introduzione ===
  
La traccia deve essere almeno larga 4 cm con alto contrasto rispetto al terreno. Il meglio è nero su bianco.
+
Alcuni video sul THYMIO e sulla programmazione  con il VPL (Visual Programming Language)
Il livello di riconoscimento della traccia può essere calibrato quando la modalità 'Investigatore' viene attivata:
 
  
* Premere simultaneamente entrambe le frecce avanti e indietro con i sensori inferiori sulla traccia, per calibrare il livello del nero.
+
# [https://www.youtube.com/watch?v=Qc6nL8twWSI Introduction au robot Thymio (1/4) Thymio et ses comportements de base]
* Premere simultaneamente entrambe le frecce destra e sinistra con i sensori inferiori su un'area bianca per calibrare il livello del bianco.
+
# [https://www.youtube.com/watch?v=dA-BW38kl6E Introduction au robot Thymio (2/4) Thymio et ses comportements de base]
 +
# [https://www.youtube.com/watch?v=l2JRdcBNIdY Introduction au robot Thymio (3/4) Thymio et ses comportements de base]
 +
# [https://www.youtube.com/watch?v=IpL5k78kXVI Introduction au robot Thymio (4/4) Thymio et ses comportements de base]
  
=== SUMO ===
+
== VPL avanzato ==
 +
 
 +
# https://www.thymio.org/it:thymiovpl
 +
#
 +
 
 +
== Inseguitore di linea ==
 +
 
 +
La traccia deve essere almeno larga 4 cm con alto contrasto rispetto al terreno; meglio è '''nero su bianco'''.
 +
'''Il livello di riconoscimento della traccia può essere calibrato''' quando la modalità 'Investigatore' viene attivata:
 +
'''
 +
* Premere simultaneamente entrambe le '''frecce avanti e indietro con i sensori inferiori sulla traccia, per calibrare il livello del nero'''.
 +
* Premere simultaneamente entrambe le '''frecce destra e sinistra con i sensori inferiori su un'area bianca per calibrare il livello del bianco'''.
 +
 
 +
== SUMO ==
 
2 robot su un ring lottano per spingere l'avversario fuori dal ring
 
2 robot su un ring lottano per spingere l'avversario fuori dal ring
 +
 +
* https://www.youtube.com/watch?v=gIYMAymGzdI
 +
* https://www.youtube.com/watch?v=3tguWcKTXQI
 +
* https://www.youtube.com/watch?v=suyPkO0apak
  
 
Le regole:
 
Le regole:
Line 71: Line 97:
 
# programmare il robot per evitare sia spinto fuori dal ring
 
# programmare il robot per evitare sia spinto fuori dal ring
  
== CONTUBOT1 ==
+
= Informazioni e materiale utile =
 +
* [[Robotica EXTRAcurricolare]]
 +
* [[Robotica CURRICOLARE]]
 +
* [[Strumenti e spunti]]
  
=== Hardware ===
+
= Elettricità ed elettronica =
  
'''PIN ALIMENTAZIONE'''
+
== pile e generatori ==
 +
=== generatori in serie ===
  
{| class="wikitable"
+
<math>V=V_1+V_2</math>
|- style="font-style: italic; color: RED;"
+
 
| CONTROLLER
+
=== generatori in parallelo ===
| PIN
 
| DRIVER MOTORI
 
|- style="text-align:center;"
 
| (+) PILA
 
| VIN
 
| VM
 
|- style="text-align:center;"
 
| (-) PILA
 
| GND
 
| GND
 
|-
 
|- style="text-align:center;"
 
|
 
| 5V
 
| VCC
 
|-
 
|}
 
  
'''PIN DIGITALI'''
+
<math>I=I_1+I_2</math>
  
{| class="wikitable"
+
== resistenza e legge di ohm ==
|- style="font-style: italic; color: RED;"
+
=== resistenze in serie ===
| CONTROLLER
 
| PIN
 
| DRIVER MOTORI
 
|- style="text-align:center;"
 
| + pila
 
| VIN
 
| X
 
|- style="text-align:center;"
 
| - pila
 
| GND
 
| X
 
|- style="text-align:center;"
 
| RX
 
| D00
 
| X
 
|- style="text-align:center;"
 
| TX
 
| D01
 
| X
 
|- style="text-align:center;"
 
| ENC1
 
| D02
 
| X
 
|- style="text-align:center;"
 
| ENC2
 
| D03
 
| X
 
|- style="text-align:center;"
 
| ...
 
| D04
 
| -
 
|- style="text-align:center;"
 
| ...
 
| D05
 
| -
 
|- style="text-align:center;"
 
| ...
 
| D06
 
| -
 
|- style="text-align:center;"
 
| ...
 
| D07
 
| -
 
|- style="text-align:center;"
 
| ...
 
| D08
 
| -
 
|- style="text-align:center;"
 
| ...
 
| D09
 
| -
 
|- style="text-align:center;"
 
| ...
 
| D10
 
| -
 
|- style="text-align:center;"
 
| ...
 
| D11
 
| -
 
|- style="text-align:center;"
 
|- style="text-align:center;"
 
| ...
 
| D12
 
| -
 
|- style="text-align:center;"
 
| LED
 
| D13
 
| -
 
|}
 
  
=== Software ===
+
<math>R=R_1+R_2</math>
  
Programma CONTUBOT1 - EXPLORER
+
=== resistenze in parallelo ===
 +
<math>\frac{1}{R}=\frac{1}{R_1}+\frac{1}{R_2}</math>
  
<syntaxhighlight lang=c style="border:3px dashed blue">
+
=== partitore di tensione ===
  
#define pinLED 13
+
<math>I=I_1=I_2</math>
  
#define pinRX 0
+
<math>V_1=I * R_1</math>
#define pinTX 1
 
  
// MOTOR LEFT
+
<math>V_2=I * R_2</math>
// power
 
#define pinWheelL_PWMA 5
 
// dir
 
#define pinWheelL_AIN1 8
 
#define pinWheelL_AIN2 9
 
  
// MOTOR RIGHT
+
<math>V = I * R_1 +  I * R_2 \ </math>
// power
 
#define pinWheelR_PWMB 6
 
// dir
 
#define pinWheelR_BIN2 11
 
#define pinWheelR_BIN1 12
 
  
// ENCODER
+
<math>I = \frac{V_{in}}{R_1 + R_2}</math>
#define pinWheelL_ENCD 2
 
#define pinWheelR_ENCD 3
 
  
// ULTRASOUND
+
<math>V_2 = I * V_{in} = V_{in} * \frac{R_2}{R_1 + R_2} = V_{out} </math>
#define pinUS_TRIG 10
 
#define pinUS_ECHO 4
 
  
 +
= arduino =
 +
== ARDUINO NANO ==
  
#define pinWheelStandby 7
+
== DRIVER MOTORI ==
  
#define MAXPOWER 255
+
= CONTUBOT1 =
#define STEPS_L 5
 
#define STEPS_R 5
 
#define STEPS_B 10
 
#define STEPS_F 20
 
  
// A01,A02 // LEFT MOTOR
+
== Hardware ==
// B01,B02 // LEFT MOTOR
 
  
// Generally, you should use "unsigned long" for variables that hold time
+
=== Meccanica ===
// The value will quickly become too large for an int to store
 
const int Nt=2;
 
unsigned long t0_ms[Nt];        // will store last time LED was updated
 
  
// constants won't change :
+
# https://www.youtube.com/watch?v=uW8YVcBjPGU
long dt_ms[Nt];          // interval at which to do something
 
  
// ROBOT MODE
+
=== Schema dei collegamenti ===
  
#define EXPLORER 0 // explorer
+
NB
#define LFOLLOWER 1 // explorer
 
  
int robotMode=EXPLORER;
+
* controllare '''SEMPRE''' PRIMA DI COLLEGARE LE PILE altrimenti POTREBBE ROMPERSI IL CONTROLLORE
 +
* non utilizzare più di 9V
  
#define MAXSPEED 255
+
<graphviz>
int speedR=MAXSPEED;
+
digraph G4 {
int speedL=MAXSPEED;
+
rankdir=LR
 +
subgraph cluster_0 {
 +
color=green;
 +
rankdir=LR;
 +
node [style=filled,color=green];
 +
VIN;
 +
                V5V;
 +
GNDC;
  
 +
                D00;
 +
                D01;
  
void setup() {
+
                D02;
  // put your setup code here, to run once:
+
                D03;
  Serial.begin(57600);
+
             
 +
D04;
 +
D05;               
 +
D06;               
 +
D07;               
 +
D08;               
 +
D09;               
 +
D10;               
 +
D11;
 +
D12;                
  
  pinMode(LED_BUILTIN, OUTPUT);  
+
label = "controller";
 +
}
  
  pinMode(pinWheelL_AIN1, OUTPUT);  
+
subgraph cluster_1 {
  pinMode(pinWheelL_AIN2, OUTPUT);  
+
color=red;
 +
node [style=filled,color=red];
 +
VM;
 +
VCC;
 +
GNDD;     
 +
AIN1;
 +
AIN2;
 +
PWMA;
 +
BIN1;
 +
BIN2;
 +
PWMB;
 +
                STBY;
 +
A01;
 +
A02;
 +
B01;
 +
B02;
 +
label = "driver";
 +
}
 
    
 
    
  pinMode(pinWheelR_BIN1, OUTPUT);
 
  pinMode(pinWheelR_BIN2, OUTPUT); 
 
  
// SONAR
+
subgraph cluster_2 {
  pinMode(pinUS_TRIG, OUTPUT);  
+
                P [shape=Msquare];
  pinMode(pinUS_ECHO, INPUT);
+
                N [shape=Msquare];
//
+
color=green;
  pinMode(pinWheelStandby, OUTPUT);  
+
node [style=filled];
  digitalWrite(pinWheelStandby, HIGH);
+
label = "battery";
 
+
color=blue
  dt_ms[0] = 10;           // interval at which to avareage angular velocity
+
}
//Serial.println("> Ready!");
+
subgraph cluster_3 {
}
+
                ECHO;
 +
                TRIG;
 +
                VCCU;
 +
                GNDU;
 +
color=green;
 +
node [style=filled];
 +
label = "Ultrasuoni";
 +
}
  
void loop() {
 
  
  unsigned long t_ms = millis();
+
subgraph cluster_4 {
  //
+
                M1P;
  // check against collision system
+
                M1N;
  if (t_ms - t0_ms[2] >= dt_ms[2]) {
+
color=orange;
    // save the last time you did it
+
node [style=filled];
    t0_ms[0] = t_ms;
+
label = "Motore 1";
  int d=ultrasound();
+
}
 
 
        setMotor(255,255);
 
       
 
    if (d<10) {
 
      Serial.println(d); 
 
  
    }
+
subgraph cluster_5 {
  } 
+
                M2P;
}
+
                M2N;
 +
color=orange;
 +
node [style=filled];
 +
label = "Motore 2";
 +
}
  
  
// Function to Spin Right
 
void setMotor(int speedL, int speedR) {
 
  int speedLabs=abs(speedL);
 
  int speedRabs=abs(speedR);
 
  
  if (speedL>0) {
 
    digitalWrite(pinWheelL_AIN1, LOW);
 
    digitalWrite(pinWheelL_AIN2, HIGH);
 
  }
 
  
  if (speedL<0) {
 
    digitalWrite(pinWheelL_AIN1, HIGH);
 
    digitalWrite(pinWheelL_AIN2, LOW);
 
  }
 
  
 +
        P->VIN;
 +
        N->GNDC;
 +
        GNDC->GNDD;
 +
        VIN->VM;
 +
        V5V->VCC;
  
  if (speedR>0) {
+
V5V->VCCU;
    digitalWrite(pinWheelR_BIN1, LOW);
+
GNDC->GNDU;
    digitalWrite(pinWheelR_BIN2, HIGH);
+
D10->TRIG;
  }
+
ECHO->D04;
 +
D08->AIN1;
 +
D09->AIN2;
 +
D05->PWMA;
 +
D12->BIN1;
 +
D11->BIN2;
 +
D06->PWMB;
 +
D07->STBY;
  
  if (speedR<0) {
+
A01->M1P;
    digitalWrite(pinWheelR_BIN1, HIGH);
+
A02->M1N;
    digitalWrite(pinWheelR_BIN2, LOW);
+
B01->M2P;
  }
+
B02->M2N;
  
 
 
  // set power
 
  analogWrite(pinWheelL_PWMA, speedLabs);
 
  analogWrite(pinWheelR_PWMB, speedRabs);
 
 
}
 
}
 +
</graphviz>
  
long ultrasound() {
+
=== Tabella riassuntiva ===
digitalWrite(pinUS_TRIG, LOW);  // Added this line
 
  delayMicroseconds(2); // Added this line
 
  digitalWrite(pinUS_TRIG, HIGH);
 
//  delayMicroseconds(1000); - Removed this line
 
  delayMicroseconds(10); // Added this line
 
  digitalWrite(pinUS_TRIG, LOW);
 
  long duration_us = pulseIn(pinUS_ECHO, HIGH);
 
  long distance_cm = (duration_us/2) / 29.1;
 
  
  if (distance_cm<200) {
 
    Serial.println(distance_cm);
 
  }
 
    //delay(10);
 
    return(distance_cm);
 
}
 
  
</syntaxhighlight>
+
'''CONNESSIONI'''
 +
 
 +
== Software ==
 +
 
 +
* Programma [[robotExplorerContubot1simple]]
 +
 
 +
=== Esempi ===
 +
* https://www.youtube.com/watch?v=uW8YVcBjPGU

Latest revision as of 08:42, 4 February 2021

  ____ ___  _   _ _____ _   _ ____   ___ _____ ____
 / ___/ _ \| \ | |_   _| | | | __ ) / _ \_   _/ ___|
| |  | | | |  \| | | | | | | |  _ \| | | || | \___ \
| |__| |_| | |\  | | | | |_| | |_) | |_| || |  ___) |
 \____\___/|_| \_| |_|  \___/|____/ \___/ |_| |____/
                                                                       
              CONTUbernio robotics and roBOTS

ROBOTS

Le 3 leggi della robotica

  1. “Un robot non può recar danno a un essere umano né può permettere che a causa del proprio mancato intervento un essere umano riceva danno”.
  2. “Un robot deve obbedire agli ordini impartiti dagli esseri umani purché tali ordini non contravvengano alla prima legge”.
  3. “Un robot deve proteggere la propria esistenza purché questo non contrasti con la prima e la seconda legge”.

Isaac Asimov

Ok ma ...

  • cosa è un essere umano? (per un robot!)
  • cosa vuol dire "ricevere un ordine"?
  • come capire se un ordine provocherà un danno?
  • ...

THYMIO

Programmi preimpostati

Programmi preimpostati sui thymio
COMPORTAMENTO COLORE SPIEGAZIONE
ESPLORATORE giallo evita gli ostacoli
AMICONE verde segue un amico
FIFONE rosso cerca di non farsi acchiappare
CURIOSO blu inseguitore di linea
OBBEDIENTE fucsia si può controllare con le frecce
ATTENTO azzurro reagisce ai suoni
  1. Découverte du robot éducatif Thymio 2
  2. iniziare con il thymio

VPL base

introduzione

Alcuni video sul THYMIO e sulla programmazione con il VPL (Visual Programming Language)

  1. Introduction au robot Thymio (1/4) Thymio et ses comportements de base
  2. Introduction au robot Thymio (2/4) Thymio et ses comportements de base
  3. Introduction au robot Thymio (3/4) Thymio et ses comportements de base
  4. Introduction au robot Thymio (4/4) Thymio et ses comportements de base

VPL avanzato

  1. https://www.thymio.org/it:thymiovpl

Inseguitore di linea

La traccia deve essere almeno larga 4 cm con alto contrasto rispetto al terreno; meglio è nero su bianco. Il livello di riconoscimento della traccia può essere calibrato quando la modalità 'Investigatore' viene attivata:

  • Premere simultaneamente entrambe le frecce avanti e indietro con i sensori inferiori sulla traccia, per calibrare il livello del nero.
  • Premere simultaneamente entrambe le frecce destra e sinistra con i sensori inferiori su un'area bianca per calibrare il livello del bianco.

SUMO

2 robot su un ring lottano per spingere l'avversario fuori dal ring

Le regole:

  • si programmano i robot
  • una volta iniziata la gara non si possono toccare i robot
  • vince chi riesce a spingere l'altro fuori dal ring
  • si ha un pareggio se entro un certo tempo nessuno dei 2 riesce a spingere l'altro fuori

Obiettivi nel fare il programma:

  1. programmare il robot in modo che non esca dal ring
  2. programmare il proprio robot per spingere il robot avversario fuori dal ring
  3. programmare il robot per evitare sia spinto fuori dal ring

Informazioni e materiale utile

Elettricità ed elettronica

pile e generatori

generatori in serie

generatori in parallelo

resistenza e legge di ohm

resistenze in serie

resistenze in parallelo

partitore di tensione

arduino

ARDUINO NANO

DRIVER MOTORI

CONTUBOT1

Hardware

Meccanica

  1. https://www.youtube.com/watch?v=uW8YVcBjPGU

Schema dei collegamenti

NB

  • controllare SEMPRE PRIMA DI COLLEGARE LE PILE altrimenti POTREBBE ROMPERSI IL CONTROLLORE
  • non utilizzare più di 9V

The ImageMap extension is not installed.

Tabella riassuntiva

CONNESSIONI

Software

Esempi