Copter: 10Hz pulsing in throttle during climb in auto modes on master
Caused by the copter updating its desired velocity at 400hz while approaching its target position which is updated at 10hz.
The correct way to fix it is to compute desired velocity at 10Hz, while continuing to run the throttle controller at 400Hz. Since we don't use D term on the throttle acceleration controller, the step changes shouldn't cause an issue.
Nice catch, I've also experienced this behavior on our VRBRAIN port that uses 400Hz update rate. E.
2014-03-25 4:56 GMT+01:00 jschall [email protected]:
Caused by the copter updating its desired velocity at 400hz while approaching its target position which is updated at 10hz.
The correct way to fix it is to compute desired velocity at 10Hz, while continuing to run the throttle controller at 400Hz. Since we don't use D term on the throttle acceleration controller, the step changes shouldn't cause an issue.
Reply to this email directly or view it on GitHubhttps://github.com/diydrones/ardupilot/issues/925 .
This is temporarily fixed by increasing the navigation to run at 50hz. This is somewhat of a band-aid solution in that it doesn't eliminate the pulse but rather increases it's rate to 50hz from 10hz so it's much less noticeable. The size of the pulse is also much smaller now.
The AP_PosController has a filter on the velocity target that is based upon a 10hz update rate. These filter constants need to be fixed. https://github.com/diydrones/ardupilot/blob/master/libraries/AC_AttitudeControl/AC_PosControl.cpp#L281
We will go with the temporary fix for AC3.2. For AC3.3. we can revisit a more strategic fix when we're Pixhawk only.
Is this fixed with Jon's 2Hz filter on the throttle output?
You know, with all the spare CPU power we have on the Pixhawk with AC3.3. We could just increase the throttle controller to run at 400hz... That might be the best way to go.
Had a look at the situation, and it's maybe slightly complex.
We have:
throttle_loop() that is running at 50Hz update_altitude() that is running at 10Hz (is this the one we're concerned about?) run_nav_update() that is running at 50Hz (is this involved?) baro_accumulate() that is running at 50Hz
So do we just run it all at 400Hz?
Is the desired velocity really running at 400Hz? A function like get_pilot_desired_climb_rate() is ultimately run under the fast_loop(), the comment above that says 100Hz. Is that correct, or is that an old comment from APM? Probably.
I don't think we would want to run update_altitude faster than baro_accumulate do we?
I'd suggest we start with changing update_altitude to 50Hz.
So, reviewing update_altitude():
It does 3 main things. It calls read_barometer(), read_sonar(), and log_write_control_tuning().
read_barometer() does a number of things, including reading the barometer. This part is a bit complex but I think it should be insensitive to being called at a higher rate. There is one filter running that I can see, on the climb rate, which appears to handle it's own dt. So that is probably fine. I think the Baro communications are over SPI and probably immune to being run at increased speed.?
This part is probably all fine.
read_sonar() is not so clean. Each call causes the system to take a reading from the sonar. This is fine if the sonar is analog. But for an I2C sensor, running this at even 50Hz will load up the I2C bus with requests to the sonar. Well, this would be the case for an APM, which we don't support anymore. For Pixhawk, it's less clear how the I2C readings are triggered. Are they triggered on ever update call, or is there a free-running process running in the background and the update() calls just check for new data? Not clear.
Final thing is the logging. I think logging the CTUN data at 50Hz is excessive.
Suggest breaking this function up, calling the read_baometer() and 50hz, and the other two remaining at 10Hz.
I don't think we're seeing this 10hz pulsing anymore so closing. I'm not saying everything is perfect but if we have problems I don't think this issue is accurately capturing them anymore.