Autoware.Auto
|
|
CAN is the de-facto standard for communication between components on a vehicle.
As such, to send commands to the vehicle, a mechanism to send messages via CAN is required.
Similarly a mechanism to receive messages via CAN is required to receive data from the vehicle platform.
These classes are a thin wrapper around C functions to manage some extra book-keeping.
A typed interface for sending is also provided for compile-time checking of data sizes.
A helper class following the named parameter idiom is provided to wrap the CAN ID.
Sending and receiving are separate concerns and thus contained in separate classes.
Finally, care is taken to avoid exposing C/POSIX headers.
The concern for sender is only simple book-keeping and sending of data.
The same is true for the receiver.
Any complex error handling which would require receiving data is outside the concern of this class, and should be a part of a higher level class which contains an instance of this class.
See the sender API docs. and the receiver API docs.
These classes have no substantive logic.
Unix's select() function was used to wait for resource availability. On any error, an exception is thrown.
Both the receiver and the sender classes throw exceptions in the following cases:
Message-level error checking mechanisms a part of the CAN standard are outside the scope of this class.
This component exposes any security concerns that CAN might have.
API inspirations:
Implementation-specific references:
CAN-related references: