特定の方向で特定の座標に移動するように、差動駆動移動ロボット (e-puck) をプログラミングしています。ロボットは座標に問題なく到達しますが、座標に到達すると、特定の方向に落ち着くことができず、方向を探してその場で「回転」し続けます。これについて以前に経験したことのある人はいますか? 私はこの問題で非常に長い間立ち往生しており、誰かがその理由を知っていることを本当に願っています. コードの関連部分を以下に貼り付けます。
static void step() {
    if (wb_robot_step(TIME_STEP)==-1) {
        wb_robot_cleanup();
        exit(EXIT_SUCCESS);
    }
} 
.
.
.
.
.
static void set_speed(int l, int r)
{
    speed[LEFT] = l;
    speed[RIGHT] = r;
    if (pspeed[LEFT] != speed[LEFT] || pspeed[RIGHT] != speed[RIGHT]) {
        wb_differential_wheels_set_speed(speed[LEFT], speed[RIGHT]);
    }
}
.
.
.
.
static void goto_position1(float x, float y, float theta)
{
    if (VERBOSE > 0) printf("Going to (%f, %f, %f)\n",x,y,theta);
    // Set a target position
    odometry_goto_set_goal(&og, x, y, theta);
    // Move until the robot is close enough to the target position
    while (og.result.atgoal == 0) {
        // Update position and calculate new speeds
        odometry_track_step(og.track);
        odometry_goto_step(&og);
        // Set the wheel speed
        set_speed(og.result.speed_left, og.result.speed_right);
        printf("%f",ot.result.theta);
        print_position();
        step();
    } //after exiting while loop speed will be zero
    og.result.speed_left = 0;
    og.result.speed_right = 0;
    if (((og.result.speed_left == 0) && (og.result.speed_right == 0)) )  
        og.result.atgoal = 1;
    return;
}
.
.
.
int main(){
    //initialisation
    while (wb_robot_step(TIME_STEP) != -1) {
        goto_position1(0.0000000001,0.00000000001,PI/4);
    }
    return 0;
}