Unable to read UAVCAN frames in Pixhawk

#1

Hi,
I am trying to establish a CAN communication between pixhawk and a vendor specific device. I created two new UAVCAN messages in px4

  1. one for sending CAN frame from pixhawk to external device [Working successfully without any loss/error]

  2. another for receiving CAN frame from an external device. The problem occurs here, my vendor specific device is generating CAN frames and I can visualzie in UAVCAN GUI tool. Buy my pixhawk is not able to read them.
    Screenshot below:
    Screenshot%20from%202019-06-23%2013-45-32

[1002F901 ID corresponds to incoming CAN frames into my pixhawk]

My pixhawk code to read them is similar to this function in esc.cpp

void UavcanEscController::esc_status_sub_cb(const uavcan::ReceivedDataStructureuavcan::equipment::esc::Status &msg)

{I created a new controller file, new message file, and new UAVCAN message} I tried all the fix I could but couldn’t print the values in the CAN frame. But surprisingly the uavcan.status command keeps increasing he RX frames value whenever I send the frame from another device.

I could not find any pre-done work or articles on this expect this article on uavcan. I followed this article and was able to get most of the things done but struck at last part. Any pointers to get me out of this would be highly helpful?
Thanks and Regards
Niranjan

#2

Hi,

I did exactly what you are describing last week using PX4 v1.9.0 and it was working fine.
If you can share your code I could take a quick look and see if I can spot the error

1 Like
#3

Hi,
Thank you. I have attached the link link_to_my_drive.

TesteReceive is the UAVCAN message to receive input data and I am passing it onto teste2.c which would help me to display the values. All the steps were followed as documented in this article
[Only the UAVCAN reception part is my goal]

Not able to find what I am missing.

Thanks and Regards
Niranjan

#4

Hi,

I can not go through your code like this. Please share a git branch forked off from v1.9.0 with your custom UAVCAN changes applied on top of it.

Best,
Carl

1 Like
#5

Hi,
Yes, I have uploaded my repository in this link my git account. This would have my entire code base. But please make sure to update the .git folder inside Firmware with .git folder from px4 Firmware
PX4.

[Not sure why but .git was never getting updated for me and it was throwing errors so I used the one from Px4 general repository]

It would be great if you could help me to fix the issue of receiving CAN messages. All the changes were made in v1.9.0 .

Thank you
Thanks and Regards
Niranjan

#6

Hi,
I have one more question as well. While creating a new message in px4, the message has to be registered in cmake files. Similarly does newly created UAVCAN messages also have to be registered in any cmake files? Will this be what I am missing?
Regards
Niranjan

#7

Hi,
I can still not go through the code properly because you have deleted all git history. Please fork PX4/Firmware, create your own branch, push the changes and share the link to the branch here.

No, you don’t need to add the new DSDL files to any cmake file, the code will be autogenerated anyway

1 Like
#8

Hi,
I have created a branch in my git account and uploaded my code GitHub_Link . The branch name is testbyNiran.
But unfortunately, I was not able to attach my new CAN messages which comes under libuavcan folder. Git error was persistent. Was not able to resolve.

So I added the CAN message folder[“teste”] inside Firmware. Please check the commit number commit to place the missed folder in respective locations. And then give a build. It works.

Please let me know if this works.
Thank you.

#9

Hi,
This still does not work. I can help you debug your problem but you need to isolate it as much as possible, i.e. remove all unrelated changes to the firmware which is not needed to receive the CAN message.
Also, you need to fork libuavcan, add your DSDL file and update the submodule reference on your firmware branch.

1 Like
#10

Hi,
Yes, I did remove all unwanted changes in this link.
But the below problems occurs when I try to add the new DSDL file.

  1. The dsdl files inside uavcan folder would get generated once a build in given in the firmware. There are two locations where it has to be added. These exist as a separate repository in UAVCAN git as public_regualated_data_types and libuavcan.

  2. I was able to fork it and create a branch for public_regualated_data_types link. Was not able to update this submodule into the firmware. Ended up in creating many branches and totally struck at this point.

Never used git for this size of the repository. Is there any other way that I can share my code with you so that you can help me? Any alternative drive methods would be easy to send.
I am not able to do it through git.

Thanks and regards
Niranjan

#11

Hi,

No you didn’t. There is an entire new module added etc. The necessary changes to receive a UAVCAN message is only in the uavcan driver and its submodules.
Then when that is working you can publish what you want to a topic and so on.

1 Like
#12

Hi,
I would try it again and get back to you once I am able to upload my repository successfully into git. Thank you for your time.
Regards
Niranjan