nrai_ADS-DV_CAN-API/README.md

26 lines
1.4 KiB
Markdown
Raw Normal View History

2026-04-06 17:34:24 +01:00
# nrai_ADS-DV_CAN-API
2026-04-06 17:33:15 +01:00
This is the Newcastle Racing AI (nrai) implementation of the ADS-DV software
interface specification (including all other sensors accessed via CAN e.g. GPS).
it aims to be as minimal as possible, facilitating on the bare minimum to pack
and unpack CAN frames, only implementing checks where required for the packing
of frames (e.g. stat clamping). All data sanity checks are expected to be
implemented by the calling program.
2026-04-06 17:34:24 +01:00
## Usage
2026-04-06 17:33:15 +01:00
This API provides 2 structs for storing data to be written to, and received from
the VCU over CAN. They are `nrai_can_ai_read` and `nrai_can_ai_write` for data
received from the VCU and data to write to the VCU respectively.
2026-11-11 22:51:05 +00:00
This API provides functions for the client to pack data into CAN frames, named in
2026-04-06 17:33:15 +01:00
the format
`int32_t nrai_can_mkframe_<frame_name>(struct nrai_can_ai_write *, struct can_frame *);`
2026-11-11 22:51:05 +00:00
and functions for the client to unpack CAN frames, named in the format
2026-04-06 17:33:15 +01:00
`int32_t nrai_can_unpack_<frame_name>(struct nrai_can_ai_read *, struct can_frame *);`.
This API also provides an enum for translating CAN message names into their ID,
2026-11-11 22:51:05 +00:00
all entries are named in the format `NRAI_CAN_ID_<frame_name>`, As well as enums
for values contained within frames (see header file).
2026-04-06 17:33:15 +01:00
2026-04-06 17:34:24 +01:00
## Notes
2026-11-11 22:51:05 +00:00
This API makes use of limited use of C23 extensions where their use either
improves clarity or simplifies code. While all C23 extensions used are
2026-04-06 17:33:15 +01:00
supported by GCC and Clang, not all compilers support them.