Legohead259 / OlympianESC-Firmware

Firmware for a novel Micro-ROS based electronic speed controller (ESC)
MIT License
0 stars 0 forks source link

[Bug Report] : `/angular_position` publisher not operating at desired speed #10

Closed Legohead259 closed 11 months ago

Legohead259 commented 11 months ago

Describe the bug The /angular_position publisher is supposed to publish the hall effect sensor position at 100 Hz. In testing with the FOC algorithm and MicroROS, this frequency drops to ~38 Hz.

To Reproduce Steps to reproduce the behavior:

  1. Boot board
  2. Initialize connection to board through Serial ROS2 agent (baudrate=115200)
  3. Execute ros2 topic hz /angular_position

Expected behavior The report from the ros2 topic hz command should be ~100 Hz, not ~38

Legohead259 commented 11 months ago

After commit 0bf950c, publisher is still publishing at ~38 Hz. Note that the publisher was originally running at 100 Hz and this frequency does not change after adding/removing services or FOC code. Something else is going on....

Legohead259 commented 11 months ago

When all functionality of the callback method is removed, the publish frequency is 100 Hz, as expected. The timer functions properly, there is just delay in the callback. Delay is due to several factors:

It is recommended to switch sensor to interrupt mode instead of polling method

For now, expect a maximum sample rate of ~40 Hz. THIS IS NORMAL FUTURE BRAIDAN