Skip to content
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

How to communicate with FC fast? #23

Open
yrik opened this issue Oct 1, 2023 · 3 comments
Open

How to communicate with FC fast? #23

yrik opened this issue Oct 1, 2023 · 3 comments

Comments

@yrik
Copy link

yrik commented Oct 1, 2023

When I'm running commands like MSP_BOARD_INFO it takes good 5-10 seconds to process each command. Is that normal?
What is the proper way to get fast accel/gyro values from FC? Say 100 times per second.

@ricardodeazambuja
Copy link
Collaborator

My first suggestion is to try this branch: https://github.com/thecognifly/YAMSPy/tree/yb/stable
Then check the Examples folder.

@Tuxliri
Copy link

Tuxliri commented May 20, 2024

@ricardodeazambuja hi, I am using this library for an autonomous drone project, I am trying to understand how fast I can read accelerometer and gyroscope readings and send RC commands. So far it seems that the MSP communication with the flight controller maxes out at about 62.5Hz. I tested this using the script in Examples/RPI0-OF/test_serial.py where I obtain a read speed around 15.6Hz (since it is performing 4 operations per iteration the overall frequency of communication is 62.5Hz). On my flight controller I set the baudrate to be 5e5 and I even increased the frequency of the serial task with the CLI command set serial_update_rate_hz=2000. Is this expected or am I missing something? Ideally I would like to be able to send commands at about 40Hz and read the IMU (accelerometer+gyro) at 30Hz.

@ricardodeazambuja
Copy link
Collaborator

Hi @Tuxliri. The max frequency you can get depends on many factors. What is the microcontroller that your FC uses? Is it F7 or F4? You can also have a look at the frequencies reported by the inav-configurator to have an idea.
We use debug messages to speed things up (example from yb/stable branch: https://github.com/thecognifly/YAMSPy/blob/yb/stable/Examples/test_debug_pos_est.py). It's quite easy to modify inav to create new custom debug messages (thecognifly/inav@8da90c9)
I prefer to use messages as high level as possible instead of directly reading the acc+gyro (I'm considering inav, not betaflight) because the FC has already done the heavy lifting for you (filtering...).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants