Skip to content

Latest commit

 

History

History
105 lines (87 loc) · 2.33 KB

dbmonitor.rst

File metadata and controls

105 lines (87 loc) · 2.33 KB

Monitor Channel Using CAN Database

.. literalinclude:: /../examples/dbmonitor.py

Description

Any CAN messages received on the specified channel will be looked up in the database using ~canlib.kvadblib.Dbc.interpret, which allows the script to print the "phys" value of each signal instead of just printing the raw data (as :doc:`./monitor` does). The script also prints the message's name and comment (if available), as well as the signals name and unit.

Sample Output

EngineDataPetrolLevel: 0.0 lEngPower: 12.0 kWEngForce: 0.0 NIdleRunning: 0.0EngTemp: -30.0 °CEngSpeed: 7735.0 rpm
┗
┏ GearBoxInfoEcoMode: 0.0ShiftRequest: 0.0Gear: 0.0
┗
┏ EngineDataPetrolLevel: 0.0 lEngPower: 28.0 kWEngForce: 0.0 NIdleRunning: 0.0EngTemp: -30.0 °CEngSpeed: 3467.0 rpm
┗
┏ GearBoxInfoEcoMode: 1.0ShiftRequest: 0.0Gear: 0.0
┗
┏ EngineDataPetrolLevel: 0.0 lEngPower: 0.0 kWEngForce: 0.0 NIdleRunning: 0.0EngTemp: -50.0 °CEngSpeed: 1639.0 rpm
┗
┏ GearBoxInfoEcoMode: 1.0ShiftRequest: 0.0Gear: 1.0
┗
┏ EngineDataPetrolLevel: 60.0 lEngPower: 0.0 kWEngForce: 0.0 NIdleRunning: 0.0EngTemp: 142.0 °CEngSpeed: 0.0 rpm
┗
┏ GearBoxInfoEcoMode: 0.0ShiftRequest: 0.0Gear: 0.0
┗
┏ EngineDataPetrolLevel: 172.0 lEngPower: 51.0 kWEngForce: 0.0 NIdleRunning: 0.0EngTemp: -50.0 °CEngSpeed: 0.0 rpm
┗
┏ GearBoxInfoEcoMode: 0.0ShiftRequest: 0.0Gear: 0.0

CAN FD version

This example is basically the same as dbmonitor.py above, except we are now using CAN FD.

Note that you also need the dbmonitor.py file, next to dbmonitorfd.py below, since we are reusing the monitor_channel function.

.. literalinclude:: /../examples/dbmonitorfd.py