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

    Setting up micrortps bridge on VOXL2/Sentinel

    VOXL 2
    5
    15
    850
    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.
    • J
      jaredjohansen
      last edited by jaredjohansen

      Oops. Sorry, @Eric-Katzfey! I meant to say @Alex-Kushleyev.

      @Alex-Kushleyev, any help/instructions/pointers you can give?

      1 Reply Last reply Reply Quote 0
      • Alex KushleyevA
        Alex Kushleyev ModalAI Team
        last edited by

        @jacksparkman , sorry, but I have not used micrortps either. In the post you mentioned, i tried to provide help that is not specific to micrortps.

        1 Reply Last reply Reply Quote 0
        • J
          jaredjohansen
          last edited by

          Got it. Thanks. One more follow-up question.

          The VOXL1 had a tool called voxl-px4-shell that gave you access to the PX4 console. I don't see something like that for VOXL2. Will that be a future capability? If so, do you have an estimate on when it'd be available? Thanks!

          1 Reply Last reply Reply Quote 0
          • modaltbM
            modaltb ModalAI Team
            last edited by

            Hi @jaredjohansen ,

            You can, from the Ubuntu shell on VOXL2, run px4-xxx commands to invoke from command line (similar to voxl-px4-shell).

            If you disable the voxl-px4 service from running on bootup, and run it manually, you can get an interactive shell, see this section:

            https://docs.modalai.com/voxl-px4-developer-guide/#how-to-access-the-px4-shell-pxh

            1 Reply Last reply Reply Quote 0
            • J
              jaredjohansen
              last edited by jaredjohansen

              Awesome. That is super helpful! I was able to follow those instructions and access the pxh> shell.

              According to these instructions, if I have access to the NuttShell/System Console (nsh> shell, I believe), I should be able to start the micrortps_client running.

              Is there a way to access the nsh> shell on the VOXL2?

              (For others, I'll note that the nsh> shell is available on the VOXL1, which is nice to simulate things like the GPS signal being lost as described here.)

              1 Reply Last reply Reply Quote 0
              • J
                jaredjohansen
                last edited by

                @James-Strawson , I saw that you worked on the original voxl-px4-shell.

                Do you know if there is a way to access the PX4's nuttx nsh> shell on the VOXL2?

                (For ROS2 to communicate with the PX4 on the VOXL2 through the micrortps_bridge, it is my understanding that I need to start the micrortps_client via the PX4 nuttx shell.)

                1 Reply Last reply Reply Quote 0
                • modaltbM
                  modaltb ModalAI Team
                  last edited by

                  Hi @jaredjohansen ,

                  There's no nuttx on VOXL2, instead of the Nuttx RTOS, there's a QuRT RTOS instead. So the shell you get above is it...

                  For example micrortps_client would need to be enabled in and more than likely ported to work on VOXL2: https://github.com/modalai/px4-firmware/tree/voxl-dev/src/modules/micrortps_bridge

                  See this graphic for some help on orienting yourself:
                  https://docs.modalai.com/voxl-px4-developer-guide/#block-diagram---details

                  This is where we are excluding that driver at this time:
                  https://github.com/modalai/px4-firmware/blob/voxl-dev/boards/modalai/rb5-flight/default.cmake#L90

                  I've not used micrortps in anyway, so info above is just about how one could try to enable the driver and begin looking at porting it (assuming you want it on the ubuntu core (apps_proc))

                  1 Reply Last reply Reply Quote 0
                  • J
                    jaredjohansen
                    last edited by

                    Thanks, @modaltb! What you've pointed me to is very helpful! I'll look into it!

                    1 Reply Last reply Reply Quote 0
                    • Kyungtaek Oh 0K
                      Kyungtaek Oh 0
                      last edited by

                      Hi @modaltb ,

                      I tried to build the voxl-px4 with the voxl-dev branch (which includes the micrortps_bridge).

                      1. On an Ubuntu 20.04 machine, we followed the steps in VOXL 2 PX4 Build Guide to build the rb5-flight-px4-build-docker. This was successful.
                      2. On the same machine, we git cloned the voxl-px4 repository and git updated the submodules (of which px4-firmware is one of them).
                      3. Inside of the voxl-px4 directory, we ran ./run_docker.sh, which started the docker container and gave us a shell inside the docker container (at /usr/local/workspace).
                      4. Inside of the docker, at /usr/local/workspace, we installed fastrtpsgen (i.e., Fast-DDS, Fast-DDS-python, Fast-DDS-Gen).
                      5. We then ran the following commands:
                      git clone px4-firmware
                      cd px4-firmware
                      git checkout voxl-dev
                      git submodule update --init --recursive
                      vi px4-firmware/board/modalai/rb5-flight/default.cmake
                      # Uncomment the micrortps_bridge at line 90
                      # save and exit
                      cd /usr/local/workspace
                      source /home/build-env.sh
                      ./clean.sh 
                      ./build.sh
                      

                      This last step failed with two errors:

                      ERROR #1

                      -- fastrtpsgen version 1.0.4
                      Traceback (most recent call last):
                        File "/usr/local/workspace/px4-firmware/msg/tools/uorb_rtps_classifier.py", line 233, in <module>
                          else Classifier(os.path.join(msg_dir, args.yaml_file), msg_dir))
                        File "/usr/local/workspace/px4-firmware/msg/tools/uorb_rtps_classifier.py", line 55, in __init__
                          self.check_if_listed(yaml_file)
                        File "/usr/local/workspace/px4-firmware/msg/tools/uorb_rtps_classifier.py", line 139, in check_if_listed
                          raise AssertionError(
                      AssertionError: 
                      The following messages are not listen under  /usr/local/workspace/px4-firmware/msg/tools/uorb_rtps_message_ids.yaml: imu_server, parameter_server_set_used_request, parameter_server_set_used_response, parameter_client_reset_response, mavlink, parameter_client_set_value_response, parameter_server_set_value_request, parameter_server_set_value_response, parameter_client_reset_request, parameter_client_set_value_request
                      
                      Please add them to the yaml file with the respective ID and, if applicable, mark them to be sent or received by the micro-RTPS bridge.
                      NOTE: If the message has multi-topics (#TOPICS), these should be added as well.
                      
                      CMake Error at src/modules/micrortps_bridge/CMakeLists.txt:58 (string):
                        string sub-command FIND requires 3 or 4 parameters.
                      
                      
                      Traceback (most recent call last):
                        File "/usr/local/workspace/px4-firmware/msg/tools/uorb_rtps_classifier.py", line 233, in <module>
                          else Classifier(os.path.join(msg_dir, args.yaml_file), msg_dir))
                        File "/usr/local/workspace/px4-firmware/msg/tools/uorb_rtps_classifier.py", line 55, in __init__
                          self.check_if_listed(yaml_file)
                        File "/usr/local/workspace/px4-firmware/msg/tools/uorb_rtps_classifier.py", line 139, in check_if_listed
                          raise AssertionError(
                      AssertionError: 
                      The following messages are not listen under  /usr/local/workspace/px4-firmware/msg/tools/uorb_rtps_message_ids.yaml: imu_server, parameter_server_set_used_request, parameter_server_set_used_response, parameter_client_reset_response, mavlink, parameter_client_set_value_response, parameter_server_set_value_request, parameter_server_set_value_response, parameter_client_reset_request, parameter_client_set_value_request
                      
                      Please add them to the yaml file with the respective ID and, if applicable, mark them to be sent or received by the micro-RTPS bridge.
                      NOTE: If the message has multi-topics (#TOPICS), these should be added as well.
                      
                      CMake Error at src/modules/micrortps_bridge/CMakeLists.txt:74 (string):
                        string sub-command FIND requires 3 or 4 parameters.
                      

                      We checked the uorb_rtps_message_ids.yaml which specifies the message’s id. It doesn't have the messages described in the error line. Can you help us whether we should add these message_ids to the file (or remove them from elsewhere)?

                      ERROR #2

                      [ 45%] Built target rc
                      make[3]: Entering directory '/usr/local/workspace/px4-firmware/build/modalai_rb5-flight_default'
                      Scanning dependencies of target lib__rc__rc_tests
                      make[3]: Leaving directory '/usr/local/workspace/px4-firmware/build/modalai_rb5-flight_default'
                      make[3]: Entering directory '/usr/local/workspace/px4-firmware/build/modalai_rb5-flight_default'
                      [ 45%] Building CXX object src/lib/rc/rc_tests/CMakeFiles/lib__rc__rc_tests.dir/RCTest.cpp.o
                      /usr/local/workspace/px4-firmware/src/lib/rc/rc_tests/RCTest.cpp: In member function ‘bool RCTest::crsfTest()’:
                      /usr/local/workspace/px4-firmware/src/lib/rc/rc_tests/RCTest.cpp:96:88: error: too few arguments to function ‘uint32_t crsf_parse(uint64_t, const uint8_t*, unsigned int, uint16_t*, uint16_t*, uint16_t, uint8_t*, uint8_t*)’
                         96 |    bool result = crsf_parse(now, frame, frame_len, rc_values, &num_values, max_channels);
                            |                                                                                        ^
                      compilation terminated due to -Wfatal-errors.
                      make[3]: *** [src/lib/rc/rc_tests/CMakeFiles/lib__rc__rc_tests.dir/build.make:63: src/lib/rc/rc_tests/CMakeFiles/lib__rc__rc_tests.dir/RCTest.cpp.o] Error 1
                      make[3]: Leaving directory '/usr/local/workspace/px4-firmware/build/modalai_rb5-flight_default'
                      make[2]: *** [CMakeFiles/Makefile2:8186: src/lib/rc/rc_tests/CMakeFiles/lib__rc__rc_tests.dir/all] Error 2
                      make[2]: Leaving directory '/usr/local/workspace/px4-firmware/build/modalai_rb5-flight_default'
                      make[1]: *** [Makefile:152: all] Error 2
                      make[1]: Leaving directory '/usr/local/workspace/px4-firmware/build/modalai_rb5-flight_default'
                      make: *** [Makefile:222: modalai_rb5-flight_default] Error 2
                      

                      We checked the crsf_parse and it requires two additional arguments, leading us to believe that we have mismatched code versions. Can you help us know whether this is true (and if so, how we can bring all the SW versions into sync)?

                      For reference, the complete log from running build.sh can be found here

                      Eric KatzfeyE 1 Reply Last reply Reply Quote 0
                      • Eric KatzfeyE
                        Eric Katzfey ModalAI Team @Kyungtaek Oh 0
                        last edited by

                        @Kyungtaek-Oh-0 First of all, https://docs.modalai.com/voxl2-px4-build-guide/ is not completely correct so sorry about that. We will update that today. But basically you need to prepare the Docker image which it looks like you did successfully. Then you need to build the PX4 code with these instructions: https://gitlab.com/voxl-public/voxl-sdk/services/voxl-px4/-/blob/dev/README.md. If you don't make any changes to default.cmake does that work for you?

                        1 Reply Last reply Reply Quote 0
                        • Kyungtaek Oh 0K
                          Kyungtaek Oh 0
                          last edited by

                          Thank you @Eric-Katzfey! That sound's great!

                          When I changed nothing including "default.cmake", it worked for me and it could run on voxl2.
                          The error only occurred when changing default.cmake line 90.

                          Eric KatzfeyE 1 Reply Last reply Reply Quote 0
                          • Eric KatzfeyE
                            Eric Katzfey ModalAI Team @Kyungtaek Oh 0
                            last edited by

                            @Kyungtaek-Oh-0 Okay, that's not something any of us has tried yet.

                            1 Reply Last reply Reply Quote 0
                            • Kyungtaek Oh 0K
                              Kyungtaek Oh 0
                              last edited by Kyungtaek Oh 0

                              Hi @Eric-Katzfey,
                              We had some finds.
                              Here's what we've understood so far:

                              1. Two things are needed to make a voxl-px4 package using px4-firmware(voxl-dev)
                                • modalai_rb5-flight_default
                                • modalai_rb5-flight_qurt
                              2. And each one needs the following different crsf_parse function
                                • modalai_rb5-flight_default needs crsf_parse(6 arguments)
                                • modalai_rb5-flight_qrut needs crsf_parse(8 arguments)
                              3. Each px4-firmware has a different version of crsf_parse
                                • Branch: main has crsf_parse(6 arguments)
                                • Branch: voxl-dev has crsf_parse(8 arguments)

                              Our goal was to build the voxl-px4 included MicroRTPS_bridge in px4-firmware(branch: voxl-dev), so we added the following two functions to crsf.cpp in px4-firmware.

                              • bool crsf_parse_buffer(uint16_t *values, uint16_t *num_values, uint16_t max_channels)
                                • as crsf_parse_buffer_6
                              • bool crsf_parse(const uint64_t now, const uint8_t *frame, unsigned len, uint16_t *values, uint16_t *num_values, uint16_t max_channels)
                                • as crsf_parse_6

                              Then the build progressed to 89% and stopped with an error below.
                              ERROR #1

                              [ 89%] Building CXX object src/systemcmds/pwm/CMakeFiles/systemcmds__pwm.dir/pwm.cpp.o
                              /usr/local/workspace/px4-firmware/src/systemcmds/pwm/pwm.cpp: In function 'int pwm_main(int, char**)':
                              /usr/local/workspace/px4-firmware/src/systemcmds/pwm/pwm.cpp:810:3: error: 'qurt_loop' was not declared in this scope
                                810 |   qurt_loop = 320;
                                    |   ^~~~~~~~~
                              compilation terminated due to -Wfatal-errors.
                              make[3]: *** [src/systemcmds/pwm/CMakeFiles/systemcmds__pwm.dir/build.make:63: src/systemcmds/pwm/CMakeFiles/systemcmds__pwm.dir/pwm.cpp.o] Error 1
                              make[3]: Leaving directory '/usr/local/workspace/px4-firmware/build/modalai_rb5-flight_default'
                              make[2]: *** [CMakeFiles/Makefile2:12085: src/systemcmds/pwm/CMakeFiles/systemcmds__pwm.dir/all] Error 2
                              make[2]: Leaving directory '/usr/local/workspace/px4-firmware/build/modalai_rb5-flight_default'
                              make[1]: *** [Makefile:152: all] Error 2
                              make[1]: Leaving directory '/usr/local/workspace/px4-firmware/build/modalai_rb5-flight_default'
                              make: *** [Makefile:222: modalai_rb5-flight_default] Error 2
                              

                              We changed the int qurt_loop variable's scope to like this.

                              • Before
                                32b86fac-1631-4048-b2ce-a29792ee533b-Untitled.png
                              • After
                                f6a25f03-3c63-4f66-92e4-b3181adacef6-Untitled (1).png

                              After that, an error occurred for the label for jump, and it was resolved by changing it as follows.
                              ERROR #2

                              [ 89%] Building CXX object src/systemcmds/pwm/CMakeFiles/systemcmds__pwm.dir/pwm.cpp.o
                              /usr/local/workspace/px4-firmware/src/systemcmds/pwm/pwm.cpp: In function 'int pwm_main(int, char**)':
                              /usr/local/workspace/px4-firmware/src/systemcmds/pwm/pwm.cpp:864:1: error: jump to label 'err_out_no_test_2'
                                864 | err_out_no_test_2:
                                    | ^~~~~~~~~~~~~~~~~
                              compilation terminated due to -Wfatal-errors.
                              make[3]: *** [src/systemcmds/pwm/CMakeFiles/systemcmds__pwm.dir/build.make:63: src/systemcmds/pwm/CMakeFiles/systemcmds__pwm.dir/pwm.cpp.o] Error 1
                              make[3]: Leaving directory '/usr/local/workspace/px4-firmware/build/modalai_rb5-flight_default'
                              make[2]: *** [CMakeFiles/Makefile2:12085: src/systemcmds/pwm/CMakeFiles/systemcmds__pwm.dir/all] Error 2
                              make[2]: Leaving directory '/usr/local/workspace/px4-firmware/build/modalai_rb5-flight_default'
                              make[1]: *** [Makefile:152: all] Error 2
                              make[1]: Leaving directory '/usr/local/workspace/px4-firmware/build/modalai_rb5-flight_default'
                              

                              So we changed the goto command to "return 0" instead of using err_out_no_test_2 label.

                              After that, the build.sh worked and the make_packages.sh also worked.(in the voxl-px4)
                              However, it did not run with the following error on voxl2.
                              ERROR #3

                              voxl2:~$ voxl-px4
                              Found DSP signature file
                              /usr/bin/voxl-px4: line 42: /usr/bin/px4: cannot execute binary file: Exec format error
                              

                              Based on the above results, we think the voxl-px4 with microRTPS_bridge can be built by changing modalai_rb5-flight_default and modalai_rb5-flight_qurt to use the same crsf_parse.

                              So if you think our thinking is correct, can you give us some guidance?
                              If it is not possible in px4-firmware(branch: voxl-dev), can we build voxl-px4(included micrortps_bridge) using another branch?
                              Any advice would be appreciated.

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