Dear Customers,

The PolySync Support Center is now just for submitting tickets to our support team. All articles and tutorials have been moved to the new PolySync Help Center and the content below will be removed shortly.

Thank you,
The PolySync Team

Extending the data model

PolySync provides a set of data model modules that are commonly used to develop autonomous vehicles. The modules can be modified and extended to include new data types, custom messages and trouble codes.

Existing data model modules:

  • DTC
  • Navigation
  • Sensor
  • Control

This example extends the DTC module to include a new diagnostic trouble code. Once the DTC is added to the module, an application can use the new DTC to indicate it's diagnostic status.

 

Data Model Modules

Modules are defined using IDL files to describe C data structures and constants. Each module must follow a naming convention and define certain macros such as the module major, minor and subminor version digits.

Once a module has been defined or modified the data modfel libraries (.so) must be recompiled using the PolySync Data Model (`pdm-gen`) tool. The PDM tool outputs a C and C++ API data model library:

  • `libpolysync_data_model.so`
  • `libpolysync_cpp_message_support.so`

 

Extending DTC Module

To extend the DTC module we will open the IDL file that ships with the PolySync release package.

$ gedit /usr/local/polysync/modules/dtc/dtc.idl

PolySync has reserved the lower 32-bits of the available `ps_dtc` IDs. This means that custom DTCs must have an ID with value 4,294,967,295 >= x <= 18,446,744,073,709,551,615.

We will add a custom DTC to the IDL with our custom description and macro name:

 

/**

 * @brief Ibeo Lux device has overheated and cannot operate.

 * Data will not be reported until the temperature matches the normal operating range.

 */

const ps_dtc DTC_IBEO_LUX_OVERHEATED = 4294967295;

 

DTCs are intended to represent a specific state. Rather than saying hardware error, a DTC could indicate that the Ethernet sensor is overheated. Another DTC could indicate that the mirror is dirty, and so on.

Once all changes have been saved the PolySync PDM tool is used to generate the data model with the DTC built into the API.

$ cd $PSYNC_HOME
$ pdm-gen modules/dtc/dtc.idl modules/sensor/sensor.idl modules/navigation/navigation.idl modules/control/contorl.idl > pdm/version.txt
$ cp pdm/*.so $PSYNC_HOME/lib

 

The DTC is now available at runtime and can be used within an application to indicate the diagnostic status. The same methods can be applied to any of the data model modules.

To create custom message types, please see this article for the IDL file requirements.

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.