Supported Sensors

OBD-II Generic


Supported hardware versions

The driver interface communicates with the vehicles OBD through the CAN Interface. This driver supports 99 common CAN IDs and thus is compatible with most vehicles however the data provided varies from vehicle to vehicle.

Sensor background and requirements

The On-Board Diagnostic System (OBD) II is built into all cars and light truck since 1996. It outputs diagnostic information from the vehicle which can be critical to a autonomous vehicle’s functionality. This information ranges from engine performance to fuel level and it can be accessed through the OBD II data port.

Hardware requirements

  • Data harness
    • CAN High/Low signals should be wired to DB9 pins 72 respectfully, with a terminating 120Ohm resistor
  • Vehicle equiped with an OBD II port
  • CAN interface on the ECU, compatible with linuxcan or socketcan hardware drivers
  • ECU with PolySync Core installed

Configuring the ECU

The ECUs CAN network needs to be configured to use one of the two compatible CAN interfaces: Kvaser’s linuxcan or socketcan.

Setup the CAN interfaces on the ECU to enable the driver to communicate with the sensor.

Adding the sensor to the SDF

Using the Configurator tool, add a sensor node to the SDF

The ‘Node Interface’ name is obd-ii-generic.

CAN Hardware and Circuit Identifiers

Each CAN interface on the ECU has a unique identifier that enables software applications like the PolySync Core driver to identify and connect to the appropriate CAN channel.

Locate the CAN hardware and circuit identifiers based on the CAN drivers installed on your system.

Enter the CAN Channel 0 Hardware Identifier and CAN Channel 0 Circuit Identifier in the Configurator.

CAN channels

Parse the sensor identifier

The driver needs the OBD II’s sensor identifier to validate the hardware device while initializing the connection.

The PolySync Core driver can parse the identifier when started on the command line, after the CAN hardware and circuit identifiers have been entered in the Configurator.

Enter the sensor identifier in the Configurator node entry’s Sensor 0 Identifier parameter field, located at the top of the Sensor Configuration table.

Sensor ID

Configuration parameters and calibrating the sensor

Parameter ID Description Value Type Values Notes
5000 Bitfield of PIDs to query from platform. [0x01 - 0x20] 1 0
5001 Bitfield of PIDs to query from platform. [0x21 - 0x40] 1 0
5002 Bitfield of PIDs to query from platform. [0x41 - 0x60] 1 0
5003 Bitfield of PIDs to query from platform. [0x61 - 0x80] 1 0
5004 Publish bitfield of supported PIDs before publishing PID responses. [0 is diabled] 1 0
5005 Frequency with which to publish OBD responses. [Hz] 1 20

Validating the sensor is properly configured

If you’re approaching a new PolySync system or need to validate an existing configuration you can use the following checklist to ensure the sensor is properly configured.

Setup checklist

The OBD port does not begin writing data to the CAN bus until it receives a command from the driver, so you’re not able to sniff the CAN bus for data. However if the sensor passes these checks then the PolySync dynamic driver will be able to communicate with the sensor.

  • The sensor is powered
  • The CAN bus is terminated with a 120 Ohm resistor
  • The PolySync Core driver is able to parse the sensor identifier

Starting the PolySync driver

The configuration set in the Configurator is loaded from the SDF when the dynamic driver starts. It connects to the sensor over the CAN interface, requests the data, and waits for confirmation that the sensor configuration is valid.

When the dynamic driver receives the first full frame of data it begins processing the data, abstracting the data from the OEM data structure in a high-level hardware agnostic message type. In this case the data is placed in a ps_platform_obd_msg.

  1. Power the sensor and ECU on
  2. Optionally follow the setup checklist
  3. Start the PolySync Core manager
    • $ sudo service polysync-core-manager start
  4. Start the dynamic driver process

Starting the node manually on the command line

To start a dynamic driver node on the command line, the node must first be defined in the SDF using the Configurator application.

Each node defined in the Configurator has a unique node ID which points to the nodes configuration. This article explains how to find the node ID.

Command line flags and usage

Once the node ID is known (substitute for X), the dynamic driver node for the supported sensor can be started with the base command:

$ polysync-core-dynamic-driver -n X

Each sensor supports an array of command line arguments. To see a full list of command line arguments, pass the -h help flag:

$ polysync-core-dynamic-driver -n X -h  |  less

There’s a lot of output so we recommend you pipe the output to less, but it’s not required.

Flag Required Description Arguments
-c No Use the provided CAN channel system index, instead of what is stored in the SDF The system index is the mechanism used by the linuxcan or socketcan drivers to enumerate the drivers to the linux kernel
-t No perform a validation test on the OBD-II interface
-d No enable additional debugging output in OBD-II interface

Accessing sensor data

When the dynamic driver node is operating in an OK state then data is being published to the global PolySync bus, and any node can subscribe to the high-level message type(s) output by the dynamic driver node.

There are several tools that PolySync provides to quickly validate that data exists on the bus.

Access sensor data with PolySync nodes that subscribe to the sensor’s output message types.

Input / output message types

Message API Docs Notes
Publishes ps_platform_obd_msg Sensor Data Model Publishing is enabled by default
Publishes ps_can_frame_msg Core Data Model Publishing is disabled by default, the message buffer contains the raw data received from the sensor over the CAN bus

Enable and disable the publishing of specific message types in the Configurator.

OBD message fields

The ps_platform_obd_msg message.

Data type Name Description Message field populated by this sensor
ps_msg_header header PolySync message header Yes
ps_sensor_descriptor sensor_descriptor sensor descriptor identifying the publisher Yes
ps_timestamp timestamp UTC timestamp when this message was received by PolySync Yes
ps_native_timestamp native_timestamp native timestamp for the OBD data Yes
[ps_identifier] pid Parameter ID of the OBD response Yes
[ps_parameter_value] timestamp Value of OBD response corresponding to the Parameter ID Yes

Filtering incoming data for this sensor

An application that subscribes to a given message type is able to see data from more than one sensor or source.

Applications can filter for specific sensors and data sources in the message callback in C applications, or the messageEvent in C++ applications.

Filter incoming messages for this sensor with ps_sensor_kind value 370.

You can find all sensor descriptor values in this article.