Get UAVCAN Node Information using MAVLink

I am trying to get can information using the following scripts but it does not receive and print response 1 and response 2:
connection=mavutil.mavlink_connection(‘udpin:192.168.0.2:14541’)
connection.wait_heartbeat()
message=connection.mav.command_long_encode(connection.target_system, connection.target_component, mavutil.mavlink.MAV_CMD_UAVCAN_GET_NODE_INFO, 0, 0, 0, 0, 0, 0, 0)
print(‘Message Encoded’)
connection.mav.send(message)
print(‘Message Delivered!’)
response_1=connection.recv_match(type=‘UAVCAN_NODE_INFO’, blocking=True)
response_2=connection.recv_match(type=‘UAVCAN_NODE_STATUS’, blocking=True)
print(response_1)
print(response_2)

The last thing above code prints is Message Delivered!
and keeps waiting for these messages to be received.

What could be the solution to this problem?

So, instead of type=‘UAVCAN_NODE_INFO’, I did type=‘COMMAND_ACK’
which gave me:
COMMAND_ACK {command: 5200, result: 3, progress: 0, result_param2: 0, target_system: 255, target_component: 0}

So, I went on Messages (common) · MAVLink Developer Guide
From here I got to know that PX4 does not support “MV_CMD_UAVCAN_GET_NODE_INFO”, Can you suggest me what is the alternative available? I couldn’t find any on above link.

MAV_CMD_UAVCAN_GET_NODE_INFO, UAVCAN_NODE_INFO and UAVCAN_NODE_STATUS are not implemented in PX4.

  1. Is there any alternative method available?
  2. Could please share how can I get the desired output of the above program?

One Option that I can see is the use of uavcan protocol which I got to know from this link: https://www.youtube.com/watch?v=6Bvtn_g8liU&t=540s

And when I was going through all the px4 firmware folders, I found that after typing uavcan status in MAVLink Console it uses Health.1.0.uavcan, ID.1.0.uavcan and Mode.1.0.uavcan which is defined in (PX4-Autopilot/src/drivers/cyphal/legacy_data_types/uavcan/node) to print CAN interface and its properties.

  1. From where I can learn to use these kind of messages in python script?
  2. How can I write my own uavcan messages and use it?

I have had look at the video by https://www.youtube.com/watch?v=wyMcb8T7S9M but its a little higher level for me and I understood only some part.

I just want to know using python script that, If I have connected airspeed sensor or magnetormetor at a CAN1 and CAN2, how can I know if it is detecting the particular sensor, if yes what is the Node ID, Health and Mode?

  1. Not as far as I know
  2. No, because they aren’t supported.
  3. Nowhere
  4. That’s not a question for the MAVlink area.

If you are just interested in a particular type of thing, such as a UAVCAN battery, then you can probably look at the associated mavlink messages for that thing - i.e. I am fairly sure that a UAVCAN battery might be exposed via MAVLink.

If you need generic information as provided by these node messages then you’d have to write code to implement them. I don’t know enough about CAN to know how hard that would be. But I suspect not particularly hard.

Thank you for your help and all the information given.
Sorry that I had posted about CAN in this area but I couldn’t find any dedicated topic for it and thought it might be relevant to put under the current topic.

In case, I am able to find out more about this and also, have a solution, I will update it here for everyone to have a look.

No worries - this was a good place to find out that the messages aren’t supported in PX4.