如何更改机器人倒退的持续时间

How do I change the duration of the robot going backwards

我只是想知道是否有人可以帮助我。我使用 Python 通过 Raspberry Pi 控制机器人,想知道如何更改机器人向后移动的时间量。目前是半秒,我希望是三秒。我在下面列出了我目前使用的代码。

import time
from gopigo import *  # Has the basic functions for controlling the GoPiGo Robot
import sys  # Used for closing the running program

now = time.time()
future = now + 0.500
while time.time() < future:
    bwd()  # Move backward
stop()  
sys.exit()

据我所知,这里的时间现在是 ("0") 加上 0.500 ("half a second")。 要更改为 3 秒,您需要执行 "now" 加“3”。

试试这个,让我们知道!

import time
from gopigo import *
import sys

now = time.time()
future = now + 3

while time.time() < future:
    bwd()

stop()
sys.exit()