Tutorial suggestions / issue with genericapi-cpp

Hi. I was able to go through the openAMASE / CSI tutorial and have a few suggestions / requests on this part: Implement Your Component Software Interface (CSI) | Tangram Pro™

  1. In Step 1, it would be very helpful to provide all the download links first and then the VirtualBox instructions. As I am using a native Ubuntu desktop, I had to backtrack to find the necessary files.

  2. My openAMASE showed an error at first due to missing “libcanberra-gtk”. Could you add this to the prerequisites?
    sudo apt-get install libcanberra-gtk-module

  3. I downloaded the UAS component from here: https://docs.tangramflex.io/assets/bin/uas_communication_component.zip

I can run the precompiled binary (lmcp_sender) but I cannot rebuild. The Makefile, on line 10, assumes the existence of a directory named genericapi-cpp which I do not have.

If I go into my own code-gen-3 folder, which I generated from the same tutorial, I have a folder named pkg_deps/genericapi, but no genericapi-cpp. The Makefile here in the code-gen-3 folder also does not work for me. Do you have instructions / advice on what I am missing?

1 Like

John,

Thanks for trying out Tangram Pro. The pkg_deps/genericapi folder contains the same code as genericapi-cpp. The difference is simply the result of a new package management capability being added to Tangram Pro to help users deal with code dependencies. When that package manager runs, it brings dependencies into the pkg_deps folder and genericapi-cpp is a direct dependency of the CSI you are working with. So I would make that simple change to the Makefile and see where that gets you. It’s unclear if there’s another issue in play or not but if there are further details we can help with, please feel free to elaborate.

Eric Zwirner
eric.zwirner@tangramflex.com

1 Like

Hi John - Welcome to the community and thanks for your question and the feedback on the tutorials! Hopefully Eric’s post gets you up and running. I’ll be sure to update the tutorials for items 1-3 to prevent backtracking and the error message you referenced, as well as the detailed instructions re: the pkg_deps folder.

Thanks, Eric!

I was able to get farther. I fixed the Makefile, and after rebuilding my code-gen-3 project I was able to build lmcp_sender. I can launch openAMASE, open the scenario and play. Then, as soon as I run the lmcp_sender executable, openAMASE prints out this error:

Jun 29, 2021 11:56:25 AM avtas.amase.network.TcpServer$SocketThread sendMessage
SEVERE: null
java.lang.NullPointerException
at avtas.amase.network.TcpServer$SocketThread.sendMessage(TcpServer.java:213)
at avtas.amase.network.TcpServer.sendToOthers(TcpServer.java:122)
at avtas.amase.network.TcpServer.messageReceived(TcpServer.java:147)
at avtas.amase.network.TcpServer$SocketThread.run(TcpServer.java:194)

In my other terminal, lmcp_sender prints output like everything is fine, but openAMASE never receives / displays the new UAV. I can revert to the pre-compiled lmcp_sender binary, and it works without this error. Could you recommend how to best debug this?

1 Like

John,

We had a recent update that isn’t apparently pushed to the trial instance yet. Here’s a quick workaround. Either an LMCP CSI with all messages present works or this one-liner code change with associated rebuild should also work. Here’s some instructions for the latter:

This fix is for some code that re-maps object identifiers for LMCP objects when serialized to be sent out on the wire. OpenAMASE fails since the expected object ID value is incorrect in some cases.

  1. In code-gen-3/src, modify DerivedEntityFactory.cpp as follows (change the
    “return false” to a “return true”) and save the file:

    bool DerivedEntityFactory::remap(std::string name, uint32_t newID) {

    std::map<std::string, EntityMaker *>::iterator nameMapIt = nameMap.find(name);
    if (nameMapIt == nameMap.end()) {
    //return false;
    return true;
    }

  2. In code-gen-3/pkg_deps/genericapi rebuild the genericapi library (NOTE:
    change the INSTALL_PATH location below depending on where your code-gen-3
    folder is):

    make INSTALL_PATH=~/demo/code-gen-3/local_install
    make INSTALL_PATH=~/demo/code-gen-3/local_install install

  3. In code-gen-3 rebuild the CSI library:

    make

  4. In uas_communication_component rebuild the lmcp_sender:

    make clean
    make

We are already aware of this issue and it’s been fixed internally and will be pushed out more broadly very soon. Hopefully this gets you there and if not, please let us know.

Eric

3 Likes

That worked. Thank you!

2 Likes

Glad to hear it. If there’s anything else we can do to help, please let us know.