Skip to content

Commit

Permalink
prevent GoalStates::sampleGoal from rolling over prematurely. Fix tha…
Browse files Browse the repository at this point in the history
…nks to Jonathan Gammell. Closes #155
  • Loading branch information
mamoll committed Jul 30, 2015
1 parent 7b3fa36 commit 6686801
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/ompl/base/goals/src/GoalStates.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,12 @@ void ompl::base::GoalStates::sampleGoal(base::State *st) const
{
if (states_.empty())
throw Exception("There are no goals to sample");

// Roll over the samplePosition_ if it points past the number of states.
samplePosition_ = samplePosition_ % states_.size();
// Get the next state.
si_->copyState(st, states_[samplePosition_]);
samplePosition_ = (samplePosition_ + 1) % states_.size();
samplePosition_++;
}

unsigned int ompl::base::GoalStates::maxSampleCount() const
Expand Down

0 comments on commit 6686801

Please sign in to comment.