Hi all,
I am working on enabling CAN communication between our pixhawk 4 and a vendor specific motor controller. This motor controller accepts raw CAN messages with either hex 11 bit identifier (for example 00A) or there is the option of using extended identifier 000000A0.
I have been looking at several useful posts: UAVCAN execution in px4 - #2 by Jonathan_Wittmer however I cannot find where and how is possible to forze UAVCAN to use specific hex identifiers.
My trials boil down to 2 options:
-
I have already made use of libuavcan functions defined in libuavcan/test_multithreading.cpp at dfcdf22eda16ff06847976fd6c7f40671fc92eb5 · OpenCyphal-Garage/libuavcan · GitHub to circumvent the protocol stack such as: **virtual void injectTxFramesInto(uavcan::INode& main_node) = 0;**where I can as well as with socketCAN, define a CAN ID.
-
I also tried to tackle the issue from px4 and understood as pointed here: PX4-Autopilot/esc.cpp at 327354705b3519472dd493e687b014ce44c6415d · PX4/PX4-Autopilot · GitHub that is broadcast(msg) the function scheduling CAN frames to be sent. However the data type of msg () is linked to a data structure: uavcan::equipment::esc::RawCommand and the CAN ID seen in UAVCAN GUI (CAN ID = 05040601):
It is generated based on the UAVCAN specification. I tried to generate another data structure with the dsdlr compiler but the ID is generated automatically and I dont know how to modify it.
I understand that there is a good reason to specify in UAVCAN protocol the structure of ID to parse and classify different messages from different nodes, however the device I am working with will not recognize the CAN ID used by UAVCAN nodes.
so my questions are:
regarding 1.) how can I make use of injectTxFrame because my temporary attempt modified in esc.cpp:
does not work.
and regarding 2.) is there a way of creating custom dsdl data types with hexadecimal CAN IDs? or to generate CAN frames in px4 with customized hexadecimal format?
Any help would be much appreciated,
Thanks in advance.