-
Notifications
You must be signed in to change notification settings - Fork 943
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
Improve JogArm thread handling #1816
Improve JogArm thread handling #1816
Conversation
56d0568
to
819b726
Compare
Codecov Report
@@ Coverage Diff @@
## master #1816 +/- ##
==========================================
+ Coverage 48.44% 48.51% +0.07%
==========================================
Files 297 298 +1
Lines 23278 23301 +23
==========================================
+ Hits 11276 11304 +28
+ Misses 12002 11997 -5
Continue to review full report at Codecov.
|
116e9ba
to
85a46bc
Compare
The integration tests still pass, the tutorial still works, the CPU load looks like it hasn't changed much. Looking good so far. Now I'll review the code. |
@@ -49,7 +49,7 @@ int main(int argc, char** argv) | |||
|
|||
// Run the jogging C++ interface in a new thread to ensure a constant outgoing message rate. | |||
moveit_jog_arm::JogCppApi jog_interface; | |||
std::thread jogging_thread(&moveit_jog_arm::JogCppApi::mainLoop, &jog_interface); | |||
std::thread jogging_thread([&]() { jog_interface.startMainLoop(); }); |
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.
This syntax is weird to me. What's going on here?
Is this similar to this
?
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.
This is a lambda.
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 don't see any issues with the code. 👍
This moves thread handling to the JogBaseInterface class and adds atomic bool flags for stopping all main loops from outside their threads.
Also, this fixes an issue where the
CollisionCheckThread
would indefinitely wait for command messages and won't get to run any collision checks using the C++ API.