Difference between revisions of "Main Page"

From
Jump to: navigation, search
(THYMIO)
(Informazioni e materiale utile)
 
(83 intermediate revisions by the same user not shown)
Line 1: Line 1:
   ____ ___  _  _ _____ _  _ ____  ___ _____    
+
 
   / ___/ _ \| \ | |_  _| | | | __ ) / _ \_  _|  
+
   ____ ___  _  _ _____ _  _ ____  ___ _____ ____
  | |  | | | |  \| | | | | | | |  _ \| | | || |    
+
   / ___/ _ \| \ | |_  _| | | | __ ) / _ \_  _/ ___|
  | |__| |_| | |\  | | | | |_| | |_) | |_| || |  
+
  | |  | | | |  \| | | | | | | |  _ \| | | || | \___ \
   \____\___/|_| \_| |_|  \___/|____/ \___/ |_|  
+
  | |__| |_| | |\  | | | | |_| | |_) | |_| || | ___) |
 +
   \____\___/|_| \_| |_|  \___/|____/ \___/ |_| |____/
 
                                                                          
 
                                                                          
               CONTUbernio roBOTics
+
               '''CONTUbernio robotics and roBOTS'''
 +
 
 +
----
  
 
= ROBOTS =
 
= ROBOTS =
Line 26: Line 29:
  
 
{| 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
+
# [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]
  
Line 54: Line 59:
 
=== introduzione ===
 
=== introduzione ===
  
# [https://www.youtube.com/watch?v=Qc6nL8twWSI lezione 1/4]
+
Alcuni video sul THYMIO e sulla programmazione  con il VPL (Visual Programming Language)
# [https://www.youtube.com/watch?v=dA-BW38kl6E lezione 2/4]
+
 
# [https://www.youtube.com/watch?v=l2JRdcBNIdY lezione 3/4]
+
# [https://www.youtube.com/watch?v=Qc6nL8twWSI Introduction au robot Thymio (1/4) Thymio et ses comportements de base]
# [https://www.youtube.com/watch?v=IpL5k78kXVI lezione 4/4]
+
# [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]
  
 
== VPL avanzato ==
 
== VPL avanzato ==
Line 66: Line 73:
 
== Inseguitore di linea ==
 
== Inseguitore di linea ==
  
La traccia deve essere almeno larga 4 cm con alto contrasto rispetto al terreno. Il meglio è nero su bianco.
+
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:
+
'''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 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.
+
* Premere simultaneamente entrambe le '''frecce destra e sinistra con i sensori inferiori su un'area bianca per calibrare il livello del bianco'''.
  
 
== SUMO ==
 
== SUMO ==
Line 89: Line 96:
 
# programmare il proprio robot per spingere il robot avversario fuori dal ring
 
# programmare il proprio robot per spingere il robot avversario fuori dal ring
 
# programmare il robot per evitare sia spinto fuori dal ring
 
# programmare il robot per evitare sia spinto fuori dal ring
 +
 +
= Informazioni e materiale utile =
 +
* [[Robotica EXTRAcurricolare]]
 +
* [[Robotica CURRICOLARE]]
 +
* [[Strumenti e spunti]]
  
 
= Elettricità ed elettronica =
 
= Elettricità ed elettronica =
Line 94: Line 106:
 
== pile e generatori ==
 
== pile e generatori ==
 
=== generatori in serie ===
 
=== generatori in serie ===
 +
 +
<math>V=V_1+V_2</math>
 +
 
=== generatori in parallelo ===
 
=== generatori in parallelo ===
 +
 +
<math>I=I_1+I_2</math>
  
 
== resistenza e legge di ohm ==
 
== resistenza e legge di ohm ==
 
=== resistenze in serie ===
 
=== resistenze in serie ===
=== resistenze in parallelo ===
 
=== partitore di tensione ===
 
  
= arduino =
+
<math>R=R_1+R_2</math>
== ARDUINO NANO ==
 
  
== DRIVER MOTORI ==
+
=== resistenze in parallelo ===
 +
<math>\frac{1}{R}=\frac{1}{R_1}+\frac{1}{R_2}</math>
  
= CONTUBOT1 =
+
=== partitore di tensione ===
  
== Hardware ==
+
<math>I=I_1=I_2</math>
  
'''PIN ALIMENTAZIONE'''
+
<math>V_1=I * R_1</math>
  
{| class="wikitable"
+
<math>V_2=I * R_2</math>
|- style="font-style: italic; color: RED;"
 
| CONTROLLER
 
| 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>V = I * R_1 +  I * R_2 \ </math>
  
{| class="wikitable"
+
<math>I = \frac{V_{in}}{R_1 + R_2}</math>
|- style="font-style: italic; color: RED;"
 
| 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>V_2 = I * V_{in} = V_{in} * \frac{R_2}{R_1 + R_2} = V_{out} </math>
  
Programma CONTUBOT1 - EXPLORER
+
= arduino =
 +
== ARDUINO NANO ==
  
<syntaxhighlight lang=c style="border:3px dashed blue">
+
== DRIVER MOTORI ==
  
#define pinLED 13
+
= CONTUBOT1 =
  
#define pinRX 0
+
== Hardware ==
#define pinTX 1
 
  
// MOTOR LEFT
+
=== Meccanica ===
// power
 
#define pinWheelL_PWMA 5
 
// dir
 
#define pinWheelL_AIN1 8
 
#define pinWheelL_AIN2 9
 
  
// MOTOR RIGHT
+
# https://www.youtube.com/watch?v=uW8YVcBjPGU
// power
 
#define pinWheelR_PWMB 6
 
// dir
 
#define pinWheelR_BIN2 11
 
#define pinWheelR_BIN1 12
 
  
// ENCODER
+
=== Schema dei collegamenti ===
#define pinWheelL_ENCD 2
 
#define pinWheelR_ENCD 3
 
  
// ULTRASOUND
+
NB
#define pinUS_TRIG 10
 
#define pinUS_ECHO 4
 
  
 +
* controllare '''SEMPRE''' PRIMA DI COLLEGARE LE PILE altrimenti POTREBBE ROMPERSI IL CONTROLLORE
 +
* non utilizzare più di 9V
  
#define pinWheelStandby 7
+
<graphviz>
 +
digraph G4 {
 +
rankdir=LR
 +
subgraph cluster_0 {
 +
color=green;
 +
rankdir=LR;
 +
node [style=filled,color=green];
 +
VIN;
 +
                V5V;
 +
GNDC;
  
#define MAXPOWER 255
+
                D00;
#define STEPS_L 5
+
                D01;
#define STEPS_R 5
 
#define STEPS_B 10
 
#define STEPS_F 20
 
  
// A01,A02 // LEFT MOTOR
+
                D02;
// B01,B02 // LEFT MOTOR
+
                D03;
 +
             
 +
D04;
 +
D05;               
 +
D06;               
 +
D07;               
 +
D08;               
 +
D09;               
 +
D10;               
 +
D11;
 +
D12;               
  
// Generally, you should use "unsigned long" for variables that hold time
+
label = "controller";
// 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 :
+
subgraph cluster_1 {
long dt_ms[Nt];           // interval at which to do something
+
color=red;
 +
node [style=filled,color=red];
 +
VM;
 +
VCC;
 +
GNDD;     
 +
AIN1;
 +
AIN2;
 +
PWMA;
 +
BIN1;
 +
BIN2;
 +
PWMB;
 +
                STBY;
 +
A01;
 +
A02;
 +
B01;
 +
B02;
 +
label = "driver";
 +
}
 +
 
  
// ROBOT MODE
+
subgraph cluster_2 {
 +
                P [shape=Msquare];
 +
                N [shape=Msquare];
 +
color=green;
 +
node [style=filled];
 +
label = "battery";
 +
color=blue
 +
}
 +
subgraph cluster_3 {
 +
                ECHO;
 +
                TRIG;
 +
                VCCU;
 +
                GNDU;
 +
color=green;
 +
node [style=filled];
 +
label = "Ultrasuoni";
 +
}
  
#define EXPLORER 0 // explorer
 
#define LFOLLOWER 1 // explorer
 
  
int robotMode=EXPLORER;
+
subgraph cluster_4 {
 +
                M1P;
 +
                M1N;
 +
color=orange;
 +
node [style=filled];
 +
label = "Motore 1";
 +
}
  
#define MAXSPEED 255
+
subgraph cluster_5 {
int speedR=MAXSPEED;
+
                M2P;
int speedL=MAXSPEED;
+
                M2N;
 +
color=orange;
 +
node [style=filled];
 +
label = "Motore 2";
 +
}
  
  
void setup() {
 
  // put your setup code here, to run once:
 
  Serial.begin(57600);
 
  
  pinMode(LED_BUILTIN, OUTPUT);
 
  
  pinMode(pinWheelL_AIN1, OUTPUT);
 
  pinMode(pinWheelL_AIN2, OUTPUT);
 
 
 
  pinMode(pinWheelR_BIN1, OUTPUT);
 
  pinMode(pinWheelR_BIN2, OUTPUT); 
 
  
// SONAR
+
        P->VIN;
  pinMode(pinUS_TRIG, OUTPUT);  
+
        N->GNDC;
  pinMode(pinUS_ECHO, INPUT);
+
        GNDC->GNDD;
//
+
        VIN->VM;
  pinMode(pinWheelStandby, OUTPUT);  
+
        V5V->VCC;
  digitalWrite(pinWheelStandby, HIGH);
 
 
 
  dt_ms[0] = 10;          // interval at which to avareage angular velocity
 
//Serial.println("> Ready!");
 
}
 
  
void loop() {
+
V5V->VCCU;
 +
GNDC->GNDU;
 +
D10->TRIG;
 +
ECHO->D04;
 +
D08->AIN1;
 +
D09->AIN2;
 +
D05->PWMA;
 +
D12->BIN1;
 +
D11->BIN2;
 +
D06->PWMB;
 +
D07->STBY;
  
  unsigned long t_ms = millis();
+
A01->M1P;
  //
+
A02->M1N;
  // check against collision system
+
B01->M2P;
  if (t_ms - t0_ms[2] >= dt_ms[2]) {
+
B02->M2N;
    // save the last time you did it
 
    t0_ms[0] = t_ms;
 
  int d=ultrasound();
 
 
 
        setMotor(255,255);
 
       
 
    if (d<10) {
 
      Serial.println(d);  
 
  
    }
 
  } 
 
 
}
 
}
 +
</graphviz>
  
 +
=== Tabella riassuntiva ===
  
// Function to Spin Right
 
void setMotor(int speedL, int speedR) {
 
  int speedLabs=abs(speedL);
 
  int speedRabs=abs(speedR);
 
  
  if (speedL>0) {
+
'''CONNESSIONI'''
    digitalWrite(pinWheelL_AIN1, LOW);
 
    digitalWrite(pinWheelL_AIN2, HIGH);
 
  }
 
  
  if (speedL<0) {
+
== Software ==
    digitalWrite(pinWheelL_AIN1, HIGH);
 
    digitalWrite(pinWheelL_AIN2, LOW);
 
  }
 
 
 
 
 
  if (speedR>0) {
 
    digitalWrite(pinWheelR_BIN1, LOW);
 
    digitalWrite(pinWheelR_BIN2, HIGH);
 
  }
 
 
 
  if (speedR<0) {
 
    digitalWrite(pinWheelR_BIN1, HIGH);
 
    digitalWrite(pinWheelR_BIN2, LOW);
 
  }
 
  
 
+
* Programma [[robotExplorerContubot1simple]]
  // set power
 
  analogWrite(pinWheelL_PWMA, speedLabs);
 
  analogWrite(pinWheelR_PWMB, speedRabs);
 
}
 
 
 
long ultrasound() {
 
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>
+
=== 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