机器人灭火程序关于机器人灭火的,越详细越好.
来源:学生作业帮助网 编辑:作业帮 时间:2024/08/29 06:23:29
机器人灭火程序关于机器人灭火的,越详细越好.
机器人灭火程序
关于机器人灭火的,越详细越好.
机器人灭火程序关于机器人灭火的,越详细越好.
/
#include "ASMF09LIB.h" /*头文件定义,请勿删除*/
int mic_1=0;
int gi_1=0;
int gi_2=0;
int gi_3=0;
int gi_4=0;
int gi_5=0;
int gi_6=0;
int gi_7=0;
int gi_8=0;
int gi_9=0;
int gi_10=0;
int gi_15=0;/*哪个房间有火的标记:四号有4,三号有3,二号有2,一号有1*/
int gi_15_4=1023,gi_15_3=1023,gi_15_2=1023,gi_15_1=1023;/*每个房门的火焰值*/
int ma_1=0;int ma_2=0;int ma_3=0;int ma_4=0;int ma_5=0;int ma_6=0;int ma_7=0;int ma_8=0;int ma_9=0;
int ma_10=0;
int micc=0;
int Cutfire=0;
float gf_1=0.0;
int i=0;
int aa14,aa13,aa12;
void DO(int CHANNEL,int STATE)
{ CHANNEL=CHANNEL;
SetDO(1,STATE);
}
void LeftWay_B( )/*沿左墙B*/
{
ma_4 = AI(3);
ma_5 = AI(4);
if((ma_4 > gi_9) && (ma_5 < ma_10))
{
SetMotor(0x1111,(int)(-100*gf_1),(int)(-100*gf_1),0,0);
}
else
{
if((ma_4 > gi_9) && (ma_5 > ma_10))
{
if(ma_5 > 450)
{
SetMotor(0x1111,(int)(-28*gf_1),(int)(28*gf_1),0,0);
}
else
{
SetMotor(0x1111,(int)(-80*gf_1),(int)(10*gf_1),0,0);
}
}
else
{
SetMotor(0x1111,(int)(-28*gf_1),(int)(-100*gf_1),0,0);
}
}
//wait( 0.001000 );
}
void LeftWay_low( ) /*沿左墙:慢速*/
{
ma_1 = AI(0);
ma_2 = AI(1);
if((ma_1 > gi_9) && (ma_2 < ma_10))
{
SetMotor(0x1111,(int)(75*gf_1),(int)(75*gf_1),0,0);
}
else
{
if((ma_1 > gi_9) && (ma_2 > ma_10))
{
if(ma_2 > 350)
{
SetMotor(0x1111,(int)(-28*gf_1),(int)(28*gf_1),0,0);
}
else
{
SetMotor(0x1111,(int)(-30*gf_1),(int)(80*gf_1),0,0);
}
}
else
{
SetMotor(0x1111,(int)(100*gf_1),(int)(33*gf_1),0,0);
}
}
//wait( 0.001000 );
}
void LeftWay( ) /*沿左墙*/
{
ma_1 = AI(0);
ma_2 = AI(1);
if((ma_1 > gi_9) && (ma_2 < ma_10))
{
SetMotor(0x1111,(int)(100*gf_1),(int)(100*gf_1),0,0);
}
else
{
if((ma_1 > gi_9) && (ma_2 > ma_10))
{
if(ma_2 > 350)
{
SetMotor(0x1111,(int)(-28*gf_1),(int)(28*gf_1),0,0);
}
else
{
SetMotor(0x1111,(int)(-20*gf_1),(int)(80*gf_1),0,0);
}
}
else
{
SetMotor(0x1111,(int)(100*gf_1),(int)(23*gf_1),0,0);
}
}
//wait( 0.001000 );
}
void LeftWay_24( ) /*沿左墙:沿2号外墙准备去4号*/
{
ma_1 = AI(0);
ma_2 = AI(1);
if((ma_1 > gi_9) && (ma_2 < ma_10))
{
//if(( ma_1 >450) && (ma_1 < 500)){SetMotor(0x1111,(int)(100*gf_1),(int)(90*gf_1),0,0);}
//else if(ma_1 > 500){SetMotor(0x1111,(int)(100*gf_1),(int)(100*gf_1),0,0);}
//else{SetMotor(0x1111,(int)(100*gf_1),(int)(60*gf_1),0,0);}
if((ma_1-AI(5))>20){SetMotor(0x1111,(int)(60*gf_1),(int)(100*gf_1),0,0);}
else if((ma_1-AI(5)) gi_9) && (ma_2 > ma_10))
{
if(ma_2 > 350)
{
SetMotor(0x1111,(int)(-28*gf_1),(int)(28*gf_1),0,0);
}
else
{
SetMotor(0x1111,(int)(-25*gf_1),(int)(80*gf_1),0,0);
}
}
else
{
SetMotor(0x1111,(int)(100*gf_1),(int)(33*gf_1),0,0);
}
}
//wait( 0.001000 );
}
void LeftWay_4m( ) /*沿左墙_四号进门前*/
{
ma_1 = AI(0);
ma_2 = AI(1);
if((ma_1 > gi_9) && (ma_2 < ma_10))
{
SetMotor(0x1111,(int)(100*gf_1),(int)(100*gf_1),0,0);
}
else
{
if((ma_1 > gi_9) && (ma_2 > ma_10))
{
if(ma_2 > 350)
{
SetMotor(0x1111,(int)(-28*gf_1),(int)(28*gf_1),0,0);
}
else
{
SetMotor(0x1111,(int)(-20*gf_1),(int)(80*gf_1),0,0);
}
}
else
{
SetMotor(0x1111,(int)(100*gf_1),(int)(33*gf_1),0,0);
}
}
//wait( 0.001000 );
}
void RightWay( )/*沿右墙*/
{
ma_2 = AI(1);
ma_3 = AI(2);
if((ma_3 > gi_9) && (ma_2 < ma_10))
{
SetMotor(0x1111,(int)(100*gf_1),(int)(100*gf_1),0,0);
}
else
{
if((ma_2 > ma_10) && (ma_3 > gi_9))
{
if(ma_2 > 330)
{
SetMotor(0x1111,(int)(28*gf_1),(int)(-28*gf_1),0,0);