Example #1
0
            sizeof(float) * 7; //Position Data


        public VTNetwork(ref SWSimulation sws, string ip, int port)
        {
            _sws = sws;
            IPAddress localAddr = IPAddress.Parse(ip);

            server = new TcpListener(localAddr, port);
            server.Start();
        }
Example #2
0
 public VTController(SWSimulation sws)
 {
     _sws = sws;
 }
Example #3
0
 public VTSimulation(ref SWSimulation sws)
 {
     _sws = sws;
 }
Example #4
0
 public VTRender(ref SWSimulation sws)
 {
     _sws = sws;
 }
Example #5
0
 public VTHolocron(ref SWSimulation sws)
 {
     _sws = sws;
 }
Example #6
0
        bool Init()
        {
            //Init
            _sws        = new SWSimulation();
            _render     = new VTRender(ref _sws);
            _network    = new VTNetwork(ref _sws, "0.0.0.0", 4949);
            _physics    = new VTPhysics(ref _sws);
            _serial     = new VTSerial(ref _sws);
            _simulation = new VTSimulation(ref _sws);

            _holocron = new VTHolocron(ref _sws);
            _holocron.Init();

            // SDL_SetHint(SDL_HINT_XINPUT_ENABLED, "1");

            _render.Init(SCREEN_HEIGHT, SCREEN_WIDTH, 0);

            SDL_SetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, "1");
            _controller = new VTController(_sws);
            _controller.Init();

            if (System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Windows) == true)
            {
                // _serial.StartConnection(ListOf_Panels.Right, "COM6", 115200, 16);
                // _serial.StartConnection(ListOf_Panels.RightAnalog, "COM12", 115200, 10);

                // _serial.StartConnection(ListOf_Panels.Left, "COM3", 115200, 16);
                // _serial.StartConnection(ListOf_Panels.LeftAnalog, "COM10", 115200, 10);

                // _serial.StartConnection(ListOf_Panels.Center, "COM7", 115200, 13);
                // _serial.StartConnection(ListOf_Panels.CenterAnalog, "COM9", 115200, 8);
            }

            if (System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Linux) == true)
            {
                try
                {
                    _serial.StartConnection(ListOf_Panels.Center, "/dev/ttyACM0", 115200, 13);
                }
                catch (UnauthorizedAccessException) { }
                try
                {
                    _serial.StartConnection(ListOf_Panels.CenterAnalog, "/dev/ttyUSB0", 115200, 8);
                }
                catch (UnauthorizedAccessException) { }

                try
                {
                    _serial.StartConnection(ListOf_Panels.Left, "/dev/ttyACM1", 115200, 16);
                }
                catch (UnauthorizedAccessException) { }
                try
                {
                    _serial.StartConnection(ListOf_Panels.LeftAnalog, "/dev/ttyUSB1", 115200, 10);
                }
                catch (UnauthorizedAccessException) { }

                try
                {
                    _serial.StartConnection(ListOf_Panels.Right, "/dev/ttyACM2", 115200, 16);
                }
                catch (UnauthorizedAccessException) { }
                try
                {
                    _serial.StartConnection(ListOf_Panels.RightAnalog, "/dev/ttyUSB2", 115200, 10);
                }
                catch (UnauthorizedAccessException) { }
            }
            return(true);
        }