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

Added threadpool to laser plugin, fixed bug with plugin enabled param… #47

Merged
merged 3 commits into from
Jun 7, 2018

Conversation

josephduchesne
Copy link
Member

  • added threadpool to laser plugin (~5x speedup of flatland on 4C/8T i7-4790k)
  • fixed bug with plugin enabled parameter
  • added better documentation about third party libraries and licenses used
  • bumped version number to 1.1.1

laser_point.y = m_world_laser_points_(1, i);
LaserCallback cb(this);

GetModel()->GetPhysicsWorld()->RayCast(&cb, laser_origin_point,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this is thread safe?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked into it and it doesn't seem to modify the physics world state at all

return std::make_pair<double, double>(NAN, 0);
} else {
return std::make_pair<double, double>(
cb.fraction_ * this->range_ + this->noise_gen_(this->rng_),
Copy link

@kubuqi kubuqi Jun 6, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

std::normal_distribution might not be thread safe. Is it possible to move this noise generator to cb object so that nobody shares it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can move the noise out of the thread

}
});
}

// Unqueue all of the future'd results
for (unsigned int i = 0; i < laser_scan_.ranges.size(); ++i) {
auto result = results[i].get(); // Pull the result from the future
laser_scan_.ranges[i] = result.first;
laser_scan_.ranges[i] = result.first + this->noise_gen_(this->rng_);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@josephduchesne josephduchesne merged commit 96713dd into master Jun 7, 2018
JoaoCostaIFG pushed a commit to JoaoCostaIFG/flatland that referenced this pull request Nov 30, 2022
Added threadpool to laser plugin, fixed bug with plugin enabled param…
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.

3 participants