Stop at given length from the wall/fi: Difference between revisions

From wikiluntti
(Created page with "=== Harjoituksia ===")
Line 26: Line 26:
[[File:Stop10cm.png|thumb|Koodi, jolla robotti pysähtyy 10 cm päähän seinästä.]]
[[File:Stop10cm.png|thumb|Koodi, jolla robotti pysähtyy 10 cm päähän seinästä.]]


=== Exercises ===
=== Harjoituksia ===


* Make the robot speed dependent on the distance to the wall, e.g. by using a formula speed = distance.
* Make the robot speed dependent on the distance to the wall, e.g. by using a formula speed = distance.

Revision as of 19:21, 15 September 2020

<languages/>


Johdanto

Usein on törkeää saada robotti pysähtymään ennen törmäämistään seinään tai esteeseen. Tähän tarkoitukseen sopii ultraääni- tai infrapuna-anturit.

Robotti

Lähes mikä tahansa liikkuva robotti toimii.

Anturit

Käytämme ultraäänianturia, mikä on kytketty robotin porttiin numero 4.

Esimerkkivideot

Teoriaa

Ultraäänianturi on on kuin lepakoiden kaikuluotain. Anturin toiminta kannattaa tarkistaa, varsinkin jos se ei tunnun toimivan oikein. Kädellä etäisyyden arvioiminen saattaa olla hankalaa, ja jokin kovempi esine, esimerkiksi pahvi- tai muovilevy toimii usein paremmin. Anturin suurin toimintaetäisyys on noin 2 metriä ja lyhin etäisyys on n. 10 cm.

Esimerkkikoodi

Koodi, jolla robotti pysähtyy 10 cm päähän seinästä.

Harjoituksia

  • Make the robot speed dependent on the distance to the wall, e.g. by using a formula speed = distance.
  • Use the ideas shown in previous part (Following a Line) to follow the wall at 10 cm apart.
  • Follow a line (previous part) until the robot finds a wall at 10 cm apart from the wall.
  • If you have multiple robots, make the robots follow a line and each others, not colliding with the robot in front of.
  • Use the ultrasonic sensor to listen if there is other robots using ultrasonic sensors.

Listen


This course is supported by Meet and Code. The course is made in collaboration with Robotiikka- ja tiedekasvatus ry.

Back to Meet and Code 2020 I: Ev3-G