Multiple GoPiGo3 Api Calls


#1

Hey Guys,

Me here again for the IT camp that starts on Monday.I noticed with the GoPiGo3 api, if i have two calls
as

import easygopigo3 as easy
r = easy.EasyGoPiGo3()
def m1():
r.drive_cm(10)
r.turn_degrees(50)

if we call m1() then the robot only turns

We found if we put a sleep statement, then the robot drives forward a bit, (for the duration of the sleep) and then turns.

Seems there is no queue of commands within the api.
Is there a way we can tell how long the robot will take do something? That way we can issue a command and have the robot sleep so it can execute, and then process the next one.

Thanks


#2

Hello @KrisManohar
Are you using Python on DexterOS, or Rasbian For Robots?

Try this:
r.drive_cm(10,blocking=True)

this tells the GoPiGo3 to drive forward for 10 cm and to wait till it’s done before going to the next statement.
The same exists for turn_degrees but only in the latest version of easygopigo3 (on Raspbian for Robots, make sure you’re up to date)

Cleo