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

Can't set 100Hz for MAVLINK_MSG_ID_HIGHRES_IMU on Rover #28101

Open
lida2003 opened this issue Sep 14, 2024 · 6 comments
Open

Can't set 100Hz for MAVLINK_MSG_ID_HIGHRES_IMU on Rover #28101

lida2003 opened this issue Sep 14, 2024 · 6 comments

Comments

@lida2003
Copy link
Contributor

Setup:

  • latest 4.6-dev
  • 921600 (UAVT, MAVLinkv2)

same code from setting MAV_CMD_SET_MESSAGE_INTERVAL,MAVLINK_MSG_ID_HIGHRES_IMU to 100Hz, which is 10000 us.

Result:

  • F435 Copter 100Hz OK
  • H743 Copter 100Hz/200Hz OK
  • H743 Rover NG about 50Hz

PS: Previous discussion hereCan't set 100Hz for MAVLINK_MSG_ID_HIGHRES_IMU?
#4
.

@stephendade
Copy link
Contributor

Just a guess, but the loop rate in Rover SCHED_LOOP_RATE is 50 by default. Trying increasing this to 100 or 200.

@lida2003
Copy link
Contributor Author

lida2003 commented Sep 17, 2024

I successfully set 10Hz(actually 9Hz), 25Hz(actually 24Hz), 50Hz(actually 49~50Hz), but I can't set 40Hz, 100Hz, 200Hz.

But it works for copter code 4.6-dev(same git commit code). It might be copter handles this command different from rover. I'm NOT digging into the code right now.

Just post this question here, maybe someone can take care of it when have time.

--- EDIT:

BTW, I can test if there is any debug version.

@stephendade
Copy link
Contributor

Ok, I've done some digging and created a patch in #28144.

I've confirmed by initial guess that Ardupilot is indeed capping the message rate at SCHED_LOOP_RATE. Try setting this parameter to 250Hz and try your message rates again.

@lida2003
Copy link
Contributor Author

lida2003 commented Sep 18, 2024

I'll do the test tomorrow and get back to you soon.

--- EDIT

Yes, change loop rate helps. Is there any api for changing "SCHEDULER_LOOP_RATE"?

diff --git a/libraries/AP_Scheduler/AP_Scheduler.cpp b/libraries/AP_Scheduler/AP_Scheduler.cpp
index 7d21cf015a..cee4abc6fe 100644
--- a/libraries/AP_Scheduler/AP_Scheduler.cpp
+++ b/libraries/AP_Scheduler/AP_Scheduler.cpp
@@ -43,7 +43,7 @@
 #if APM_BUILD_COPTER_OR_HELI || APM_BUILD_TYPE(APM_BUILD_ArduSub)
 #define SCHEDULER_DEFAULT_LOOP_RATE 400
 #else
-#define SCHEDULER_DEFAULT_LOOP_RATE  50
+#define SCHEDULER_DEFAULT_LOOP_RATE 200
 #endif

GCS_MAVLINK::set_ap_message_interval is invoked in GCS_MAVLINK::set_message_interval

Does this mean we can remove this part in GCS_MAVLINK::set_ap_message_interval or maybe return false from set_ap_message_interval?

#if AP_SCHEDULER_ENABLED
// send messages out at most 80% of main loop rate
if (interval_ms != 0 &&
interval_ms*800 < AP::scheduler().get_loop_period_us()) {
interval_ms = AP::scheduler().get_loop_period_us()/800.0f;
}
#endif

@stephendade
Copy link
Contributor

Is there any api for changing "SCHEDULER_LOOP_RATE"?

That's just an Ardupilot parameter that you can set via your GCS.

@lida2003
Copy link
Contributor Author

Thanks.
图片

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

2 participants