ika-rwth-aachen / etsi_its_messages

ROS / ROS 2 Support for ETSI ITS Messages for V2X Communication
MIT License
43 stars 8 forks source link

[WIP] SPATEM/MAPEM Support #28

Open lreiher opened 3 months ago

lreiher commented 3 months ago

Current WIP State

lreiher commented 1 month ago

Hey @v0-e,

would you mind taking a look at this branch? I can successfully generate the C-structs for SPATEM/MAPEM, but msgs/conversion generation fails with an error like the following.

thread 'main' panicked at src/msgs/bin.rs:23:35:
called `Result::unwrap()` on an `Err` value: Error { kind: InvalidData, message: "stream did not contain valid UTF-8" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

In order to test this yourself, make sure to initialize the submodules recursively and to execute ./asn1/external/download.sh for downloading external ASN.1 dependencies for the is_ts103301 submodule.

Also tagging @jpbusch, FYI.

james-ward commented 1 month ago

@lreiher I have taken a look at your code and I can help to make it work a little bit more. First thing is to delete the offending characters in the source .asn file. This will show the lines:

grep -axv '.*' asn1/raw/is_ts103301/build/asn1/ISO14816_AVIAEINumberingAndDataStructures.asn

Then you can run utils/codegen/codegen-rust/asn1ToRosMsg.py ....

This will throw an error because the Rust version of the tool doesn't recognise BITSTRING types.

The Python version of the script seems to work: utils/codegen/codegen-py/asn1ToRosMsg.py ....

HTH - this isn't a full fix, but might help get this PR further. This is a really great project and we'd love to use it too!

lreiher commented 4 weeks ago

@james-ward Thank you very much for the hint! I have pushed an automated patch of the offending characters.

I have then tried to implement handling of bit string in the rust codegen and successfully generated messages and conversion headers. However, we will have to look into the bit string handling again to verify. I'm a little confused right now why this problem hasn't yet surfaced with the other message types.