New configuration system and DAQ recording #165
Replies: 5 comments 7 replies
-
|
Hi @christoph2 , What i did is to clone the repo and execute "pip install -e . " - the cpp exstensions are building fine (there are warnings but all gets build ) I have the feeling that installing from pip or a a precompiled wheel works fine, but the custom way does not work. By custom way I mean to download the code and execute "pip install -e .", perhaps something else is still missing to execute? |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
|
@SaxElectronics c.Transport.Can.can_id_master = 768
c.Transport.Can.can_id_slave = 769xcp-info.exe -c .\conf_can.py2025-05-09 11:40:55 INFO XCPonCAN - Interface-Type: 'kvaser' Parameters: [('channel', '0'), ('fd', False), ('bitrate', 500000), can.py:333
('receive_own_messages', False), ('sjw', 2), ('tseg1', 5), ('tseg2', 2)]
INFO XCPonCAN - Master-ID (Tx): 0x00000300S -- Slave-ID (Rx): 0x00000301S can.py:334
INFO XCPonCAN - Using Interface: 'Kvaser U100, S/N 1093742 (#1)' can.py:256
INFO XCPonCAN - Filters used: [{'can_id': 769, 'can_mask': 2047, 'extended': False}] can.py:257
INFO XCPonCAN - State: BusState.ACTIVE |
Beta Was this translation helpful? Give feedback.
-
|
@SaxElectronics |
Beta Was this translation helpful? Give feedback.
-
|
@christoph2 One more question I have, If I cannot use the ArgumentParser, would this be a legitime way of instantiating the classes and reading a configuration file? Update: I am having difficulties bypassing the "official" way of initializing pyxcp and the above approach seems to not work. While the sys.arg might be a valid approach in simple scripts, it is much more troublesome when integrating in a more bigger project. Just as an example I have not only XCP but also UDS as a lower level protocol communication. Any help on how to bypass "create_application" and "sys.arg" is appriciated ( it will save me hours of frustrated debugging ). In my scenario a more detailed level of control and initialization of the library is required. Also a of inititializing the BUS and shutting down the bus separetly from the protocol inititialization would be very beneficial. Questions:
I think the answers to these questions can be useful also to others using pyxcp. |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
-
So guys, this (v. 0.22) is a really comprehensive update... 🍾 🍾 🍾
The two most important changes are:
Configuration System
To get a first impression, run
xcp-profile create | lessNote
Using
xcp-profileis not really required, every pyXCP based program/script can handle profiles.To write a configuration file, use option
-o(-dworks the same way). Note: extension.pyis required in any case.It is recommended but not necessary to use
pyxcp_conf.pyas file name,because it is the file pyXCP looks for, if there is no
-coption.Simply run
instead of
Upgrading an existing configuration
Convert a legacy configuration file as follows:
If there's no output option (
-dor-o), the result is written tostdout.This means, the new configuration system now interprets the parameters
correctly.
For the sake of compatibility, nothing is changed when using old .JSON/.TOML files, but the IDs are crossed while converting your configuration files.
For the utterly confused, the logger dumps out some information on what's going on, e.g.:
Python as configuration language opens completely new posibilities, e.g.: a Python function instead of a .DLL can be used for seed-and-key unlocking:
Tested with Vector's XCPsim (CANape 20.0)
DAQ lists
First of all, there's an example run_daq demonstrating how-to DAQ -- Please read on before trying to run!
run_daqwas tested with CANape 20.0 and XCPlite;The CANape addresses may work, the XCPlite ones will certainly NOT!
DAQ measurements can be done in two ways:
.xmrawfile and then processed afterwards.This basic descision looks like this:
Note: DaqToCsv could be used as as startingpoint for own live processing.
If you look at the signature of the callback function
or a finished recording
you notice two timestamps,
timestamp0andtimestamp1.timestamp0is created by pyXCP, whiletimestamp1is the DAQ timestamp from your ECU or simulator (contained in the first ODT).Setup
There are basically only two data-structures the user has to care about:
A
DaqListcorrespondeds to a XCP DAQ-list and looks conceptually like this:meas_nameis important when it comes to storage later on, it can be used for example as a name of a.csvfile, aSQLtable, aMDFchannel-group, and so on.event_numthe number of the event the DAQ-list is attached to, depending of the implementation, events may only used once.stimis the direction of the DAQ-list (DAQ/STIM), and must beFalsefor now.enable_timestampstimestamp-generation may enabled or disabled or may fixed, this is completely implementation-defined.measurementsis a list of tuples with the following content:namein most cases the name of the A2L MEASUREMENT element.addressaddress_extensiondatatypedatatype mnemonic, to get an overview run:python -c "from pyxcp.recorder import DATA_TYPES; print(DATA_TYPES)"Note
16-bit floating-point variables are fully supported, but the availability is compiler-dependent;
F16(5-bit exponent and a 11-bit mantissa),BF16(8-bit exponent and a 8-bit mantissa, "brain-float")for details s. cppreference, and here
The allocation and optimization of ODTs is done automatically by pyXCP.
After a recording is done, you can now start processing; the basic pattern is as follows:
The are three examples for common use-cases (currently no Excel, sorry):
Miscellaneous / Minor changes
The build system is now poetry --
setup.pyis history!As an alternative to
python setup.py developone should usepip install -e .Timestamping was somewhat chaotic (
time.time(),time.perf_counter(), ...) -- now handled by a C++ extension, timestamps are now UTC values (64-bit, with nano-seconds resolution). The startup timestamp (incl. timezone, UTC-offset, and DST-offset) is accessible:The type of the interface is currently not deduced, so the interface and the transport-layer configuration must match, e.g.:
Beta Was this translation helpful? Give feedback.
All reactions