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

Feature/multithreading #106

Merged
merged 4 commits into from
Oct 10, 2019
Merged

Feature/multithreading #106

merged 4 commits into from
Oct 10, 2019

Conversation

rikba
Copy link
Collaborator

@rikba rikba commented Oct 10, 2019

Start a simple thread for each receiver after opening the device. The thread reads and processes the SBP message from the device sequentially. It is joined on destruction of the object.

Allows opening multiple devices in the ROS node in parallel. Here we have two receivers outputting the heartbeat message.

Screenshot_2019-10-10_11-13-08

See also #102

michaelpantic
michaelpantic previously approved these changes Oct 10, 2019
Copy link
Member

@michaelpantic michaelpantic left a comment

Choose a reason for hiding this comment

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

Very nice!!
See comments, a few nitpicks.

One comment about the is_running bool - that one I would rename to "thread_exit_requested" and invert the logic, as the is_running property is ambigious due to the fact that the thread also can be asked if its running. otherwise great!

piksi_multi_cpp/src/receiver/receiver.cc Outdated Show resolved Hide resolved
piksi_multi_cpp/src/receiver/receiver.cc Show resolved Hide resolved
piksi_multi_cpp/src/receiver/receiver.cc Outdated Show resolved Hide resolved
@michaelpantic
Copy link
Member

michaelpantic commented Oct 10, 2019

btw I think the assignement and retrieval operators of atomics are overloaded, so no need to call load/store explicitely. On the other hand it also somehow documents that these are atomics, so whatever you prefer 🤷‍♂️ :-)

See https://en.cppreference.com/w/cpp/atomic/atomic/operator%3D

@rikba rikba merged commit 35fc411 into master Oct 10, 2019
@rikba rikba deleted the feature/multithreading branch October 10, 2019 13:29
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.

2 participants