Make UAVCAN transport layer capable of sending/receiving messages from custom CAN protocols #16
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A custom protocol can operate through the UAVCAN transport layer by using the CustomTransferListener and CustomTransferSender classes. This was tested using an implementation of the KDECAN protocol in the uavcan driver, in the following public branch: https://github.com/duartecdias/PX4-Autopilot/tree/pr/uavcan/kdecanProtocol
It also associates a specific CAN protocol to a specific CAN interface. Messages of a specific CAN protocol will not be sent from a CAN interface associated to a different protocol. In addition, UAVCAN messages will not be read in case the receiving CAN interface is not associated to the UAVCAN protocol. By default, UAVCAN protocol is associated to both CAN interfaces. In this case, all UAVCAN messages will be sent, and all UAVCAN messages will be read.
Additionally, the implementation also allows for a way to send/receive messages of a custom CAN protocol implemented using standard ids, without having to change the interface protocol (this assumes UAVCAN uses only 29bits - extended - Ids, as described in: https://legacy.uavcan.org/Specification/4._CAN_bus_transport_layer/).
Tests were conducted in the above public branch (https://github.com/duartecdias/PX4-Autopilot/tree/pr/uavcan/kdecanProtocol). These tests are the following:
-prepare a normal quadrotor setup in a cubeorange (can disable GPS, etc. to make it arm). Configure UAVCAN ESC parameters.
-set extra CAN device (e.g. Kitcan)
-set debug Zubax device.
-connect everything on CAN interface 1 (monitor only interface 1)
-Turn ON cubeorange. Confirm sent of motor commands while listening to extra UAVCAN devices - debug with Zubax device.
-Different parameter configurations
-ESC_PROTO: 0, CAN1_PROTO: 0, CAN2_PROTO: 0 (PASS)
Description: ESCs use UAVCAN protocol and interfaces 1, 2 are configured to use UAVCAN
Expected behavior: send UAVCAN motors commands, receive Kitcan messages
-ESC_PROTO: 1, CAN1_PROTO: 0, CAN2_PROTO: 0, KDECAN (PASS)
Description: ESCs use KDECAN protocol and and interfaces 1, 2 are configured to use UAVCAN
Expected behavior: send KDECAN motor commands (standard Ids), receive Kitcan messages
-ESC_PROTO: 1, CAN1_PROTO: 1, CAN2_PROTO: 0, KDECAN (PASS)
Description: ESCs use KDECAN protocol, interface 1 uses KDECAN while interface 2 uses UAVCAN
Expected behavior: send KDECAN motor commands (extended Ids), filter/discard Kitcan messages
-Confirm reception of KDECAN ESC feedback (PASS)
-Confirm correct operation through multiple power cycles (PASS)