本文整理汇总了C++中PID::getKp方法的典型用法代码示例。如果您正苦于以下问题:C++ PID::getKp方法的具体用法?C++ PID::getKp怎么用?C++ PID::getKp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PID
的用法示例。
在下文中一共展示了PID::getKp方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dispatch
void Calibration::dispatch(FramedSerialMessage* request) {
uint8_t cmd = request->getCommand();
if (cmd == MESSAGE_SAVE_CALIBRATION){
chiindii->saveConfig();
}
else if (cmd == MESSAGE_LOAD_CALIBRATION){
chiindii->loadConfig();
}
else if (cmd == MESSAGE_CALIBRATE_IMU){
wdt_enable(WDTO_8S); //This takes a bit of time... we need to make sure the WDT doesn't reset.
chiindii->getMpu6050()->calibrate();
wdt_enable(WDTO_120MS);
}
#if defined MAHONY
//TODO Add support for Mahoney tuning
#elif defined MADGWICK
else if (cmd == MESSAGE_MADGWICK_TUNING){
Madgwick* m = chiindii->getImu();
if (request->getLength() == 0){
double data[] = { m->getBeta() };
FramedSerialMessage response(MESSAGE_MADGWICK_TUNING, (uint8_t*) data, 4);
chiindii->sendMessage(&response);
}
else {
double* data = (double*) request->getData();
m->setBeta(data[0]);
}
}
#endif
else if (cmd == MESSAGE_RATE_PID_TUNING){
PID* x = chiindii->getRateX();
PID* y = chiindii->getRateY();
PID* z = chiindii->getRateZ();
if (request->getLength() == 0){
double data[] = {
x->getKp(), x->getKi(), x->getKd(),
y->getKp(), y->getKi(), y->getKd(),
z->getKp(), z->getKi(), z->getKd()
};
FramedSerialMessage response(MESSAGE_RATE_PID_TUNING, (uint8_t*) data, 36);
chiindii->sendMessage(&response);
}
else {
double* data = (double*) request->getData();
x->setTunings(data[0], data[1], data[2]);
y->setTunings(data[3], data[4], data[5]);
z->setTunings(data[6], data[7], data[8]);
}
}
else if (cmd == MESSAGE_ANGLE_PID_TUNING){
PID* x = chiindii->getAngleX();
PID* y = chiindii->getAngleY();
PID* z = chiindii->getAngleZ();
if (request->getLength() == 0){
double data[] = {
x->getKp(), x->getKi(), x->getKd(),
y->getKp(), y->getKi(), y->getKd(),
z->getKp(), z->getKi(), z->getKd()
};
FramedSerialMessage response(MESSAGE_ANGLE_PID_TUNING, (uint8_t*) data, 36);
chiindii->sendMessage(&response);
}
else {
double* data = (double*) request->getData();
x->setTunings(data[0], data[1], data[2]);
y->setTunings(data[3], data[4], data[5]);
z->setTunings(data[6], data[7], data[8]);
}
}
else if (cmd == MESSAGE_THROTTLE_PID_TUNING){
PID* t = chiindii->getGforce();
if (request->getLength() == 0){
double data[] = {
t->getKp(), t->getKi(), t->getKd()
};
FramedSerialMessage response(MESSAGE_THROTTLE_PID_TUNING, (uint8_t*) data, 12);
chiindii->sendMessage(&response);
}
else {
double* data = (double*) request->getData();
t->setTunings(data[0], data[1], data[2]);
}
}
}