I was going through the Tangram Maker tutorials. In the fourth section, it walked me through the process of creating a workflow and setting up code generation. There was C++ code that I could download after that was finished. My question is, what exactly is this code that was generated? All of the components and implementations that I had made were just names and ports, so I’m not sure what it made.
code-gen will create what we call a CSI (Component Software Interface), which is an API to create and interact with the C++ objects representing the Messages that you chose in your interface. It also includes integration with Tangram’s APIs for message transports and serialization, to make serializing & deserializing message data to and from C++ types and sending them over the wire easier.
For a larger example usage, I can message you with access to an example repo in the Tangram GitLab. For a quick sample, you can use the generated code to construct a message object like this in LMCP:
#include "AirVehicleState.hpp" #include "AirVehicleStateApi.hpp" AirVehicleStateApi sender(&mapi_sender); AirVehicleState* msg = sender.createAirVehicleState(1, 2, 3, 4); msg->getLocation()->setLatitude(39.7620624); msg->getLocation()->setLongitude(-84.1860464); msg->getLocation()->setAltitude(225); msg->getLocation()->setAltitudeType(AltitudeType::MSL);
Generated OMS includes some tests and examples that I would recommend looking at instead, as every message set has its own CSI and may be used differently.
Adding examples and tests to the LMCP code generation would be a great step for us to take in the future.
@grant.linville. I was just working on the Code Gen on Tutorial 4 as well. Were you able to get it to work? I am at the step where you hit “run” and I get the following on the screen:
I did get mine to work the first time. I just experimented with workflows a little bit to see if I could get the same error to happen but it never did. I could get one or both parts of the workflow to fail, but never the unidentified error. Do you have more screenshots you could share?
Thanks @grant.linville. I must have done something wrong as it seems to be running now. I deleted and re-entered everything here is the config for Code-gen I couldn’t fit it all but the output language is cpp. Here is the config for cppcheck.
Hi @mark.stadtmueller, I’m glad it ended up working for you. When I encounter that error it is most often because our artifact storage, Minio, is full. This will cause workflows to die without cause. The workflows team (see @brandon.henry) has been working on a garbage collection service to remove old artifacts to avoid this problem but I don’t know what it’s status is. Given that it ended up working I’d suspect garbage collection works but may have failed to kick in early enough to avoid an overfilled Minio.
@joe.richardson, thanks and understood. So, if I see that again, is there something I can do as a work-around? Refresh or something? Thank you!