Setting up micrortps bridge on VOXL2/Sentinel



  • I'm trying to setup a micrortps_bridge (https://docs.px4.io/main/en/ros/ros2_comm.html) on a VOXL2/Sentinel.

    On one side of the micrortps_bridge, I have a Docker container.
    This Docker container has Ubuntu 20.04, ROS2 foxy, a number of supporting libraries (e.g., gradle, Fast-DDS) and some custom ROS2 SW. From within the Docker container, I am able to run the micrortps_agent and ROS2 SW. It appears that everything on this side of the micrortps_bridge is working.

    On the other side of the micrortps_bridge is the micrortps_client. I am uncertain how to properly set this up on the VOXL2. I found this post (which attempts to setup the bridge on the VOXL1 but had some issues) and this post (which sets up ROS1 on VOXL2). Neither are quite what I am looking for.

    I am wondering if there is any guidance on how to do setup a micrortps_bridge on the VOXL2. @Eric-Katzfey, you were involved in the post from a year ago with @ryan_meagher and @benjamin-linne that attempted to get the micrortps_bridge working on VOXL1. Is there any help/instructions/pointers you can give me?


  • Dev Team

    @jaredjohansen Actually, I don't see anything from me in that thread and, unfortunately, I have not worked with micrortps at all.



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

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


  • Dev Team

    @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.



  • 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!


  • Dev Team

    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



  • 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.)



  • @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.)


  • Dev Team

    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))



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



  • 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


  • Dev Team

    @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?



  • 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.


  • Dev Team

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



  • 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.


Log in to reply