-
Notifications
You must be signed in to change notification settings - Fork 65
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
Conversation
josephduchesne
commented
Jun 6, 2018
- 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, |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
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_), |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
flatland_plugins/src/laser.cpp
Outdated
} | ||
}); | ||
} | ||
|
||
// 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_); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
Added threadpool to laser plugin, fixed bug with plugin enabled param…