当前位置:网站首页>IMU heating
IMU heating
2022-07-28 19:24:00 【Gkbytes】
// Set pin here
void Util::set_imu_temp(float current)
{
#if HAL_HAVE_IMU_HEATER
if (!heater.target || *heater.target == -1) {
return;
}
// average over temperatures to remove noise
heater.count++;
heater.sum += current;
// update once a second
uint32_t now = AP_HAL::millis();
if (now - heater.last_update_ms < 1000) {
#if defined(HAL_HEATER_GPIO_PIN)
// output as duty cycle to local pin. Use a random sequence to
// prevent a periodic change to magnetic field
bool heater_on = (get_random16() < uint32_t(heater.output) * 0xFFFFU / 100U);
hal.gpio->write(HAL_HEATER_GPIO_PIN, heater_on);
#endif
return;
}
heater.last_update_ms = now;
current = heater.sum / heater.count;
heater.sum = 0;
heater.count = 0;
// experimentally tweaked for Pixhawk2
const float kI = 0.3f;
const float kP = 200.0f;
float target = (float)(*heater.target);
// limit to 65 degrees to prevent damage
target = constrain_float(target, 0, 65);
float err = target - current;
heater.integrator += kI * err;
heater.integrator = constrain_float(heater.integrator, 0, 70);
heater.output = constrain_float(kP * err + heater.integrator, 0, 100);
//hal.console->printf("integrator %.1f out=%.1f temp=%.2f err=%.2f\n", heater.integrator, heater.output, current, err);
#if HAL_WITH_IO_MCU
if (AP_BoardConfig::io_enabled()) {
// tell IOMCU to setup heater
iomcu.set_heater_duty_cycle(heater.output);
}
#endif
#endif // HAL_HAVE_IMU_HEATER
}
边栏推荐
- pytest 自定义HOOK函数
- Application of time series database in museum environment detection
- QT widget promoted to QWidget
- From Bayesian filter to Kalman filter (2)
- ECS 5 workflow
- JS modify table font and table border style
- Module 8 of the construction camp
- Kali doesn't have an eth0 network card? What if you don't connect to the Internet
- Self-adaptive multi-objective evolutionary algorithm for flexible job shop scheduling with fuzzy pro
- Pytorch:交叉熵损失(CrossEntropyLoss)以及标签平滑(LabelSmoothing)的实现
猜你喜欢

SQL custom automatic calculation

Kotlin Android development novice tutorial

BM14 链表的奇偶重排

关于白盒测试,这些技巧你得游刃有余~

Application of time series database in intelligent power consumption field

FTM module of K60: configure motor, encoder and steering gear

The ever-changing pointer ----- C language

【物理应用】水下浮动风力涡轮机的尾流诱导动态模拟风场附matlab代码

Pytorch:交叉熵损失(CrossEntropyLoss)以及标签平滑(LabelSmoothing)的实现

pytest 自定义HOOK函数
随机推荐
ICLR21(classification) - 未来经典“ViT” 《AN IMAGE IS WORTH 16X16 WORDS》(含代码分析)
It is the best tool to evaluate six kinds of map visualization software in three categories
Image processing web application development tutorial
Youqilin system installation beyondcomare
Kotlin Android development novice tutorial
QT & OpenGL lighting
Photoshop responsive web design tutorial
【物理应用】大气吸收损耗附matlab代码
Efficiency comparison of JS array splicing push() concat() methods
Avoidance Adjusted Climbrate
Pandownload revival tutorial
JDBC简单封装
Wechat solves the problem of long press selected style
R语言与数据分析实战11-数据的删除
When unity customizes the editor, let the subclass inherit the inspector display effect of the parent class
剑指 Offer II 109. 开密码锁
Gmoea code operation 2 -- establishment and operation of operation environment
About ASM redundancy
SQL审核工具自荐Owls
[filter tracking] target tracking based on EKF, TDOA and frequency difference positioning with matlab code