Skip to main content

Generate Code with Workflows

Now that you have a component-based system design all wired up, it is time to use Tangram Pro™ to generate a Component Software Interface (CSI) — code that will allow components to pass the messages you specified to other components or systems. I know what you might be thinking... "Generated code is rubbish! It just spits out a template, but you still have to do all the real work." Well, in the case of our generated CSI, it is fully executable and the "real work" is done for you, saving you a ton of time on the tedious code, so that you can work on the code that matters to you. Plus, the output is your choice, C++ or Rust!

You'll learn how to:

  • Configure a Workflow
  • Select a Message Transport
  • Generate and Download Interface Code

Step 1: Configure a Workflow

In Tangram Pro™, Workflows are a key piece to tightening the linkages between system engineers and software developers to help cross that treacherous gap. Workflows are created at the Project level, and persist as part of the system design model even as changes are made. Running a workflow will generate ready-to-run interface code based on the components and connections included in your design.

How to configure a Workflow

We are going to generate the CSI for the Communications component. If you haven't already, complete the previous tutorial to design your system: Visualize a Project Design.

  1. Click Workflow in your UAS Project Workflow Mode
  2. Select the Communications component in the list
  3. Enable Generate Interface Code and select C++ for the Output Language
  4. Enable Compile Code and keep all entered for the Make target options Preflight
  5. Notice how Preflight shows a caution symbol. This is because we haven't selected a Message Transport yet, let's do that next. Preflight validation also checks to make sure your design, the interfaces and connections are valid.
  6. Click the pencil icon in the Message Transports section
  7. Select ZeroMQTransport
  8. Notice how Preflight is now green and the Run button is enabled. Our design is valid, now let's generate code!

Step 2: Run your Workflow

Generating executable C++ code by running a Workflow is incredibly easy with Tangram Pro™. You'll be provided with source code that can be used as an API to integrate different pieces of software.

  1. Click Run to kick off the Workflow you just configured
  2. Streaming logs will display as it runs in the cloud and this process may take a few minutes Run

While it runs you can click Exit Run or even leave the page and the workflow will continue to run in the cloud. Click on Runs within your project to return to it or any previous runs. A notification will pop up when it's completed.

Step 3: Download Code

Download the file linked to the Compile Code task to see the results of the Tangram Pro™ Workflow. The extracted file will contain a fully generated and built CSI (Component Software Interface).

  1. Wait until your Workflow Run completes
  2. Click on the disk icon in the Compile Code task to download the generated and compiled code Download Artifacts
  3. Extract the downloaded file and you'll see a folder named code-gen. This contains all the generated source code Code


By completing this tutorial, you've learned to generate a CSI by running a Workflow in Tangram Pro™!

Check out what you accomplished:

  • Configured a Workflow
  • Defined a Message Transport for the project
  • Ran your workflow to produce an executable CSI

Our blog is another great place to learn more!


Join Discuss, our Tangram Flex community to find out more about Workflows, ask questions, or provide feedback.

Ready to see you how your CSI in action? Make your way to the next tutorial below!