Skip to content

Ros2interface exporter enhancement to include timestamp support for VSS signals and custom vspec output#496

Merged
erikbosch merged 11 commits intoCOVESA:masterfrom
ali-momin12:feature/timestamp_inclusion_as_struct_custom_vspec
Apr 21, 2026
Merged

Ros2interface exporter enhancement to include timestamp support for VSS signals and custom vspec output#496
erikbosch merged 11 commits intoCOVESA:masterfrom
ali-momin12:feature/timestamp_inclusion_as_struct_custom_vspec

Conversation

@ali-momin12
Copy link
Copy Markdown
Contributor

@ali-momin12 ali-momin12 commented Mar 24, 2026

The following changes have been made to ros2interface:

This PR is related to the following Issue and PR.

@ali-momin12 ali-momin12 force-pushed the feature/timestamp_inclusion_as_struct_custom_vspec branch from d60b74e to 9369eef Compare March 24, 2026 01:39
@erikbosch
Copy link
Copy Markdown
Collaborator

MoM:

  • Please review
  • @ali-momin12 - you may need to rebase/force-push the PR based on latest master as we have a fix for cyclonedds that currently is causing your build problem

@ali-momin12 ali-momin12 force-pushed the feature/timestamp_inclusion_as_struct_custom_vspec branch from 9369eef to 4e8602a Compare March 25, 2026 02:55
@ali-momin12 ali-momin12 changed the title Ros2interface exporter enhancement to include timestamp support for signals and custom vspec output Ros2interface exporter enhancement to include timestamp support for VSS signals and custom vspec output Mar 25, 2026
Comment thread docs/ros2interface.md Outdated
Comment thread src/vss_tools/exporters/ros2interface.py Outdated
Comment thread src/vss_tools/exporters/ros2interface.py Outdated
Comment thread src/vss_tools/exporters/ros2interface.py Outdated
@ali-momin12 ali-momin12 force-pushed the feature/timestamp_inclusion_as_struct_custom_vspec branch from 4e8602a to 51ba73c Compare March 27, 2026 05:48
* added timestamp to each signal at export time, updated CLI for ros2interface exporter to accept updated params, updated documentation as well. written additional test cases for testing the enhanced functionality.

Signed-off-by: Ali Momin <ali_momin@jp.honda>

* Updated text_generic.py code to better accomodate the test coverage for ros2interface exporter

Signed-off-by: Ali Momin <ali_momin@jp.honda>

* added unit tests in test_generic.py file for ros2exporter test coverage boost

Signed-off-by: Ali Momin <ali_momin@jp.honda>

* removed unnecessary output folder

Signed-off-by: Ali Momin <ali_momin@jp.honda>

* added line breaks in custom vspec output file between each vspec block

Signed-off-by: Ali Momin <ali_momin@jp.honda>

* fixed the error of github action where the build was failing due to items[] not being present in the object

Signed-off-by: Ali Momin <ali_momin@jp.honda>

* removed the description from custom vspec output format

Signed-off-by: Ali Momin <ali_momin@jp.honda>

* deleted the  description key value pair from custom vspec output format

Signed-off-by: Ali Momin <ali_momin@jp.honda>

* updated the ros2interface exporter to comply with the updated timestamp structure in VSS, updated test cases to comply with the update, updated documentation and generic test test coverage as well

Signed-off-by: Ali Momin <ali_momin@jp.honda>

* fixed timestamp reference in ros2interface.md

Signed-off-by: Ali Momin <ali_momin@jp.honda>

* fixed test cases with updated units for both seconds and nanoseconds

Signed-off-by: Ali Momin <ali_momin@jp.honda>

* update output-vspec and timestamp docs to reflect VehicleDataTypes.Timestamp. Replace inline Timestamp struct description in --output-vspec section with VehicleDataTypes.Timestamp reference. In Document, --timestamp-vspec option is added. Added .msg output examples for both simple and struct timestamp modes. Add dedicated Transformed VSS subsection with canonical output shape. Rewrote Examples section with multi-line formatting and new use cases. Updated Usage synopsis to include --timestamp-vspec.

Signed-off-by: Ali Momin <ali_momin@jp.honda>

* updated test_generic.py file to comply with updated timestamp syntax

Signed-off-by: Ali Momin <ali_momin@jp.honda>

* fixed the old references to Time_t in the fallback scenario, updated text_generic.py as well to comply with updated timestamp syntax

Signed-off-by: Ali Momin <ali_momin@jp.honda>

* refactor(ros2interface): remove simple timestamp mode

