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

Deterministic planning for OMPL #1

Open
tlpss opened this issue Mar 7, 2024 · 5 comments
Open

Deterministic planning for OMPL #1

tlpss opened this issue Mar 7, 2024 · 5 comments

Comments

@tlpss
Copy link

tlpss commented Mar 7, 2024

would be nice to have a convenient way to fix the seed (or maybe have this as default) so that generated plans are deterministic

@Victorlouisdg
Copy link
Contributor

I tried this:

from ompl import util as ou

ou.RNG().setSeed(1)

But that gives the following error, even when you run it in the first cell of a notebook.

Error:   Random number generation already started. Changing seed now will not lead to deterministic sampling.
         at line 78 in [/project/src/ompl/util/src/RandomNumbers.cpp](https://file+.vscode-resource.vscode-cdn.net/project/src/ompl/util/src/RandomNumbers.cpp)

@Victorlouisdg
Copy link
Contributor

Ok some progress, you can set the seed of the RNG object in its constructor:
image

However, I don't know yet if and how I can change the RNG object used by the SimpleSetup. I've found that StateSampler objects have a protected .rng_ attribute. And I've also found how you can allocate a new ValidStateSampler:
image

I'm still missing two things:

  • How I configure the SimpleSetup to use the new ValidStateSampler
  • How I change/set the RNG that ValidStateSampler uses

Additionally, there is a Python example on how to inherit from ValidStateSampler.

@Victorlouisdg
Copy link
Contributor

A bit more progress, apparent

I've tried setting the allocator of the StateSpace use by my SimpleSetup like so:

def allocDeterministicStateSampler(space: ob.StateSpace) -> ob.StateSampler:
    return ob.RealVectorDeterministicStateSampler(space)

space.setStateSamplerAllocator(ob.StateSamplerAllocator(allocDeterministicStateSampler))

But I'm still not getting deterministic plans. When I create two different SimpleSetups and plan to the same goal, I still get two different paths. Maybe it's due to the path simplification also being random?

@zkytony
Copy link

zkytony commented Jul 15, 2024

Any updates on this issue?

@Victorlouisdg
Copy link
Contributor

Hi Kaiyu, no we haven't had the time to figure this out yet, but this definitely still something we want in the future for repeatable testing.

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

No branches or pull requests

3 participants