mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-26 10:38:28 -04:00
AC_PID: update example to stop shadowing global chibios variable
This commit is contained in:
parent
26c01accb9
commit
2dae643280
@ -76,8 +76,8 @@ void loop()
|
||||
// display PID gains
|
||||
hal.console->printf("P %f I %f D %f imax %f\n", (double)pid.kP(), (double)pid.kI(), (double)pid.kD(), (double)pid.imax());
|
||||
|
||||
RC_Channel *ch = rc().channel(0);
|
||||
if (ch == nullptr) {
|
||||
RC_Channel *c = rc().channel(0);
|
||||
if (c == nullptr) {
|
||||
while (true) {
|
||||
hal.console->printf("No channel 0?");
|
||||
hal.scheduler->delay(1000);
|
||||
@ -85,11 +85,11 @@ void loop()
|
||||
}
|
||||
|
||||
// capture radio trim
|
||||
const uint16_t radio_trim = ch->get_radio_in();
|
||||
const uint16_t radio_trim = c->get_radio_in();
|
||||
|
||||
while (true) {
|
||||
rc().read_input(); // poll the radio for new values
|
||||
const uint16_t radio_in = ch->get_radio_in();
|
||||
const uint16_t radio_in = c->get_radio_in();
|
||||
const int16_t error = radio_in - radio_trim;
|
||||
pid.set_input_filter_all(error);
|
||||
const float control_P = pid.get_p();
|
||||
|
Loading…
Reference in New Issue
Block a user