simondlevy / AirSimTensorFlow

A simple example of using Microsoft AirSim to train a TensorFlow neural net on collision avoidance

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Some problem about the airsim

slyviacassell opened this issue · comments

Hello, I download the AirSimNH 1.2.0 environment from the github, but when I run the run.bat and image_colleection.py the cmd shows as follow:
WARNING:tornado.general:Connect error on fd 284: WSAECONNREFUSED
WARNING:tornado.general:Connect error on fd 284: WSAECONNREFUSED
WARNING:tornado.general:Connect error on fd 284: WSAECONNREFUSED
WARNING:tornado.general:Connect error on fd 284: WSAECONNREFUSED
WARNING:tornado.general:Connect error on fd 284: WSAECONNREFUSED
Waiting for connection: Traceback (most recent call last):
File ".\image_collection.py", line 30, in
client.confirmConnection()
File "C:\Users\Asus\Desktop\AirSimTensorFlow\AirSimClient.py", line 160, in confirmConnection
home = self.getHomeGeoPoint()
File "C:\Users\Asus\Desktop\AirSimTensorFlow\AirSimClient.py", line 169, in getHomeGeoPoint
return GeoPoint.from_msgpack(self.client.call('getHomeGeoPoint'))
File "F:\Python3.5.4\lib\site-packages\msgpackrpc\session.py", line 41, in call
return self.send_request(method, args).get()
File "F:\Python3.5.4\lib\site-packages\msgpackrpc\future.py", line 43, in get
raise self._error
msgpackrpc.error.TransportError: Retry connection over the limit

I do know the airsim does not work, but I can not fix it. Could you help me please?

Hi,

I used AirSimNH 1.2.1
I think the problem is Python API version.

I updated code and it works;

import airsim
from image_helper import IMAGEDIR
import pprint
import os
import time

QUEUESIZE = 10
try:
    os.stat(IMAGEDIR)
except:
    os.mkdir(IMAGEDIR)

client = airsim.CarClient()
client.confirmConnection()
print('Connected')
client.enableApiControl(True)
car_controls = airsim.CarControls()

client.reset()

car_controls.throttle = 1.0
car_controls.steering = 0
client.setCarControls(car_controls)

imagequeue = []

while True:
    responses = client.simGetImages([airsim.ImageRequest("1", airsim.ImageType.Scene)])
    imagequeue.append(responses[0].image_data_uint8)
    if len(imagequeue) == QUEUESIZE:
        for i in range(QUEUESIZE):
            airsim.write_file(os.path.normpath(IMAGEDIR + '/image%03d.png'  % i ), imagequeue[i])
        imagequeue.pop(0)    

    collision_info = client.getCollisionInfo()

    if collision_info.has_collided:
        print("Collision at pos %s, normal %s, impact pt %s, penetration %f, name %s, obj id %d" % (
            pprint.pformat(collision_info.position), 
            pprint.pformat(collision_info.normal), 
            pprint.pformat(collision_info.impact_point), 
            collision_info.penetration_depth, collision_info.object_name, collision_info.object_id))
        break
    time.sleep(0.1)
client.enableApiControl(False)

Hi,

I used AirSimNH 1.2.1
I think the problem is Python API version.

I updated code and it works;

import airsim
from image_helper import IMAGEDIR
import pprint
import os
import time

QUEUESIZE = 10
try:
    os.stat(IMAGEDIR)
except:
    os.mkdir(IMAGEDIR)

client = airsim.CarClient()
client.confirmConnection()
print('Connected')
client.enableApiControl(True)
car_controls = airsim.CarControls()

client.reset()

car_controls.throttle = 1.0
car_controls.steering = 0
client.setCarControls(car_controls)

imagequeue = []

while True:
    responses = client.simGetImages([airsim.ImageRequest("1", airsim.ImageType.Scene)])
    imagequeue.append(responses[0].image_data_uint8)
    if len(imagequeue) == QUEUESIZE:
        for i in range(QUEUESIZE):
            airsim.write_file(os.path.normpath(IMAGEDIR + '/image%03d.png'  % i ), imagequeue[i])
        imagequeue.pop(0)    

    collision_info = client.getCollisionInfo()

    if collision_info.has_collided:
        print("Collision at pos %s, normal %s, impact pt %s, penetration %f, name %s, obj id %d" % (
            pprint.pformat(collision_info.position), 
            pprint.pformat(collision_info.normal), 
            pprint.pformat(collision_info.impact_point), 
            collision_info.penetration_depth, collision_info.object_name, collision_info.object_id))
        break
    time.sleep(0.1)
client.enableApiControl(False)

Thank you! I'll try it latter! I almost forgot this issue.