After starting a new thread, using the TemplateModule, the program crashes with segmentation fault when I declare a variable from mavlink structures inside the new thread. Can anyone find the error in those three pieces of code?
Segmentation fault when I uncomment mavlink_hearbeat_t variable and mavlink_message_t variable and function mavlink_msg_heartbeat_encode:
And any subscriber does not seem to work inside this new thread. So I can’t get any values from parameters. The subscribers just work at the main thread. Any idea how to solve it?
Solved. The template_module causes problems when I create another thread and need to use some subscribers (declared at the header) inside it. The solution I found was to create a new module based on the example from the simulator module. No more Segmentation fault when using another thread. You can delete this post.