-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MicroRos does not publish imu data in higher rates #1781
Comments
The default serial baudrate 115200 is too slow for IMU msgs at higher rate. You will need to change the serial baudrate to 921600 or 2M if the serial USB bridge on esp32 supports. C340/ CP2102N support up to 2M, while CP2102 supports only 921600. ESP32-S3 or PICO use on-chip CDC protocol, ttyACM0l. Buadrate setting is ignored. They will have better serial speed. |
The default i2c clock is 100KHz. You should set the i2c clock to 400KHz or 1MHz if the IMU supports. |
Hello, I tested my board and it is working with 921600 baudrate without any problem. I set the baudrate as 921600 and i2c as 400khz but nothing changed. It still publishes in 34 hz even though I expect 200 hz. |
You may try two tests.
|
The i2c bus sda scl need 2K pull up to 3.3V. |
Hello, When I assigned dummy values to sensor messages, I still saw 34 Hz. |
So it should the problem in control loop. Have you tried init_default and spin_some 100? |
I would suggest some exercises on the publisher example. Remove the delay(100) in the loop(). And change the timer timeout to higher rate. Try to find the upper limit of publish rate. |
When i worked witk init_default, i saw 30 hz max for sensor msgs. Delay(100) was already removed and spin_some was 100. However when i worked with std msgs as the example you had shared, the problem was disappeared and i saw higher rates (200 hz). The problem is probably related with sensor msgs. |
You may change the massage type of the publish int example to msg/Imu, and check the publish rate. |
Issue template
Steps to reproduce the issue
I am using "Bolder Flight Systems MPU9250" library to read MPU9250 imu data. I created a imu publisher and message type was sensor_msgs/msg/imu. The sensor normally can run in 200 hz rate. I configured the timer callback for 200 hz, so timer_timeout was 5 ms and I used RCL_MS_TO_NS function to convert it nanoseconds. I used "rclc_publisher_init_best_effort" while creating the publisher and it spinned 1ms via "RCSOFTCHECK(rclc_executor_spin_some(&executor, RCL_MS_TO_NS(1)))". I updated the imu data and assigned imu data to imu publisher messages in the timer callback. I also published in the timer callback.
Expected behavior
I expected 200 hz publisher rate.
Actual behavior
It is published in approximately 34 Hz when i checked with "ros2 topic hz /imu_data"
Additional information
The text was updated successfully, but these errors were encountered: