Homepage GitHub

Unknown Data Type

Hello! I defined my node as publisher of uavcan::equipment::actuator::command. But method pub.init of the lib return “ErrUnknownDataType”. where could there be a mistake?

const int RxQueueSize = 128;
static std::uint32_t BitRate = 1000000;
const unsigned NodeMemoryPoolSize = 1024;

int main(void)
    static uavcan::Node<NodeMemoryPoolSize>& node = getNode();
    if (node.setNodeID(9) == 0){
    	char a = '1';
		uint8_t *pa = (uint8_t*)&a;
		HAL_UART_Transmit_IT(&huart1, pa, 1);
    if (node.start() < 0){	//uavcan::TransferPriority::Default
		char a = '2';
		uint8_t *pa = (uint8_t*)&a;
		HAL_UART_Transmit_IT(&huart1, pa, 1);
     int uavcan_error  = cmd_pub.init();
     if(uavcan_error == -ErrUnknownDataType){
		char a = '3';
		HAL_UART_Transmit_IT(&huart1, (uint8_t*)&a, 1); <--- It is sent(

This code is working with actuator::Status and actuator::ArrayCommand. Is it bug or my understanding about Command is incorrect?

If you look closely you’d see that Command has no data type ID:


Which means that you can’t use it as a top-level data type (can’t pub/sub) unless you assign a data-type ID at runtime as described in the Libuavcan tutorial for custom data types. This way of handling data types is flawed which is why we changed it in v1.

1 Like

Okay, I understand, thank you