1 Star 0 Fork 25

开发团队/OmniCopter

forked from 肖昆/OmniCopter 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
OmniCopter.ino 1.28 KB
一键复制 编辑 原始数据 按行查看 历史
dash23 提交于 2017-02-16 22:03 . Enhance the readability of the code.
#include <OmniCopter.h>
#include <Log.h>
#include <FailSafe.h>
OmniCopter omniCopter;
Log loger;
FailSafe failSafe;
int RC1[10]={1506,1506,1506,1506,1506,1506,1400};
void InterruptService()
{
static unsigned long int lastTime=0;
static int cursor=0;
if (digitalRead(PPM_SWITCH_PIN) == LOW)
{
unsigned long int now=micros();
unsigned long int thisTime=now-lastTime;
if(thisTime>3000)
{
cursor=0;
}else
{
RC1[cursor++]=thisTime;
}
lastTime=now;
}
}
//The setup function is called once at startup of the sketch
void setup()
{
omniCopter.init();
#ifdef DEBUG_MODE
loger.setDebugMode(true);
#endif
loger.init();
loger.setFreq(12);
attachInterrupt(PPM_INT,InterruptService,CHANGE);
}
// The loop function is called in an endless loop
void loop()
{
#ifdef DEBUG_MODE
loger.showFreq(omniCopter);
#endif
omniCopter.getCompleteInput(RC1);
#ifdef DEBUG_MODE
loger.showRcInput(omniCopter);
loger.showSensor(omniCopter);
#endif
omniCopter.attitudeProcess();
for(int i=0;i<INNER_OUTER_RATIO;i++)
{
omniCopter.bodyRateProcess();
omniCopter.positionProcess();
omniCopter.controlAllocateProcess();
omniCopter.excute();
}
failSafe.safeToArm(omniCopter);
#ifdef DEBUG_MODE
loger.showForce(omniCopter);
loger.showEscOutput(omniCopter);
loger.oneLoop();
#endif
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/OAGroup/OmniCopter.git
git@gitee.com:OAGroup/OmniCopter.git
OAGroup
OmniCopter
OmniCopter
master

搜索帮助