Giter Site home page Giter Site logo

Unity Connection time out! about flightmare HOT 5 OPEN

simonjeger avatar simonjeger commented on June 26, 2024
Unity Connection time out!

from flightmare.

Comments (5)

simonjeger avatar simonjeger commented on June 26, 2024

In the "dev/version_22" branch different type of objects (dynamic and static objects) can be passed to flightmare_unity (see flightmare/flightlib/src/envs/vision_env/vision_env.cpp, line 67-82) and that's not yet implemented on the flightmare_unity "master" branch.

So I propose to use flightmare_unity "dev/agile_flight" branch instead. Now if you don't have any static objects in a .csv file, you'll still get an error. I therefore adapted the following lines to catch that case (not sure if that's a good fix but it worked for me):

In flightmare_unity/Asset/Flightmare/Script/CameraController.cs replace the following (line 706 - 722)

void instantiateObjects()
    {
      config_object.ReadCSVFile(internal_state, settings.object_csv, ListToVector3(settings.render_offset));
      // 
      // Initialize additional objects
      foreach (var obj_state in settings.static_objects)
      {
        GameObject prefab = Resources.Load(obj_state.prefabID) as GameObject;
        // Debug.Log("obj_state id : " + obj_state.ID);
        // GameObject obj = internal_state.getGameobject(obj_state.ID, gate_template); 
        GameObject obj = internal_state.getGameobject(obj_state.ID, prefab);
        obj.transform.localScale = ListToVector3(obj_state.size);
        Vector3 obj_position = ListToVector3(obj_state.position) + ListToVector3(settings.render_offset);
        obj.transform.SetPositionAndRotation(obj_position, ListToQuaternion(obj_state.rotation));
        obj.transform.localScale = ListToVector3(obj_state.size);
        // obj.layer = 9;
      }

with

void instantiateObjects()
    {
      try
      {
        config_object.ReadCSVFile(internal_state, settings.object_csv, ListToVector3(settings.render_offset));
        // 
        // Initialize additional objects
        foreach (var obj_state in settings.static_objects)
        {
          GameObject prefab = Resources.Load(obj_state.prefabID) as GameObject;
          // Debug.Log("obj_state id : " + obj_state.ID);
          // GameObject obj = internal_state.getGameobject(obj_state.ID, gate_template); 
          GameObject obj = internal_state.getGameobject(obj_state.ID, prefab);
          obj.transform.localScale = ListToVector3(obj_state.size);
          Vector3 obj_position = ListToVector3(obj_state.position) + ListToVector3(settings.render_offset);
          obj.transform.SetPositionAndRotation(obj_position, ListToQuaternion(obj_state.rotation));
          obj.transform.localScale = ListToVector3(obj_state.size);
          // obj.layer = 9;
        }
      }
      catch (Exception)
      {
        print("No static objects found");
      }
    }

from flightmare.

RibhavOjha avatar RibhavOjha commented on June 26, 2024

Hi
Which directory did you put the "flightmare_unity" repo?

from flightmare.

simonjeger avatar simonjeger commented on June 26, 2024

I don't think it matters where you put the flightmare_unity folder. You just need to click play when you run flightmare.

from flightmare.

RibhavOjha avatar RibhavOjha commented on June 26, 2024

I am also in the dev/version_22 branch to run the RL example.
I have trained the RL model, and wanted to visualise it user --render 1.

Flightmare has this in their documentation:
"
To use unity rendering, you need first download the binary from Releases and extract it into the flightrender folder. To enable unity for visualization, double click the extracted executable file RPG_Flightmare.x84-64 and then test a pre-trained controller
"

I double click the RPG_Flightmare.x84-64 in the directory: flightmare/flightrender/RPG_Flightmare/RPG_Flightmare.x84-64. I get this:
Screenshot from 2024-01-26 11-29-48
After that, i go to flightpy/flightrl and run python3 run_control_demo.py --train 0 --render 1

It just says unity connection timed out.
Could you please tell me what might be wrong here? You pointed out that it is something to do with flightmare_unity, but where are we even using it?

Thank you

from flightmare.

RibhavOjha avatar RibhavOjha commented on June 26, 2024

Hey, I cloned flightmare_unity, built everything from scratch from https://github.com/uzh-rpg/flightmare/blob/master/docs/source/building_flightmare_binary/standalone.rst
And then followed steps as outlined by you. I can see the drone on unity now.

Thanks!

from flightmare.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.