ModalAI Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    How to receive GPS information in voxl-tflite-server?

    VOXL
    2
    9
    301
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Nguyen Tien SuN
      Nguyen Tien Su
      last edited by

      I need to have GPS information such as latitude, and longitude, ... to process in voxl-tflite-server c++ code. How can I do it?

      1 Reply Last reply Reply Quote 0
      • ?
        A Former User
        last edited by

        Hello @Nguyen-Tien-Su,

        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.

        1 Reply Last reply Reply Quote 0
        • Nguyen Tien SuN
          Nguyen Tien Su
          last edited by

          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?

          1 Reply Last reply Reply Quote 0
          • ?
            A Former User
            last edited by

            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"
            1 Reply Last reply Reply Quote 0
            • Nguyen Tien SuN
              Nguyen Tien Su
              last edited by

              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?

              1 Reply Last reply Reply Quote 0
              • ?
                A Former User
                last edited by

                @Nguyen-Tien-Su,
                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();
                
                1 Reply Last reply Reply Quote 0
                • Nguyen Tien SuN
                  Nguyen Tien Su
                  last edited by

                  Hi @Matt-Turi ! This is error.

                  2bb3a8ec-babe-4fe5-b027-b329421355e7-image.png

                  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.

                  1 Reply Last reply Reply Quote 0
                  • ?
                    A Former User
                    last edited by

                    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));
                    
                    
                    1 Reply Last reply Reply Quote 0
                    • Nguyen Tien SuN
                      Nguyen Tien Su
                      last edited by

                      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!

                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post
                      Powered by NodeBB | Contributors