RoboJackets / rrt

C++ RRT (Rapidly-exploring Random Tree) Implementation
Other
253 stars 84 forks source link

Repeatable experiments #83

Closed steenax86 closed 7 years ago

steenax86 commented 7 years ago

Is there a way to set a seed in the code such that the number of steps (or trees) stay the same for a fixed obstacle setup?

Thanks, Steena

jgkamat commented 7 years ago

Hi @steenax86!

I don't think that there is a way to do this currently, but I think that this is a very useful feature to have!

Right now, I think the best way to solve this would be https://github.com/RoboJackets/rrt/issues/25, after which we could add a random seed parameter to the RRT gui, and have reproducable RRT runs that way (by supplying a seed).

@joshhting, do you have enough free time to take a look at https://github.com/RoboJackets/rrt/issues/25 (or find someone to delegate it to)? It's had a lot of back/forth for a while with no progress, so it would be nice to have someone step up :). Unfortunately I have way too much to do to try and take a look at this.

I think that this could be a bit of work, I heard from Jeremy that the random libraries we use are a little bit weird, so that might need to be changed too.

steenax86 commented 7 years ago

Hi @jgkamat Thank you very much! This will be very useful to have. I tried using srand(1) to no effect. I suspect the fix will need a deeper investigation. I look forward to the official fix!

JNeiger commented 7 years ago

If you are cool with a quick and dirty fix, add the lines

unsigned short seed[3] = {0, 0, 0};
seed48(seed);

into the reset function of the Tree class in the file Tree.hpp. This assumes the initial seed is 0 also.

Here's a gist of my current file.

steenax86 commented 7 years ago

@JNeiger Excellent! Thank you very much! This fix works for me!

jgkamat commented 7 years ago

It's still a good idea to implement this properly, but the above snippet should help with the implementation (if we decide to keep the same random number generation method we do right now).

Glad it worked for you though! :smile: