Skip to content
This repository has been archived by the owner on Oct 26, 2021. It is now read-only.

CSV Instrumentation and Event data over TCP/IP #12

Open
adam-burns opened this issue Dec 5, 2017 · 1 comment
Open

CSV Instrumentation and Event data over TCP/IP #12

adam-burns opened this issue Dec 5, 2017 · 1 comment

Comments

@adam-burns
Copy link

It is mentioned several times through the documentation that CSV data for the simulator should be available over TCP/IP.

We want to use this data to get very simple CANbus style data for instrumentation and controller data (steering wheel, pedals), as well as representational location (fake GPS). In other words to use it for very simple synthetic connected car style data streams.

Has anyone got CSV network streaming to work?

I'm also looking to connect an application to the event CSV stream over TCP/IP.

I notice from Assets/Scripts/Vehicle/DataStreamServer.cs:

public class DataStreamServer : PersistentUnitySingleton<DataStreamServer> {

    public const int PORT = 9001;
    public const int ALTPORT = 9000;
    public const int EVENTPORT = 9002;

And it appears EVENTPORT only appears once more in the source (again in DataStreamServer.cs):

protected override void Awake()
    {
        base.Awake();
        connections = new List<ConnectionData>();
        var dbEndpoint = new IPEndPoint(IPAddress.Parse(NetworkController.settings.clientIp), PORT);
        var altEndpoint = new IPEndPoint(IPAddress.Parse(NetworkController.settings.altClientIP), ALTPORT);
        var eventEndpoint = new IPEndPoint(IPAddress.Parse(NetworkController.settings.eventClientIP), EVENTPORT);

        var dbClient = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
        var altClient = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
        var eventClient = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
        dbClient.BeginConnect(dbEndpoint, new AsyncCallback(ConnectCallback), new ConnectionData() { client = dbClient, IC = true, events = false });
        altClient.BeginConnect(altEndpoint, new AsyncCallback(ConnectCallback), new ConnectionData() { client = altClient, IC = false, events = false });
        eventClient.BeginConnect(eventEndpoint, new AsyncCallback(ConnectCallback), new ConnectionData() { client = eventClient, IC = false, events = true });


    }

But when I run one-screen, nothing appears to be connected to port 9002, and a telnet attempt to that port does not connect.

On the flipside, once the host IP address is configured, the instrumentation panel works while running on the same machine (and connecting to its port), so the console binary appears to work.

And yes, I've tried turning Windows Firewall completely off, with no improvement.

Has anyone successfully got this function to work, or know what else is required? Is it locked into DirectInput somehow? (I have an issue getting a steering set to function correctly).

I should add that I am running the latest precompiled versions (do I now need a Unity seat license just to tinker with this?)

Any help very much appreciated!

@ericblade
Copy link
Contributor

You might want to have a quick look at Tools\StreamListener* and/or Tools\stream_listen.py . As I mentioned in my comment earlier on another post, those are outgoing connections to the defined hosts/ports, rather than incoming Listens on those ports.

I have had no problems using genivi-vehicle-simulator in the 2017.* versions of Unity, after making the changes that are recommended by the upgrade process when loading it into a new version.

That said, I do happen to have a recent amount of experience doing exactly this sort of thing, and was recently laid-off. If anyone might need some consulting done, beyond advice on github, I'm currently available, email in profile. :-)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants