Code Monkey home page Code Monkey logo

airsimtensorflow's Issues

collision_testing.py

Hi, help please update collision_testing. py. All working, but arrors in lines 71 and 74.

import airsim
#from AirSimClient import CarClient, CarControls, ImageRequest, AirSimImageType, AirSimClientBase
import os
import time
import tensorflow as tf
import pickle
import sys

from image_helper import loadgray, IMAGEDIR
from tf_softmax_layer import inference

TMPFILE = IMAGEDIR + '/active.png'
PARAMFILE = 'params.pkl'
IMGSIZE = 1032
INITIAL_THROTTLE= 0.65
BRAKING_DURATION = 15

connect to the AirSim simulator

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

client.reset()

go forward

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

Load saved training params as ordinary NumPy

W,b = pickle.load(open('params.pkl', 'rb'))

with tf.Graph().as_default():

# Placeholder for an image
x = tf.placeholder('float', [None, IMGSIZE])

# Our inference engine, intialized with weights we just loaded
output = inference(x, IMGSIZE, 2, W, b)

# TensorFlow initialization boilerplate
sess = tf.Session()
init_op = tf.global_variables_initializer()
sess.run(init_op)

# Once the brakes come on, we need to keep them on for a while before exiting; otherwise,
# the vehicle will resume moving.
brakingCount = 0

# Loop until we detect a collision
while True:

    # Get RGBA camera images from the car
    responses = client.simGetImages([airsim.ImageRequest("1", airsim.ImageType.Scene)])

    # Save it to a temporary file
    image = responses[0].image_data_uint8
    AirSimClientBase.write_file(os.path.normpath(TMPFILE), image)  ### NameError: name 'AirSimClientBase' is not defined

    # Read-load the image as a grayscale array
    image = loadgray(TMPFILE) ### FileNotFoundError: [Errno 2] No such file or directory: './carpix/active.png'

    # Run the image through our inference engine.
    # Engine returns a softmax output inside a list, so we grab the first
    # element of the list (the actual softmax vector), whose second element
    # is the absence of an obstacle.
    safety = sess.run(output, feed_dict={x:[image]})[0][1]

    # Slam on the brakes if it ain't safe!
    if safety < 0.5:

        if brakingCount > BRAKING_DURATION:
            print('BRAKING TO AVOID COLLISSION')
            sys.stdout.flush()
            break
        
        car_controls.brake = 1.0
        client.setCarControls(car_controls)

        brakingCount += 1
        
    # Wait a bit on each iteration
    time.sleep(0.1)

client.enableApiControl(False)

error in running Neigbourhoodevironment

I have downloaded neighbor environment from the link and after extracting am trying to run .bat file but it is giving Assertion error how can I resolve it
capture

Images are rewritten after each run

@simondlevy Every time the sim initialized with image_collection.py the 10 images leading to the crash are stored removing the images for the previous crash. My understanding is we need to collect as many "crash"images as we can to train the network. So is this an issue and a bug need to be fixed in the code or am I missing something?

Thanks!

Some problem about the airsim

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?

Drone

Congratulations on your project. Have you tested something with the drone mode?
I am now doing the final thesis of my bachelor degree related to Machine Learning in drone simulations and I'm starting with something like what you did but with the drone mode, and some advices would be useful.

Thanks!

problem executing run.bat

hi, I am facing crashing of the unreal engine 4 as I try to execute the file named run.don't know why it is happening can you guide me, please. also I wanted to ask which version of the unreal engine have you used in making the environment? bellow have attached the error that I am facing any help will be very helpful.
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.