-
Notifications
You must be signed in to change notification settings - Fork 10
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
Adds simulation and mockup threads for drilling machine plugin #13
base: rockin
Are you sure you want to change the base?
Conversation
@@ -18,7 +18,7 @@ llsfrb: | |||
status_port: !tcp-port 55501 | |||
|
|||
drilling-machine: | |||
enable: false | |||
mode: mockup |
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.
In my opinion we can enable the simulation by default. What do you think?
Besides my comments this looks good. Please fix or provide feedback. |
@svenschneider - feedback has been integrated |
|
||
void DrillingMachineSimulationThread::loop() | ||
{ | ||
fawkes::MutexLocker lock2(&drill_machine_mutex_); |
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 together with the last line in this function leads to a horrible lockup of the complete CFH:
- The scoped lock is acquired here
- In the last line the thread goes to sleep, but does not release the lock. Therefore, all calls that also need to lock the mutex will wait.
My proposal is to manually release the lock before sending the thread to sleep.
Additionally, why is the variable here (and in other places) called lock2?
Please integrate the feedback, squash the commits appropriately and update the pull request. When squashing the commits please also update the commit messages. The convention for the subject line is "component: message", where the message is all lower-case and limited to 50 characters. Component is the "top-level" folder of the changed file(s), here component should be "plugins" (within the rockin folder). |
Any update? |
- Adds simulation and mockup threads for drilling machine plugin - Default Drilling Machine config to simulation
6b4fb07
to
17b1dde
Compare
@svenschneider - update, I fixed all the feedback and rebased squashing commits. I used
There are still some comments about locking the mutex. Should I be locking it there? |
The existing code (hopefully) may work because the variable that is read, and concurrently written from somewhere else, atomically. Therefore, the assumptions for this code being correct are:
Thus, in my opinion the safe way is to lock the mutex for each access (read and write). Could you please check if this has any noticable effect? |
@svenschneider I've added the lock(clips_mutex) to both the simulation and real thread. |
last_command_msg_.set_command(drill_command); | ||
last_sent_command_timestamp_ = boost::posix_time::microsec_clock::local_time(); | ||
|
||
logger->log_info("DrillingMachineSim", "Send drill command: %d", drill_command); |
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 just saw that this is "spamming" the terminal. Therefore, I would suggest to use "logger->log_debug([...])".
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.
should I modify that in the other plugins as well? And the non-simulated versions?
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.
Yes, would be nice.
Thanks, there is one more minor issue about the logging. When that feedback is integrated, we should be ready to go. |
I removed some of the logging and switched some log_debug as suggested. |
Adds drilling_machine_simulation_thread and drilling_machine_mockup_thread
In simulation mode, the drilling machine the operation is simulated.
In mockup mode, clips functions are exposed but nothing is simulated.
This pull request closes #10. Feedback and re-factoring has been incorporated.