阅读背景:

返回功能不工作。使用勾股定理

来源:互联网 
#pragma config(Motor,  port1,           RightsideB,    tmotorVex393_HBridge, openLoop)
#pragma config(Motor,  port2,           RightsideF,    tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port9,           LefttsideF,    tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port10,          LeftsideB,     tmotorVex393_HBridge, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard             !!*//

float xdiff, ydiff, firstpart, secondpart, firstpart2, secondpart2, total, lengthformula;
float getdistance(int x1, int x2,int y1, int y2){
    return x1;
    return x2;
    return y1;
    return y2;

    xdiff = x2 - x1;
    ydiff = y2 - y1;

    firstpart = (xdiff);
    return firstpart;
    secondpart = (ydiff);
    firstpart2 = pow(xdiff,2);
    secondpart2 = pow(ydiff, 2);

    total = firstpart2 + secondpart2;
    lengthformula = sqrt(total);
    return lengthformula;
}

task main()
{
    getdistance(0, 4, 0, 1);
    while (true){
        motor[RightsideB]= vexRT[Ch2];
        motor[RightsideF] = vexRT[Ch2];
        motor[LeftsideB]= vexRT[Ch3]; 
        motor[LefttsideF]= vexRT[Ch3];

    }

}
#pragma config(Motor,  port1,           Rightsi



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: