Coder Social home page Coder Social logo

Comments (2)

yannbouteiller avatar yannbouteiller commented on May 20, 2024 2

This workaround does the trick for me:

MAX_NUMBER_OF_GETOBJECTPOSE_TRIALS = 10
def get_ground_truth_gate_poses(self):
        gate_names_sorted_bad = sorted(self.airsim_client.simListSceneObjects("Gate.*"))
        gate_indices_bad = [int(gate_name.split('_')[0][4:]) for gate_name in gate_names_sorted_bad]
        gate_indices_correct = sorted(range(len(gate_indices_bad)), key=lambda k: gate_indices_bad[k])
        gate_names_sorted = [gate_names_sorted_bad[gate_idx] for gate_idx in gate_indices_correct]
        res = []
        for gate_name in gate_names_sorted:
            p = self.airsim_client.simGetObjectPose(gate_name)
            cpt = 0
            while (math.isnan(p.position.x_val) or math.isnan(p.position.y_val) or math.isnan(p.position.z_val)) and cpt < MAX_NUMBER_OF_GETOBJECTPOSE_TRIALS:
                print(f"DEBUG: {gate_name} position is nan, retrying...")
                cpt = cpt + 1
                p = self.airsim_client.simGetObjectPose(gate_name)
            assert not math.isnan(p.position.x_val), f"ERROR: {gate_name} p.position.x_val is still {p.position.x_val} after {cpt} trials"
            assert not math.isnan(p.position.y_val), f"ERROR: {gate_name} p.position.y_val is still {p.position.y_val} after {cpt} trials"
            assert not math.isnan(p.position.z_val), f"ERROR: {gate_name} p.position.z_val is still {p.position.z_val} after {cpt} trials"
            res.append(p)
        return res

from airsim-neurips2019-drone-racing.

madratman avatar madratman commented on May 20, 2024

This is happening very rarely coz of an unreal APIs we're using the backend - getAllActors - which fail randomly.
I've incorporated your suggestion in the baseline racer. It makes sense for the simgetobjectpose API to return NaN when object is not found, and the user to check it coz of this edge case
Didn't want to throw an error, which might kill the user's script

from airsim-neurips2019-drone-racing.

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.