Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible to "miss" very short missions #118

Closed
DaveyBiggers opened this issue Jun 28, 2016 · 4 comments
Closed

Possible to "miss" very short missions #118

DaveyBiggers opened this issue Jun 28, 2016 · 4 comments
Labels

Comments

@DaveyBiggers
Copy link
Member

DaveyBiggers commented Jun 28, 2016

Most of our samples do something similar to this:

agent_host.startMission( my_mission, my_mission_record )
# Wait for start of mission (is_mission_running flag)
world_state = agent_host.getWorldState()
    while not world_state.is_mission_running:
        time.sleep(0.1)
        world_state = agent_host.getWorldState()

It's possible to create missions that can finish within 0.1 seconds - for example, in a setting where an agent must get to a goal square, but the start and end squares are randomised, it is possible for the agent's initial state to satisfy the end conditions.

In such cases, the above code can end up waiting forever, as the is_mission_running flag can be set and then unset again within the time.sleep() call.

One possible fix is to reduce the sleep time; alternatively, agent_host could have an is_mission_over flag too, instead of relying on is_mission_running.

@DaveyBiggers
Copy link
Member Author

Note that this is only a problem once #23 is fixed, since without that fix very short missions break the mod long before they have a chance to break the agent.

@timhutton
Copy link
Contributor

timhutton commented Jun 28, 2016

Yes. Maybe WorldState could replace is_missing_running with two bools, mission_started and mission_ended.

Then in user code this loop would be:

agent_host.startMission( my_mission, my_mission_record )
# Wait for start of mission (mission_started flag)
world_state = agent_host.getWorldState()
    while not world_state.mission_started:
        time.sleep(0.1)
        world_state = agent_host.getWorldState()

and the main loop would be:

while not world_state.mission_ended:
    ...

@DaveyBiggers
Copy link
Member Author

Am making it a P4 since it will only be a problem for some mission designs, and there's an easy workaround in those cases (reducing the time.sleep value).

@timhutton
Copy link
Contributor

Make startMission block until mission started? New API startMissionAndWait?

Samples should use peekWorldState too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants