update obstacles_avoid_move example

This commit is contained in:
yangning wu 2024-09-25 21:13:33 +08:00
parent bddc17adeb
commit 58c3f6240d
1 changed files with 18 additions and 11 deletions

View File

@ -10,19 +10,26 @@ if __name__ == "__main__":
else: else:
ChannelFactoryInitialize(0) ChannelFactoryInitialize(0)
client = ObstaclesAvoidClient() try:
client.SetTimeout(3.0) client = ObstaclesAvoidClient()
client.Init() client.SetTimeout(3.0)
client.Init()
client.SwitchSet(False) while not client.SwitchGet()[1]:
time.sleep(2) client.SwitchSet(True)
time.sleep(0.1)
client.SwitchSet(True) print("obstacles avoid switch on")
time.sleep(2)
client.UseRemoteCommandFromApi(True) client.UseRemoteCommandFromApi(True)
time.sleep(2) time.sleep(0.5)
while True:
client.Move(0.5, 0.0, 0.0) client.Move(0.5, 0.0, 0.0)
time.sleep(0.02) time.sleep(1.0) # move 1s
client.Move(0.0, 0.0, 0.0)
client.UseRemoteCommandFromApi(False)
except KeyboardInterrupt:
client.Move(0.0, 0.0, 0.0)
client.UseRemoteCommandFromApi(False)
print("exit!!")