作者:沉尸(5912129@qq.com)
本章专门分析函数“control_loop_cb()”的执行
1)搞清楚在函数中做了哪些工作
2)这些工作中哪个环节等待了“TIM8的update事件”,这也是上一篇文章:
《ODrive0.5.5源码分析(2) 时钟和定时器》
中没有进行细化分析的内容。
这里先贴出源代码:
来自“MotorControl\main.cpp”
| 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 |
void ODrive::control_loop_cb(uint32_t timestamp) { last_update_timestamp_ = timestamp; n_evt_control_loop_++; // TODO: use a configurable component list for most of the following things MEASURE_TIME(task_times_.control_loop_misc) { // Reset all output ports so that we are certain about the freshness of |

文章详细分析了ODrive中control_loop_cb函数的执行流程,包括重置输出端口、端点开关更新、检查与看门狗、温度更新、编码器更新、无感控制观测器、控制器及电机更新等多个环节。该函数与TIM8的更新事件关联,执行频率为8KHz。
最低0.47元/天 解锁文章
803

被折叠的 条评论
为什么被折叠?



