// Use this for initialization
 void Start()
 {
     _socket = GameObject.Find("SocketIO").GetComponent <SocketIOComponent>();
     _socket.On("open", OnOpen);
     _socket.On("steer", OnSteer);
     _socket.On("manual", onManual);
     _carController = CarRemoteControl.GetComponent <CarController>();
     point_path     = CarRemoteControl.GetComponent <PointTracker>();
     wpt            = new WaypointTracker_mpc();
     polyOrder      = 5;
 }
 void Awake()
 {
     a              = 3;
     time           = 8f;
     _carController = CarRemoteControl.GetComponent <CarController>();
     setupSocket();
 }
Exemple #3
0
 // Use this for initialization
 void Start()
 {
     _socket = GameObject.Find("SocketIO").GetComponent <SocketIOComponent>();
     _socket.On("open", OnOpen);
     _socket.On("steer", OnSteer);
     _socket.On("manual", onManual);
     _carController = CarRemoteControl.GetComponent <CarController>();
 }
Exemple #4
0
    // Use this for initialization
    void Start()
    {
        Debug.Log("CommandGateway init");
        webGateway = GameObject.Find("WebGateway").GetComponent <WebGateway>();
        webGateway.MessageReceived += OnMessage;

        _carController = CarRemoteControl.GetComponent <CarController>();
        EmitTelemetry();
        //OnSteer(JsonUtility.FromJson<CarInputData>("{\"steering_angle\": 10, \"throttle\": 10}"));
    }
 // Use this for initialization
 void Start()
 {
     _socket = GameObject.Find("SocketIO").GetComponent <SocketIOComponent>();
     _socket.On("open", OnOpen);
     _socket.On("steer", OnSteer);
     _socket.On("manual", onManual);
     _socket.On("send_image_request", onImageRequest);
     _carController = CarRemoteControl.GetComponent <CarController>();
     DontDestroyOnLoad(this.gameObject);
 }
Exemple #6
0
 // Use this for initialization
 void Start()
 {
     _socket = GameObject.Find("SocketIO").GetComponent <SocketIOComponent>();
     _socket.On("open", OnOpen);
     _socket.On("reset", OnReset);
     _socket.On("steer", OnSteer);
     _socket.On("manual", onManual);
     _carController = CarRemoteControl.GetComponent <CarController>();
     wpt            = new WaypointTracker_pid();
 }
Exemple #7
0
 // Use this for initialization
 void Start()
 {
     Application.targetFrameRate = fps;
     acceleration  = 0;
     steeringAngle = 0;
     carController = CarRemoteControl.GetComponent <CarController>();
     connected     = false;
     received      = false;
     Connect();
 }
    // Use this for initialization
    void Start()
    {
        _socket = GameObject.Find("SocketIO").GetComponent <SocketIOComponent>();
        _socket.On("open", OnOpen);        //"events", callback function called when event is dequeued
//		Debug.Log (_socket.On);
        _socket.On("steer", OnSteer);
        Debug.Log("Start up");
        _socket.On("manual", onManual);
        _carController = CarRemoteControl.GetComponent <CarController>();
    }
    void Awake()
    {
        int width  = 160;
        int height = 80;

        NorthCamera.targetTexture = new RenderTexture(width, height, 24);
        SouthCamera.targetTexture = new RenderTexture(width, height, 24);
        EastCamera.targetTexture  = new RenderTexture(width, height, 24);
        WestCamera.targetTexture  = new RenderTexture(width, height, 24);
        _carController            = CarRemoteControl.GetComponent <CarController>();
    }
Exemple #10
0
 // Use this for initialization
 void Start()
 {
     Debug.Log("Starting");
     _socket = GameObject.Find("SocketIO").GetComponent <SocketIOComponent>();
     _socket.On("open", OnOpen);
     _socket.On("steer", OnSteer);
     _socket.On("manual", onManual);
     _socket.On("telemetry", OnTelemetry);
     _socket.On("close", OnClose);
     _carController = CarRemoteControl.GetComponent <CarController>();
 }
 // Use this for initialization
 void Start()
 {
     _socket = GameObject.Find("SocketIOMon").GetComponent <SocketIOComponent>();
     _socket.On("open", OnOpen);
     //_socket.On("manual", onManual);
     _socket.On("close", onClose);
     _carController = CarRemoteControl.GetComponent <CarController>();
     // 获得组件
     // 事件更新
     LidarSensor.HitPointsTrans += MsgUpdate;
     soObj = null;
 }
Exemple #12
0
    void Start()
    {
        CommandServer = GameObject.Find("CommandServer").GetComponent <MyCommandServer_mpc>();

        lineRenderer = path_point.GetComponentInParent <LineRenderer> ();
        lineRenderer.SetWidth((float).5, (float).5);
        lineRenderer.useWorldSpace = true;

        _carController = CarRemoteControl.GetComponent <CarController>();
        lastPoint      = _carController.Position();
        lineRenderer.SetVertexCount(2);
    }
    // Use this for initialization
    void Start()
    {
        _socket = GameObject.Find("SocketIO").GetComponent <SocketIOComponent>();
        _socket.On("open", OnOpen);
        _socket.On("steer", OnSteer);
        _socket.On("manual", onManual);
        _carController = CarRemoteControl.GetComponent <CarController>();

        canvas       = GameObject.FindWithTag("Adversarial").GetComponent <Image>();
        clear        = canvas.color;
        full         = canvas.color;
        clear.a      = 0.0f;
        full.a       = 1.0f;
        canvas.color = full;
    }
