Sten-Helge

Forum Replies Created

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #6030
    Sten-Helge
    Participant

    Solved the issue temporarily by turning the the IMU upside down, ie the skull facing up. I will look into the math more closely.

    #6028
    Sten-Helge
    Participant

    Thanks,
    I have to look more closely into this issue. The navigation equipment I'm passing information to, expect negative values when tilting the nose down.

    Regards

    #6023
    Sten-Helge
    Participant

    Thanks for the replay,
    Given the orientation of the board, as shown in the picture I attached, is correct, tilting the nose of the platform on which the board is mounted forward and down should give negative values. Tilting the platform backwards should give positive values.
    In one of my setups I'm using the IMU board onboard a vessel. The compass and roll is correct, but the pitch give negative values when the vessels bow are going up, and positive values when the bow goes down.
    Please advice.

    #5882
    Sten-Helge
    Participant

    According to the datasheet the settings for CTRL_REG2_XM register should be as follows for the different scales;

    ....
            // Enable accelerometer.
            writeAccReg(CTRL_REG1_XM, 0b01100111); //  z,y,x axis enabled, continuos update,  100Hz data rate
    		
            //writeAccReg(CTRL_REG2_XM, 0b00000000); //+/- 2G full scale
            //writeAccReg(CTRL_REG2_XM, 0b00001000); //+/- 4G full scale
            //writeAccReg(CTRL_REG2_XM, 0b00010000); // +/- 6G full scale
            //writeAccReg(CTRL_REG2_XM, 0b00011000); // +/- 8G full scale
            writeAccReg(CTRL_REG2_XM, 0b00100000); // +/- 16G full scale
    ....
    ....
    	//read ACC values
    	readACC(accRaw);
    	
    	// +/- 2G full scale
    	//printf("X = %7.2f G\t" , ((accRaw[0] * 0.061)/1000));
    	//printf(" Y =   %7.2f G\t" , ((accRaw[1] * 0.061)/1000));
    	//printf(" Z =  %7.2f G\n" , ((accRaw[2] * 0.061)/1000));
    	
    	// +/- 4G full scale
    	//printf("X = %7.2f G\t" , ((accRaw[0] * 0.122)/1000));
    	//printf(" Y =   %7.2f G\t" , ((accRaw[1] * 0.122)/1000));
    	//printf(" Z =  %7.2f G\n" , ((accRaw[2] * 0.122)/1000));
    	
    	// +/- 6G full scale
    	//printf("X = %7.2f G\t" , ((accRaw[0] * 0.183)/1000));
    	//printf(" Y =   %7.2f G\t" , ((accRaw[1] * 0.183)/1000));
    	//printf(" Z =  %7.2f G\n" , ((accRaw[2] * 0.183)/1000));	
    	
    	// +/- 8G full scale
    	//printf("X = %7.3f G\t" , ((accRaw[0] * 0.244)/1000));
    	//printf(" Y =   %7.3f G\t" , ((accRaw[1] * 0.244)/1000));
    	//printf(" Z =  %7.3f G\n" , ((accRaw[2] * 0.244)/1000));	
    	
    	// +/- 12G full scale
    	printf("X = %7.2f G\t" , ((accRaw[0] * 0.732)/1000));
    	printf(" Y =   %7.2f G\t" , ((accRaw[1] * 0.732)/1000));
    	printf(" Z =  %7.2f G\n" , ((accRaw[2] * 0.732)/1000));	
    	
    	//printf("Xraw = %d \t" , accRaw[0]);
    	//printf(" Yraw =   %d \t" , accRaw[1]);
    	//printf(" Zraw =  %d \n" , accRaw[2]);		
    ....
    

    Please advice if not correct.

    Thanks

    #5869
    Sten-Helge
    Participant

    It was actually in my own C/C++ code I discovered this issue at first. I will investigate i bit more with different sensors before I conclude.

    A workaround has been to implement a circular buffer to the final output like so;

    ....
    float avgHeading[30];
    ....
    avgHeading) )] = tiltCompensatedHeading;
    i++;
    for (ii=0; ii < (int)( sizeof(avgHeading) / sizeof(avgHeading[0])); ii++){

    float radX = avgHeading[ii] * (M_PI/180); //Convert to radians
    float radY = avgHeading[ii] * (M_PI/180); //Convert to radians
    radX = cos(radX);
    x += radX;
    radY = sin(radY);
    y += radY;
    }
    float smoothData = (180/M_PI) * atan2(y,x);
    x = 0.0; y = 0.0;
    if(smoothData < 0)
    smoothData += 360;

    printf("Comp Head %7.3f \t Filt Head %7.1f\n", heading, smoothData);

    ....

    I guess there are more elegant ways to filter the output. Your advice would be highly appreciated.

    Thanks

    #5866
    Sten-Helge
    Participant

    Thanks for the prompt replay.
    A bit embarrassing - it turned out to be typo. Sorry for the inconvenience.

Viewing 6 posts - 1 through 6 (of 6 total)

Blip, blop, bloop...