Some problems when sending actuator status messages

I’m using UAVCAN on STM32F446 to send actuator status information .But I can only received one actuator status information by Zubax while there are six actuator’s status information being sent.

I call the above function in this function

It can be seen from the above code that the information of 6 Motors should be sent each time, but only one motor can be received

First things first, what you are using is now called DroneCAN — UAVCAN does no longer exist. It will take a while for all the existing resources and materials to update the naming so certain confusion is expected to persist for some time.

I see that you are using a data type that is not actually present in the standard data type set of DroneCAN, which is a problem by itself because you are not expected/allowed by the standard to add vendor-specific data types into the standard namespace (unless they changed this rule, which I doubt they did). That said, it is unlikely to have anything to do with your specific problem at hand.

I recommend that you analyze the traffic on the bus using the DroneCAN GUI Tool or something similar to see what is happening with your CAN frames. It could be that some of them are being timed out before making it to the bus.

We strongly advise that all new projects should adopt Cyphal/CAN instead of the legacy protocols because of its technical superiority. I wrote about this many times on this forum before, so let me quote myself below.

If you are building a new product and require help navigating around the CAN ecosystem in the drone industry, feel free to reach out to for assistance.

Thanks for your ananser!

I just came into contact with him, soI am confused about some concepts. The data types I use are standard data types and I just redefined the name. I will consider using the latest Cyphal/CAN。
Thank you again!

Hello!I want to receive the information of six motors through a self-made circuit board using stm32f446. When the board obtains the information of six motors, it will send it to pixhawk4 with the dronecan protocol. Standard data type actuator. State is required when sending, but this standard data type can only transmit the information of one motor at a time. I want to transmit the information of six motors at the same time. Theoretically, can the information of six motors be broadcast on the same node ID at one time if not using the user-defined data type.

Per DroneCAN logic, you have to assign a unique actuator_id per motor and publish this message six times back-to-back. There is no other solution.

Really, you should be using Cyphal though. You may want to consult with this to see how it is implemented in Cyphal:

Thansk for your reply.I can’t use Cyphal for some reasons .I sent the information of six motors in sequence, with ids of 1,2… 5,6. However, the UAVCAN GUI TOOl can only receive information with id 1, and every six messages with motor id 1 will cause an error frame, and the corresponding information is as follows:

Data type macro definition:

Code for broadcasting 6 motor information

Only motor information with ID 1 was received.

The received message will appear one error frame per six frames

Why are you receiving 900 frames per second while your app is supposed to publish only 12 FPS?

It looks like you’re losing frames to queue overflow or some other queue-related issue. I am assuming here that the broadcasting function competes successfully (you do seem to have a check in place I see). To be sure, try lowering the broadcasting rate and inserting a brief pause between messages in the same group to see if it resolves the problem. If it does, you need to look into fixing the TX queue in your app.

Also try checking the bus traffic using candump just to make sure that the problem is not caused by the DroneCAN GUI Tool itself being unable to keep up with your FPS.

P.S. It is better to post source code as text.

The reason for the mismatch in the number of frames may be the timing when I call the broadcast function, but after adjustment, only the information of the motor with ID 1 can be received.I also changed the GUI tool, and the result is the same.
This is the code.
uav_port.txt (43.9 KB)

Okay. The advice I gave in the previous post still holds.

OK.Thanks for your suggestions!

Hello!Careful, there I go again!I am trying to use a custom data type, but the following error occurred when sending to GUI tool. The corresponding data type definitions and codes are as follows:
Data type definitions:

Compiled header file:
ArrayStatus.h (8.2 KB)
Statusinfo.h (9.1 KB)


typedef struct __packed _actuator_Status_b
    uint16_t actuator_id;
    uint16_t position;
    uint16_t  force;
    uint16_t  speed;
} _actuator_Status_b ;
static void BroadMotorInfoCanard(void)
    _actuator_Status_b motor_status;
    static uint8_t motor_transfer_id;
    uint8_t array_len=6;
    int offset=0;
    canardEncodeScalar(buffer, offset, 8, &array_len);
    offset += 8;
    for (uint16_t i=1;i<=6;i++)
        canardEncodeScalar(buffer, offset, 16, &motor_status.actuator_id);
        offset += 16;
        canardEncodeScalar(buffer, offset, 16, &motor_status.position);
        offset += 16;
        canardEncodeScalar(buffer, offset, 16, &motor_status.force);
        offset += 16;
        canardEncodeScalar(buffer, offset, 16, &motor_status.speed);    
        offset += 16;
      const int16_t Broad_res=canardBroadcast(&g_canard,
                                                UAVCAN_EQUIPMENT_ACTUATOR_ARRAYSTATUS_ID ,
            if (Broad_res <= 0)
                (void)fprintf(stderr, "Could not broad motor feedback; error %d\n", Broad_res);

Errors occurred:

Whether you use a custom or a standard data type makes no difference if your CAN queue is broken. Now we see that it clearly is. Please follow the advice I gave earlier to diagnose the problem before proceeding further.

Also, you should be using Cyphal. This is an OpenCyphal forum, by the way, not a DroneCAN one.