private void Start()
    {
        InvokeRepeating("UpdateCar", 0f, 1 / Constants.targetHz);

        //Get dimensions of car sprite
        float length = GetComponentInChildren <Renderer>().bounds.size.x;
        float width  = GetComponentInChildren <Renderer>().bounds.size.y;

        //Initialize the controllers and system
        carController = new CarController(length);
        steerSys      = new FirstOrderSystem(Constants.carSimSteeringK, Constants.carSimSteeringTau, Constants.targetHz, 0f);
        throttleSys   = new AsymmetricFirstOrderSystem(Constants.carSimVelK, Constants.carSimVelIncreaseTau, Constants.carSimVelDecreaseTau, Constants.targetHz, 0f);

        // Set initial car state
        carState = new CarState(0, transform.position.z, transform.position.x, 0, length / 2, length / 2);
        goalPos  = transform.position;
        SetTargetPosition(goalPos);

        //Draw the lidar visualization
        line = gameObject.GetComponent <LineRenderer>();
        line.SetVertexCount(numLineSegments + 1);
        line.useWorldSpace = false;
        DrawLidar();

        Debug.Log(string.Format("track width {0}", GetTrackWidth()));
        Debug.Log(string.Format("track length {0}", GetTrackLength()));
    }
    private void Start()
    {
        InvokeRepeating("ModifySpeed", 0f, 10f);        //for testing
        InvokeRepeating("CalculateControls", 0f, 1 / Constants.targetHz);

        trackController = new TrackController();
        sys             = new AsymmetricFirstOrderSystem(Constants.trackSimK, Constants.trackSimIncreaseTau, Constants.trackSimDecreaseTau, Constants.targetHz, 0f);
    }
Example #3
0
    private void Start()
    {
        InvokeRepeating("UpdateCar", 0f, 1 / Constants.targetHz);

        //Get dimensions of car sprite
        float length = GetComponentInChildren <Renderer>().bounds.size.x;
        float width  = GetComponentInChildren <Renderer>().bounds.size.y;

        carController = new CarController(length);
        steerSys      = new FirstOrderSystem(Constants.carSimSteeringK, Constants.carSimSteeringTau, Constants.targetHz, 0f);
        throttleSys   = new AsymmetricFirstOrderSystem(Constants.carSimVelK, Constants.carSimVelIncreaseTau, Constants.carSimVelDecreaseTau, Constants.targetHz, 0f);

        // Set initial car state
        carState = new CarState(0, transform.position.z, transform.position.x, 0, length / 2, length / 2);
    }
    private void Start()
    {
        // Reference to the current scene
        Scene  currentScene = SceneManager.GetActiveScene();
        string sceneName    = currentScene.name;

        if (currentScene.name == "AgentTrainingEnvironment")
        {
            isTrainingMode = true;
        }

        // Initialize system
        trackVelSubscriber = gameObject.GetComponent(typeof(TwistStampedSubscriber)) as TwistStampedSubscriber;
        trackController    = new TrackController();
        sys = new AsymmetricFirstOrderSystem(Constants.trackSimK, Constants.trackSimIncreaseTau, Constants.trackSimDecreaseTau, Constants.targetHz, 0f);
    }
    void Start()
    {
        InvokeRepeating("ModifyGoal", 0f, 10f);        //for testing to set goal
        InvokeRepeating("CalculateControls", 0f, 1 / Constants.targetHz);

        //Get dimensions of car sprite
        float length = GetComponent <SpriteRenderer>().bounds.size.x;
        float width  = GetComponent <SpriteRenderer>().bounds.size.y;

        Debug.Log(string.Format("car length: {0}", length));

        carController = new CarController(length);
        steerSys      = new FirstOrderSystem(Constants.carSimSteeringK, Constants.carSimSteeringTau, Constants.targetHz, 0f);
        throttleSys   = new AsymmetricFirstOrderSystem(Constants.carSimVelK, Constants.carSimVelIncreaseTau, Constants.carSimVelDecreaseTau, Constants.targetHz, 0f);

        // Set initial car state
        // TODO: use the car's current direction as psi? DEVANSH
        carState = new CarState(0, transform.position.x, transform.position.y, 0, length / 2, length / 2);
    }
Example #6
0
    void Start()
    {
        InvokeRepeating("UpdateGoal", 0f, 1f);        //for testing to set goal
        InvokeRepeating("UpdateCar", 0f, 1 / Constants.targetHz);

        //Get dimensions of car sprite
        length = GetComponentInChildren <Renderer>().bounds.size.x;
        width  = GetComponentInChildren <Renderer>().bounds.size.y;
        Debug.Log(string.Format("car length: {0}", length));
        Debug.Log(string.Format("car width: {0}", width));

        carController = new CarController(length);
        steerSys      = new FirstOrderSystem(Constants.carSimSteeringK, Constants.carSimSteeringTau, Constants.targetHz, 0f);
        throttleSys   = new AsymmetricFirstOrderSystem(Constants.carSimVelK, Constants.carSimVelIncreaseTau, Constants.carSimVelDecreaseTau, Constants.targetHz, 0f);

        // Set initial car state
        transform.position = new Vector3(Constants.goalCoordinates.x, 1, Constants.goalCoordinates.z);
        carState           = new CarState(0, transform.position.z, transform.position.x, 0, length / 2, length / 2);
    }
Example #7
0
 public void ResetParams()
 {
     carController = new CarController(length);
     steerSys      = new FirstOrderSystem(Constants.carSimSteeringK, Constants.carSimSteeringTau, Constants.targetHz, 0f);
     throttleSys   = new AsymmetricFirstOrderSystem(Constants.carSimVelK, Constants.carSimVelIncreaseTau, Constants.carSimVelDecreaseTau, Constants.targetHz, 0f);
 }