Skip to content

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

Merged
josephduchesne merged 3 commits into
masterfrom
laser-plugin-threadpool
Jun 7, 2018
Merged

Added threadpool to laser plugin, fixed bug with plugin enabled param…#47
josephduchesne merged 3 commits into
masterfrom
laser-plugin-threadpool

Conversation

@josephduchesne

Copy link
Copy Markdown
Collaborator
  • 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
Copy Markdown
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
Copy Markdown
Collaborator 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

Comment thread flatland_plugins/src/laser.cpp Outdated
return std::make_pair<double, double>(NAN, 0);
} else {
return std::make_pair<double, double>(
cb.fraction_ * this->range_ + this->noise_gen_(this->rng_),

@kubuqi kubuqi Jun 6, 2018

Copy link
Copy Markdown

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
Copy Markdown
Collaborator 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

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
Copy Markdown

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