Podcast
Questions and Answers
What is the purpose of the command rm.run(Raspi_MotorHAT.RELEASE)
?
What is the purpose of the command rm.run(Raspi_MotorHAT.RELEASE)
?
What is the purpose of the line atexit.register(turn_off_motors)
?
What is the purpose of the line atexit.register(turn_off_motors)
?
What is the purpose of the commands lm.setSpeed(150)
and rm.setSpeed(150)
?
What is the purpose of the commands lm.setSpeed(150)
and rm.setSpeed(150)
?
What is the purpose of the commands lm.run(Raspi_MotorHAT.FORWARD)
and rm.run(Raspi_MotorHAT.FORWARD)
?
What is the purpose of the commands lm.run(Raspi_MotorHAT.FORWARD)
and rm.run(Raspi_MotorHAT.FORWARD)
?
Signup and view all the answers
What is the purpose of the line time.sleep(1)
?
What is the purpose of the line time.sleep(1)
?
Signup and view all the answers
Which type of steering involves moving a bar to turn the vehicle?
Which type of steering involves moving a bar to turn the vehicle?
Signup and view all the answers
What is the key difference between steerable wheels and fixed wheels?
What is the key difference between steerable wheels and fixed wheels?
Signup and view all the answers
Which of the following is NOT a common type of steerable wheel steering?
Which of the following is NOT a common type of steerable wheel steering?
Signup and view all the answers
What is the purpose of the Raspi_MotorHAT library used in the code?
What is the purpose of the Raspi_MotorHAT library used in the code?
Signup and view all the answers
What distinguishes Atlas from ASIMO and NAO robots?
What distinguishes Atlas from ASIMO and NAO robots?
Signup and view all the answers
How does Atlas primarily move?
How does Atlas primarily move?
Signup and view all the answers
Which company developed the Atlas robot?
Which company developed the Atlas robot?
Signup and view all the answers
What type of motion is characteristic of Atlas?
What type of motion is characteristic of Atlas?
Signup and view all the answers
In the context of robot mobility, what sets Atlas apart from other robots?
In the context of robot mobility, what sets Atlas apart from other robots?
Signup and view all the answers
Study Notes
Stopping Motors
-
self.left_motor.run(Raspi_MotorHAT.RELEASE)
stops the left motor by running it in RELEASE mode. -
self.right_motor.run(Raspi_MotorHAT.RELEASE)
stops the right motor by running it in RELEASE mode.
Understanding the Formula
- The formula
(speed * 255) // 100
is used to convert a percentage value into a fraction of 255. - Multiplying the speed by 255 scales it up, ensuring that the division operation results in a non-zero value.
- The
//
operator performs integer division, ensuring that the output remains an integer.
Importing Libraries
- The line
from Raspi_MotorHAT import Raspi_MotorHAT
imports the Raspi_MotorHAT module. - The
time
module is imported to introduce delays in the code. - The
atexit
module is imported to register functions to be called when the program exits.
Initializing Motor HAT and Motors
- The line
mh = Raspi_MotorHAT(addr=0x6f)
initializes the Raspi_MotorHAT object with the I2C address 0x6f. -
lm = mh.getMotor(1)
initializes the left motor by retrieving the motor object associated with motor port 1. -
rm = mh.getMotor(2)
initializes the right motor by retrieving the motor object associated with motor port 2.
Defining Function to Turn Off Motors
- The function
turn_off_motors()
is defined to release the motors, stopping their rotation. - The function is registered to be called when the program exits using
atexit.register(turn_off_motors)
.
Robot Examples
- Boston Dynamics BigDog is a four-legged robot that can walk and run in challenging conditions like ice.
- Atlas (from Boston Dynamics) is a fast robot on two legs that uses laser radar to navigate.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Description
Learn how to stop left and right motors by running them in RELEASE mode. Explore changes that enable the use of speeds from 0 to 100, converted to the range of 0 to 255 expected by the motor HAT.