microsoft / AirSim

Open source simulator for autonomous vehicles built on Unreal Engine / Unity, from Microsoft AI & Research
https://microsoft.github.io/AirSim/
Other
16.27k stars 4.53k forks source link

AirSim features #927

Closed NextSim closed 6 years ago

NextSim commented 6 years ago

I'm working on a driving simulator that would connect AirSim to a power steering system (not a steering wheel joystick).

I have a few questions about AirSim:

mitchellspryn commented 6 years ago

1) By "autonomous driving," do you mean API control? If so, the answer is yes. Via python, you can use the CarClient.setApiControl() member to switch between manual (false) and API (true) driving modes.

2) If you figure that out, you've made a million dollars :). To my knowledge, AirSim doesn't have any models built in, so that part is up to you. If you're looking to get started, you may be interested in checking out the Autonomous Driving Cookbook, which has some simple examples using AirSim and deep learning to drive the car autonomously.

3) Not sure about this one. @sytelus might know.

NextSim commented 6 years ago

Thanks.

Are there any details on the format of the API calls? I know there is the list of common API calls, but I haven't seen anything about the arguments it takes

mitchellspryn commented 6 years ago

Not sure about formal documentation, but you can look through AirsimClient.py to see what methods are available. For full examples, check out HelloCar.py.

NextSim commented 6 years ago

Thanks.

I'm using c# but am struggling getting the API working. I'm successfully connecting, my issue is sending the api data in the correct format.

I'm trying to use the serializer here: https://github.com/msgpack/msgpack-cli

I created two classes for the data to enable the api and set the car control

I tried monitoring the data sent from the hellocar example in wireshark (that successfully enables the api and can control the car) and the data doesn't seem close.

I don't understand how to serialize the data properly into the MessagePack format.


    public class enableApiHelper
    {
 public String title { get; set; }
        public bool enable { get; set; }
    }

Then serialize the enable api data

var stream = new MemoryStream();

                enableApiHelper apiEnable = new enableApiHelper
                {
title = "enableApiControl",
                    enable = true
                };

                // call Serialize/Deserialize, that's all.
                var serializer = MessagePackSerializer.Get<enableApiHelper>();

                serializer.Pack(stream, apiEnable);
                stream.Position = 0;

                byte[] apiEnableBytes = stream.ToArray();

and send the byte array over tcp.

Which doesn't work. It looks like the data is correct, but there are a few bytes at the beginning and end that are different than the helloCar example.

Any help you can provide is greatly appreciated.. I'm really spinning my wheels.

image

NextSim commented 6 years ago

I was able to figure out how to properly create the classes so that they serialize correctly.

I don't understand where the '0' and '1' come from though.

In JSON

[ 0, 1, "enableApiControl", [ true ] ]

sytelus commented 6 years ago

Please continue discussion here: https://github.com/Microsoft/AirSim/issues/946