- Drop --timestamp-mode option, struct-based timestamp is now the only supported format
- All generated .msg files emit int64 timestamp_seconds + int64 timestamp_nanoseconds fields
- Leaf-mode signal value field is always named `value` (was previously the signal's snake_case tail)
- render_get_srv request always uses int64 seconds/nanoseconds pairs
- Remove _normalize_timestamp_suffix helper (no longer needed)
- Update all tests to reflect new field names and remove --timestamp-mode arguments
- Update docs to remove simple-mode references and examples

Signed-off-by: Ali Momin <ali_momin@jp.honda>

* fixed the output structure text position of custom vspec from core to output section, and some rephrasing

Signed-off-by: Ali Momin <ali_momin@jp.honda>

* - fixed the code blocks in document and moved out the helping text outside
- fixed some punctuation
- deleted empty spaces / blanks

Signed-off-by: Ali Momin <ali_momin@jp.honda>

---------

Signed-off-by: Ali Momin <ali_momin@jp.honda>
* refactored ros2interface.py - resolved issue of timestamp schema from types tree

Replace the raw-YAML timestamp resolution approach with a types-tree
lookup powered by the already-parsed and validated types_root returned
by get_trees().

Changes:
- load_vspec_tree now returns (root, types_root) instead of discarding
  the second value
- resolve_timestamp_schema(types_root, struct_name) replaces the four
  YAML-parsing helpers (_load_yaml_mapping, _extract_timestamp_schema_from_vspec,
  _candidate_timestamp_vspec_paths, _timestamp_component_comment)
- TimestampSchema/TimestampComponent dataclasses trimmed: removed
  vspec_entry, struct_entry, and source_path fields (unused downstream)
- write_transformed_struct_vspec: removed unused timestamp_schema param
- CLI: --timestamp-vspec <file> replaced by --timestamp-name <name>
  (default: "Timestamp"); struct must be declared in --types
- Docs updated: new "Timestamp fields" section, updated examples.

---------

Signed-off-by: Ali Momin <ali_momin@jp.honda>
@ali-momin12 ali-momin12 force-pushed the feature/timestamp_inclusion_as_struct_custom_vspec branch from b7d4023 to bda4111 Compare March 31, 2026 00:50
@erikbosch
Copy link
Copy Markdown
Collaborator

MoM:

Comment thread docs/ros2interface.md Outdated
Comment thread docs/ros2interface.md Outdated
Comment thread docs/ros2interface.md Outdated
Comment thread docs/ros2interface.md Outdated
Comment thread src/vss_tools/exporters/ros2interface.py Outdated
Comment thread src/vss_tools/exporters/ros2interface.py Outdated
Comment thread src/vss_tools/exporters/ros2interface.py Outdated
Comment thread src/vss_tools/exporters/ros2interface.py
fqn = node.get_fqn()
parts = fqn.split(".")

for idx in range(1, len(parts)):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current loop writes to a plain dict in one pass no object allocation, no tree construction, no mandatory description fields. whereas, connect() builds live VSSNode objects attached to a tree, which would then need to be walked back out to a dict for YAML serialization, it would add extra complexity and allocations for no gain. so, it think a current 3 line loop is good enough.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which would then need to be walked back out to a dict for YAML serialization

https://github.com/COVESA/vss-tools/blob/master/src/vss_tools/tree.py#L311

it would add extra complexity and allocations for no gain

Not sure here. Acting on plain dicts without using the NodeType enum for instance does not feel right and it feels like reinventing the wheel here
But I don't wanna be the blocking factor that much and feel like I might be too opinionated so all good. No need to adjust I guess

Comment thread src/vss_tools/exporters/ros2interface.py Outdated
- Used VSSNode.get_node_with_fqn() instead of PreOrderIter loop in
  resolve_timestamp_schema (removes manual tail-split matching)
- Matched timestamp struct by full FQN only. --timestamp-struct-fqn
  (renamed from --timestamp-name) requires an explicit FQN, no default
- Added log.warning when a timestamp property has no ROS type mapping
- Rename TimestampSchema → Timestamp, TimestampComponent → TimestampProperty,
  struct_name → fqn, components → properties
- Remove VEHICLE_TIMESTAMP_DATATYPE constant. write_transformed_struct_vspec
  now uses the fqn directly
- Introduced DEFAULT_TIMESTAMP constant with built-in int64 fields.
  it eliminates None checks in build_timestamp_fields, generate_msgs_*,
  and render_get_srv
- updated the md file accordingly to comply with the changes.

Signed-off-by: Ali Momin <ali_momin@jp.honda>
…ns. removed the default fall back option for --timestamp-struct-fqn and re-routed user to error message if incorrect fqn is provided.

Signed-off-by: Ali Momin <ali_momin@jp.honda>
fqn = node.get_fqn()
parts = fqn.split(".")

for idx in range(1, len(parts)):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which would then need to be walked back out to a dict for YAML serialization

https://github.com/COVESA/vss-tools/blob/master/src/vss_tools/tree.py#L311

it would add extra complexity and allocations for no gain

Not sure here. Acting on plain dicts without using the NodeType enum for instance does not feel right and it feels like reinventing the wheel here
But I don't wanna be the blocking factor that much and feel like I might be too opinionated so all good. No need to adjust I guess

}
entries[f"{fqn}.time"] = {
"type": "property",
"datatype": VEHICLE_TIMESTAMP_DATATYPE,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't that be dynamic?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in the commit 121ab8

Comment thread tests/vspec/test_generic.py Outdated
…_generic

Signed-off-by: Ali Momin <ali_momin@jp.honda>
Signed-off-by: Ali Momin <ali_momin@jp.honda>
…cases

Signed-off-by: Ali Momin <ali_momin@jp.honda>
…estamp_schema

Signed-off-by: Ali Momin <ali_momin@jp.honda>
Signed-off-by: Ali Momin <ali_momin@jp.honda>
Signed-off-by: Ali Momin <ali_momin@jp.honda>
Signed-off-by: Ali Momin <ali_momin@jp.honda>
@ali-momin12 ali-momin12 requested a review from sschleemilch April 3, 2026 07:21
@erikbosch
Copy link
Copy Markdown
Collaborator

@sschleemilch - do you have any more comments on this one?

Copy link
Copy Markdown
Collaborator

@sschleemilch sschleemilch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not 100% but don't want to block further

@erikbosch
Copy link
Copy Markdown
Collaborator

MoM:

  • ok to merge

@ali-momin12
Copy link
Copy Markdown
Contributor Author

@sschleemilch Thanks for the review and approval.
@erikbosch Hoping for the merge now.

@erikbosch erikbosch merged commit 2c0d77d into COVESA:master Apr 21, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants