Closed allsey87 closed 3 years ago
@allsey87 We'd welcome a PR! @julianoes FYI
Well, I have used this as a starting point to write my own MAVLink interface for integration into the ARGoS Simulator. During this process, I have made a far more simplified version of this example which I can share with you if you are interested
@allsey87 Yes, would appreciate a PR of new/updated example. I'm not particularly good at C/C++ but I'll ask another team member to look at it.
Fixed. Closing :-). Thanks! Still interested in a PR if you think it better highlights how to approach this problem.
I have been going through this code and thought I would point out that
current_setpoint
is written from the main thread and read from the writing thread without any protection (i.e., a mutex or a lock). Although unlikely, it possible thatcurrent_setpoint
is read by the writing thread while being written from the main thread which could result in things going to hell very quickly since we are talking about a quadcopter or similar here.In contrast to this, I am almost certain that reading and writing to the serial port from different threads just works in POSIX and doesn't need any mutexes.