added micro ros tansport canfd

This commit is contained in:
2025-08-31 12:02:36 +02:00
parent e5c198058d
commit 8282555be6
10 changed files with 244 additions and 12 deletions

View File

@@ -35,14 +35,33 @@ MicrorosExecutor::~MicrorosExecutor() {
}
bool MicrorosExecutor::connect() {
if (rclc_support_init(&this->support, 0, NULL, &this->allocator) != RCL_RET_OK)
return false;
static bool support_init = false;
static bool defaults_init = false;
static bool executor_init = false;
if (rclc_node_init_default(&this->node, this->node_name, "", &this->support) != RCL_RET_OK)
return false;
if (!support_init){
if (rclc_support_init(&this->support, 0, NULL, &this->allocator) != RCL_RET_OK) {
printk("Can't init support!\r\n");
return false;
}
support_init = true;
}
if (!defaults_init){
if (rclc_node_init_default(&this->node, this->node_name, "", &this->support) != RCL_RET_OK){
printk("Can't init defaults!\r\n");
return false;
}
defaults_init = true;
}
if (rclc_executor_init(&this->executor, &this->support.context, 32, &this->allocator) != RCL_RET_OK)
return false;
if (!executor_init){
if (rclc_executor_init(&this->executor, &this->support.context, 32, &this->allocator) != RCL_RET_OK){
printk("Can't init executor!\r\n");
return false;
}
executor_init = true;
}
return true;
}