Your maze navigating GoPiGo3 from Dexter Industries
git clone https://github.com/dadiletta/piggy
Open the folder in Visual Studio Code and start working on student.py
. Follow instructions on our guide
Here are the building blocks from the teacher.py
file you can use in your challenges. For example, use self.fwd()
to drive your robot forward.
-
deg_fwd(angle)
- how many degrees do you want your wheels to rotate? You need to pass the angle -
fwd
- powers on your robot to drive forward. You'll need to useself.stop()
to power off the motors -
right
- by default,self.right()
will give the left motor 90% power and the right 0% which rotates right. You can use kwargs to adjust the power such asself.right(primary=90, counter=-90)
, which will spin the robot in place -
left
- same as right but reversed. -
back
- same as fwd but in reverse. -
servo
- moves the servo (plugged into servo1) to the given value (use 1000 - 2000) -
stop
- sets motor power to zero -
read_distance
- returns the distance from the distance sensor (plugged into I2C port) in milimeters -
get_heading
- returns the gyroscope's value