Reputation: 651
The following code is based on Spike Prime and Pybricks Beta. The line that does the "turn" causes the robot to spin forever. Adding the top side and front side arguments does not help. Setting the drivebase "Settings" also does not help. Using drivebase.drive(0,90) instead of turn stops the turning when the wheels are in the air for testing but causes the infinity spin when placed on the mat.
what could I be missing here?
from pybricks.hubs import PrimeHub
from pybricks.pupdevices import Motor
from pybricks.parameters import Port, Stop, Color, Button, Direction, Axis
from pybricks.robotics import DriveBase
from pybricks.tools import wait
hub = PrimeHub()
left_motor = Motor(port = Port.C, positive_direction=Direction.CLOCKWISE)
right_motor = Motor(port = Port.B, positive_direction=Direction.COUNTERCLOCKWISE)
drivebase = DriveBase(
left_motor,right_motor,
wheel_diameter=56,axle_track=128
)
drivebase.use_gyro(True)
drivebase.straight(distance=250)
drivebase.turn(angle=90)
drivebase.straight(distance=250)
drivebase.turn(angle=90)
Upvotes: 0
Views: 81