How to receive GPS information in voxl-tflite-server?
I need to have GPS information such as latitude, and longitude, ... to process in voxl-tflite-server c++ code. How can I do it?
voxl-inspect-gps (https://gitlab.com/voxl-public/voxl-sdk/utilities/voxl-mpa-tools/-/blob/master/tools/voxl-inspect-gps.c) is an example of how to subscribe to the gps pipe and process the data.
Thank you, @Matt-Turi !
I checked the code and understood. But it's error when I include mavlink.h header file from c_library_v2 library into voxl-tflite-server. It said that mavlink.h file not found. How can I solve this problem?
To use the mavlink headers, you must add voxl-mavlink to the required dependencies for the project. This can be done by modifying the install_build_deps.sh script, and simply adding voxl-mavlink to the DEPS_* list depending on your platform.
DEPS_QRB5165=" libmodal-pipe libmodal-json voxl-opencv voxl-mavlink qrb5165-tflite" DEPS_APQ8096=" libmodal-pipe libmodal-json voxl-opencv voxl-mavlink apq8096-tflite"
Thank @Matt-Turi very much !
I am successful to receive GPS in voxl-tflite-server. But I can't open 2 pipes GPS and TFLITE at the same time since they use same channel 0. Their channel seems to be set up by the MPA and can't change. How can I solve this problem?
Did you experience any error messages when you tried this? Subscribing to the gps pipe should be independent of any channels/pipes that the tflite-server opens, as gps is a client connection. See here: https://gitlab.com/voxl-public/voxl-sdk/services/voxl-tflite-server/-/blob/master/src/main.cpp#L344 for an example of opening up a client connection and getting the next avaialble channel automatically using
int ch = pipe_client_get_next_available_channel();
Hi @Matt-Turi ! This is error.
I tried to change the channel of GPS, then I can't receive any GPS message. I also tried to change channel of the TFLITE server but it couldn't start.
Make sure you are setting the callback functions correctly with the next available channel (rather than hardcoding to 0). The tflite-server is only opening one client connection to receive camera frames, so it should be simple to avoid a channel conflict.
If your callback functions are named the same as the inspect-gps example, this code could be pasted in after line https://gitlab.com/voxl-public/voxl-sdk/services/voxl-tflite-server/-/blob/master/src/main.cpp#L354
int ch = pipe_client_get_next_available_channel(); pipe_client_set_simple_helper_cb(ch, _helper_cb, NULL); pipe_client_set_connect_cb(ch, _connect_cb, NULL); pipe_client_set_disconnect_cb(ch, _disconnect_cb, NULL); int ret = pipe_client_open(ch, GPS_RAW_OUT_PATH, PROCESS_NAME, \ EN_PIPE_CLIENT_SIMPLE_HELPER | EN_PIPE_CLIENT_AUTO_RECONNECT, \ sizeof(mavlink_message_t));
Hi @Matt-Turi !
You right. I hardcoded tflite server channel, so I forgot to change it when setting callback function. Now, my code works fine.
Thank you very much for your enthusiastic help!