Difference between revisions of "Steer left and right py v2"

From cod3v
(Created page with "<languages /> <translate> == Introduction == Test if multiple steering blocks can be aligned one after other. Works perfectly. === Robot === The idea and principle works...")
 
(Marked this version for translation)
Line 2: Line 2:
<translate>
<translate>


== Introduction ==
== Introduction == <!--T:1-->


<!--T:2-->
Test if multiple steering blocks can be aligned one after other. Works perfectly.  
Test if multiple steering blocks can be aligned one after other. Works perfectly.  


=== Robot ===
=== Robot === <!--T:3-->


<!--T:4-->
The idea and principle works for almost any robot thought this is tested using Asimov.
The idea and principle works for almost any robot thought this is tested using Asimov.


=== Sensors ===
=== Sensors === <!--T:5-->


<!--T:6-->
No sensors.  
No sensors.  


== An Illuminating Example ==
== An Illuminating Example == <!--T:7-->
<youtube>Ab5JR3NtRIU</youtube>
<youtube>Ab5JR3NtRIU</youtube>


== Theory ==
== Theory == <!--T:8-->


<!--T:9-->
Cascade a few .on() functions to steer first left then right. Sleep a few seconds in between the rounds.  
Cascade a few .on() functions to steer first left then right. Sleep a few seconds in between the rounds.  


== An Example Code ==
== An Example Code == <!--T:10-->


<!--T:11-->
<syntaxhighlight lang="python">
<syntaxhighlight lang="python">
#!/usr/bin/env python3
#!/usr/bin/env python3
Line 28: Line 33:
from time import sleep
from time import sleep


<!--T:12-->
#How about move steering?
#How about move steering?
steer_pair = MoveSteering(OUTPUT_B, OUTPUT_C)
steer_pair = MoveSteering(OUTPUT_B, OUTPUT_C)
Line 34: Line 40:
#steer_pair.off()
#steer_pair.off()


<!--T:13-->
steer_pair.on(steering=20, speed=5)
steer_pair.on(steering=20, speed=5)
sleep(10)
sleep(10)


<!--T:14-->
steer_pair.off()
steer_pair.off()
</syntaxhighlight >
</syntaxhighlight >
Line 42: Line 50:




== Exercises ==
== Exercises == <!--T:15-->


<!--T:16-->
1. Make the robot to steer around a table or a chair. Try to stop it at the starting position
1. Make the robot to steer around a table or a chair. Try to stop it at the starting position


<!--T:17-->
2. Make the robot stop  
2. Make the robot stop  
#After 10 seconds
#After 10 seconds
Line 51: Line 61:
#After the colour sensor finds a black tape.
#After the colour sensor finds a black tape.


<!--T:18-->
3. Try different steering values:
3. Try different steering values:
#0
#0
Line 61: Line 72:




<!--T:19-->
[[Category: Python v2]]
[[Category: Python v2]]
[[Category: Asimov]]
[[Category: Asimov]]


</translate>
</translate>

Revision as of 08:16, 9 June 2020

Other languages:
English • ‎suomi

Introduction

Test if multiple steering blocks can be aligned one after other. Works perfectly.

Robot

The idea and principle works for almost any robot thought this is tested using Asimov.

Sensors

No sensors.

An Illuminating Example

Theory

Cascade a few .on() functions to steer first left then right. Sleep a few seconds in between the rounds.

An Example Code

#!/usr/bin/env python3
from ev3dev2.motor import MoveSteering, OUTPUT_B, OUTPUT_C
from time import sleep

#How about move steering?
steer_pair = MoveSteering(OUTPUT_B, OUTPUT_C)
steer_pair.on(steering=-20, speed=5)
sleep(10)
#steer_pair.off()

steer_pair.on(steering=20, speed=5)
sleep(10)

steer_pair.off()


Exercises

1. Make the robot to steer around a table or a chair. Try to stop it at the starting position

2. Make the robot stop

  1. After 10 seconds
  2. After 3.5 rotations of the left tire
  3. After the colour sensor finds a black tape.

3. Try different steering values:

  1. 0
  2. -50 and +50
  3. -100 and +100
  4. -110 and +110