【问题标题】:turning radius is inaccurate of the robot is inaccuarate机器人的转弯半径不准确 不准确
【发布时间】:2015-04-25 15:13:19
【问题描述】:
#pragma config(StandardModel, "RVW SQUAREBOT")

task main(){
int begindistance = SensorValue[sonarSensor];
while (SensorValue[gyro] < 900){

motor[leftMotor] = 20;
motor[rightMotor] = -20;
}
motor[leftMotor] = 0;
motor[rightMotor] = 0;

SensorValue[leftEncoder] = 0;
SensorValue[rightEncoder] = 0;

while (SensorValue[sonarSensor] > 25){
motor[leftMotor] = 50;
motor[rightMotor] =50;
}

SensorValue[gyro] = 0;

int z = 180 - atan(begindistance/SensorValue[leftEncoder]);
while (SensorValue[gyro] > -z){
motor[leftMotor]  = -31;
motor[rightMotor]  = 31;
}
motor[leftMotor] = 0;
motor[rightMotor] = 0;
}

顺便说一下,开始距离是 178,我不知道为什么机器人会过度转弯,只是一点点,但我不知道为什么。我也在使用squarebot。 我正在使用 robocci 程序。我用钉子作为开始距离。

【问题讨论】:

  • 我让程序使用不同的程序工作,但我的新问题是为什么我不能让陀螺仪传感器值重置为零?
  • 这是我之前的程序无法运行的主要原因。

标签: robotc


【解决方案1】:

陀螺传感器并不总是从0开始,你需要将初始值存储到一个变量中,并找出读取的值与初始值之间的差值。

陀螺传感器也是只读的,所以这个语句

SensorValue[gyro] = 0;

不会工作。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-03-16
    • 2020-03-10
    • 2020-06-19
    • 1970-01-01
    • 2013-09-21
    • 2021-07-28
    • 2013-09-22
    • 1970-01-01
    相关资源
    最近更新 更多