def started(chassis):
    global start_time
    start_time = time.time()
    print('> started')


def complete(chassis):
    print('> completed in %.1fs' % (time.time() - start_time))


def stalled(chassis):
    print('> ** stalled **')

mon = chassis.travel(distance=200, on_start=started, on_complete=complete, on_stalled=stalled)

print('waiting...')
mon.wait(5)

if mon.running:
    print('not enough time')
elif mon.stalled:
    print('obstacle found')
else:
    print('success')

chassis.travel(distance=-200, speed=50, on_start=started, on_complete=complete, on_stalled=stalled).wait(5)
print('back home')

# print('forward forever')