Exemple #14
0
    // Use this for initialization
    void Start()
    {
        _socket = GameObject.Find("SocketIO").GetComponent <SocketIOComponent>();
        _socket.On("open", OnOpen);
        _socket.On("steer", OnSteer);
        _socket.On("manual", onManual);
        _carController = mainCar.GetComponent <CarController>();

        dataCapturer.init(GetComponent <Renderer>(), mainCamera);

        rgbShader   = Shader.Find("Standard");
        depthShader = Shader.Find("Custom/DepthGrayscale");

        pointCloud = new float[imgHeight * imgWidth * 4];

        otherCar1 = GameObject.Find("Sedan_3A");
        otherCar2 = GameObject.Find("Interceptor_2A");
    }
Exemple #15
0
    // Use this for initialization
    void Start()
    {
        _carController = CarRemoteControl.GetComponent <CarController>();
        wpt            = new WaypointTracker_pid();

        //connect to TCP Server
        ReadOk  = false;
        WriteOk = false;
        try
        {
            client = new TcpClient(Server_IP, SERVER_PORT);
            client.GetStream().BeginRead(readBuffer, 0, READ_BUFFER_SIZE, new AsyncCallback(DoRead), null);
            Debug.Log("Connection OK!");
        }
        catch (Exception ex)
        {
            Debug.Log("Connection ERROR!");
        }
    }
Exemple #16
0
    public void Init(CarRemoteControl value, string trainPath)
    {
        // set the car controller and cameras
        carController = value.GetComponent <CarController>();
        cameraCenter  = GameObject.Find("CenterCamera").GetComponent <Camera>();
        cameraLeft    = GameObject.Find("LeftCamera").GetComponent <Camera>();
        cameraRight   = GameObject.Find("RightCamera").GetComponent <Camera>();

        trainFolder = trainPath + "input/";
        Debug.Log(trainFolder);


        if (!Directory.Exists(trainFolder + "imgs/"))
        {
            Directory.CreateDirectory(trainFolder + "imgs/");
        }
        else
        {
            Directory.Delete(trainFolder + "imgs/", true);
            Directory.CreateDirectory(trainFolder + "imgs/");
        }
    }
Exemple #17
0
    void Start()
    {
        /// for the car
        carCtrl      = carRemoteCtrl.GetComponent <CarController>();
        centerCam    = GameObject.Find("CenterCamera").GetComponent <Camera>();
        rightCam     = GameObject.Find("RightCamera").GetComponent <Camera>();
        leftCam      = GameObject.Find("LeftCamera").GetComponent <Camera>();
        carPos       = new List <Vector3>();
        carIntentDir = new List <Vector3>();
        carActualDir = new List <Vector3>();
        carMult      = new List <float>();
        carLeftLbl   = new List <int>();
        carRightLbl  = new List <int>();
        eps          = 1;


        /// for obstacles
        ///
        obstAll = Resources.LoadAll("Const_prop_sets");
        obstIdx = 1;

        obstPos = new Vector3(1.875f, 0f, 100f); // for the straight road: 1.875f,0f,100f
        obstScl = new Vector3(2f, 10f, 2f);

        obstTmp = (GameObject)Instantiate(obstAll[obstIdx]) as GameObject;
        obstTmp.transform.position   = obstPos;
        obstTmp.transform.localScale = obstScl;


        /// specify training file directories
        ///
        /// Input
        trainFolder = "C:/DeepDrive/train/201805/detection-straight/";
        zoneLog     = "input-zone";

        /// Output
        trainImgFolder = "train-imgs/";
        trainLog       = "train-log.csv";
        analysisLog    = "analysis-log.csv";
        if (!Directory.Exists(trainFolder + trainImgFolder))
        {
            Directory.CreateDirectory(trainFolder + trainImgFolder);
        }


        /// main program
        LoadZoneInfo();
        Debug.Log(carPos.Count);
        for (int i = 0; i < carPos.Count; i++)
        {
            carCtrl.transform.position = carPos[i];
            float limitAngle = Vector3.Angle(Vector3.right, carActualDir[i]) + carMult[i] * eps;

            float angleToIntentialDir = Vector3.Angle(Vector3.right, carIntentDir[i]);
            Debug.Log(angleToIntentialDir);

            float rightMostAngle = angleToIntentialDir - 2.5f;
            float leftMostAngle  = angleToIntentialDir + 2.5f;
            float curAngle       = rightMostAngle;
            float gapRot         = 0.1f;

            while (curAngle <= leftMostAngle)
            {
                carCtrl.transform.rotation = Quaternion.AngleAxis(90 - curAngle, Vector3.up);

                if (curAngle > limitAngle)
                {
                    writeTrainingData(carLeftLbl[i], carPos[i].z);
                }
                else
                {
                    writeTrainingData(carRightLbl[i], carPos[i].z);
                }

                curAngle += gapRot;
            }
        }
    }