Loading

Uli SDK

Generate Comp Apps

9.Generate Comp Apps

Collections of related services to perform specific tasks are organized into comps. A comp app contains one or more comps. A comp app is an application. You can find comp apps in the uli_sdk/apps directory.

The App Generator generates following files, here, we use exp_pc as an example:

           

  • app_main – the application main program.
  •        

  • BUILD – the bazel build file that defines build targarts:
    •          

    • exp_pc_ – builds the C library, exp_pc_.a for creating Python bindings.
    •          

    • exp_pc – builds the app.
    •          

    • exp_pc-pkg – builds the app package that includes all the needed files for deployment.
           

  • exp_pc.cfg – the configuration file of this comp app exp_pc.
  •        

  • exp_pc.json – contains parameters for the services the comp app. This file is empty, but the defaults will be filled in by running the comp app with argument –params. For example:

    % ./exp_pc –params

       You can then edit this file to specifics.

         

  • Exp_pc.README – the README of this app. You can find configuration and how to run this app here.
  •      

  • lib_main.h and lib_main.cpp – the comp app library main.

Here are the top-level directories:

       

  • config – codes for configuration and command line options of this app.
  •    

  • comp_mobility – codes of the mobility comp.
  •    

  • comp_pose_control – codes of the pose_control comp.
  •    

  • impl_mobility – codes of the services that mobility comp overrides.
  •    

  • impl_pose_control – codes of the services that pose_control comp overrides.

9.1 JSON

Refer to Appendix A, App Generator JSON Example. More examples can be found in uli_sdk/apps/jsons directory.

Here are the explanations:

  • fullname – name of the comp app, including all name spaces. Name is in lower case, under-score separated words.
  • pybindclassname – c++ class name of the Python Binding created for this comp app. The name includes the name space to the pybinds. It indicates where the generated pybind modules should be placed. The name is in camel style, with first letter in upper case.
  • partnumber – part number of this app.
  • partition – the partition where this comp app runs. Partition is a logical separation of the network that only the comp apps in the same partition communicate. Refer to concept document.
  • comps – array of the comps to generate. Each comp contains:
    • name – the comp name. The name is of camel style, the first letter is upper case.
    • descriptor – the description of the comp.
    • id – id of the comp. Refer to concept document.
    • type – the type of the comp. Values are [UNKNOW, REGULAR, SAFETY_CRITICAL]
    • cycleinterval – the time in seconds the comp thread runs one iteration.
    • services – array of services belong to this comp. The services are specified in full name, which includes all the name spaces. The name is in camel style, the first letter is in upper case.
    • overrides – array of services the comp is to override. The comp is allowed to override handler functions of their input messages, states, and transitions. The generated codes are placed in impl_ directory.

9.2 Important Notes

  1. Comp ID

    Each comp in the comps array needs to have a unique id. There are ids that have been designated to the common comps that they should be avoid. Here is the list of ids that have been assigned:


    ID Comp
    1 Node Manager
    2 Subsystem Manager
    3 Operator Control Unit
    4 Dashboard
    5 Subsystem State

  2. Comp App Library

    The app generator not only generates the application, but also the comp app library needed for other applications to integrate the comp app. The generated library files are in lib_main.h and lib_main.cpp.

    The library provides needed interface to start and shutdown the comp app. It also provides SetData and GetData functions to access service data. See Comp App Library and Service Data for details.

  3. The app generator generates Python Binding codes in the pybinds directory. The generated Python Binding codes need to be copied to the uli_sdk/pybind directory following the instructions in the pybinds/bindings/pybind_.h file.