Multithreading vs ROS nodes
Hi,
My Background: I am currently working on a project involving (Parrot A.R.) drone navigation. I require state estimation and controller module.
Assuming the state estimator and controller are perfectly implemented, I am currently in a dilemma choosing between 2 approaches that I can think of -
1) Solution 1: This solution is known (or) has been implemented by someone
Use C++ multithreading and run 1 loop separately in each of (a total of) 2 threads**.
- StateEstimator Loop: This loop provides state estimate and fills in a Thread safe queue.
- Controller Loop: This loop accesses state estimates from the queue and sends navigation controls to the drone.
2) (Possible) Solution 2: Use a ROS node for each, state estimator node provides state estimate (using topics) while the other controller node uses it to send control signals to the drone.
===============
My Question/Dilemma: The second approach sounds easier to implement than the first. But I'm aware that ROS nodes run as processes while the other approach uses threads. I am not sure if the second one might work, and also how the process scheduling etc may affect my results ...
I am looking for some advice from people's personal experience with ROS and/or drone projects,
Thank you very much !