Skip to content

fix(grasp-evaluator): timeout check references loop index (+1 more) - #14

Draft
andrewwhitecdw wants to merge 1 commit into
NVlabs:mainfrom
andrewwhitecdw:bugfix/grasp-evaluator-assorted-bb1b211d
Draft

fix(grasp-evaluator): timeout check references loop index (+1 more)#14
andrewwhitecdw wants to merge 1 commit into
NVlabs:mainfrom
andrewwhitecdw:bugfix/grasp-evaluator-assorted-bb1b211d

Conversation

@andrewwhitecdw

@andrewwhitecdw andrewwhitecdw commented Jul 27, 2026

Copy link
Copy Markdown

Small fixes in grasp_evaluator/grasp_evaluator.py:

fix: timeout check references loop index before it is defined

Fix: Replace:

        while not all_done:

            # If the simulation is taking too long, declare fail
            if (timeit.default_timer() - loop_start > self.cfg['timeout']['other_modes']
                    and panda_fsms[i].state not in ['reorient', 'squeeze_no_gravity']) or (
                        timeit.default_timer()
                        - loop_start > self.cfg['timeout']['squeeze_no_gravity']
                        and panda_fsms[i].state == "squeeze_no_gravity"):
                print("Timed out")
                for i in range(len(self.env_handles)):
                    if panda_fsms[i].state != "done":
                        panda_fsms[i].state = "done"
                        panda_fsms[i].timed_out = True

with:

        while not all_done:

            # If the simulation is taking too long, declare fail
            elapsed = timeit.default_timer() - loop_start
            timed_out = False
            for i in range(len(self.env_handles)):
                if (elapsed > self.cfg['timeout']['other_modes']
                        and panda_fsms[i].state not in ['reorient', 'squeeze_no_gravity']) or (
                            elapsed > self.cfg['timeout']['squeeze_no_gravity']
                            and panda_fsms[i].state == "squeeze_no_gravity"):
                    timed_out = True
                    if panda_fsms[i].state != "done":
                        panda_fsms[i].state = "done"
                        panda_fsms[i].timed_out = True
            if timed_out:
                print("Timed out")

fix: retry loop never increments counter on failed URDF update

Fix: Replace:

        # Set object parameters for object material properties
        set_parameter_result = False
        fail_counter = 0
        while set_parameter_result is False and fail_counter < 10:
            try:
                set_parameter_result = self.set_object_parameters(
                    asset_file_object,
                    density=self.density,
                    youngs=self.youngs,
                    poissons=self.poissons)
            except BaseException:
                fail_counter += 1
                pass

with:

        # Set object parameters for object material properties
        set_parameter_result = False
        fail_counter = 0
        while set_parameter_result is False and fail_counter < 10:
            try:
                set_parameter_result = self.set_object_parameters(
                    asset_file_object,
                    density=self.density,
                    youngs=self.youngs,
                    poissons=self.poissons)
            except BaseException:
                pass
            if not set_parameter_result:
                fail_counter += 1

Files changed

  • grasp_evaluator/grasp_evaluator.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant