Skip to content

An Arduino Library for compass tilt compensation and hard iron offset

Notifications You must be signed in to change notification settings

n0m1/Comp6DOF_n0m1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Comp6DOF_n0m1

Arduino Library for compass tilt compensation and hard iron offset.

Authors

This code was partially ported to C from the Freescale appnote AN4248. http://www.freescale.com/files/sensors/doc/app_note/AN4248.pdf The sine function comes from Dave Dribin's TrigInt lib. https://bitbucket.org/ddribin/trigint

Dependencies: none

List of Functions

Function: compCompass
Description: compass compensation calculation
Parameters: Input raw compass values, xyz, 
	    and accelerometer values xyz,
	    boolean lowpass enable	 		
------------------------------------------------------
Function: roll
Return: (int) returns roll result -18000 to 18000 
------------------------------------------------------
Function: pitch
Return: (int) returns pitch result -9000 to 9000
------------------------------------------------------ 
Function: yaw
Return: (int) returns yaw result -18000 to 18000
------------------------------------------------------
Function: rollf
Return: (float) returns roll as float value -180.00 to 180.00 
------------------------------------------------------
Function: pitchf
Return: (float) returns pitch as float value -90.00 to 90.00
------------------------------------------------------ 
Function: yawf
Return: (float) returns yaw as float value -180.00 to 180.00
------------------------------------------------------
Function: xAxisComp
Return: (int) return tilt compensated xAxis compass result
------------------------------------------------------
Function: yAxisComp
Return: (int) return tilt compensated yAxis compass result
------------------------------------------------------
Function: zAxisComp
Return: (int) return tilt compensated zAxis compass result 
------------------------------------------------------ 
Function: xHardOff
Return: (int) return hardiron xOffset for compass
------------------------------------------------------
Function: yHardOff
Return: (int) return hardiron yOffset for compass
------------------------------------------------------
Function: zHardOff
Return: (int) return hardiron zOffset for compass
------------------------------------------------------
Function: deviantSpread
Description: get all axis combos (8) & load array
Parameters: int xAxis, int yAxis, int zAxis
------------------------------------------------------  
Function: calOffsets
Description: solve for x,y,z max & min, filter results, pick the best and average
Return: (boolean) return true if avgnum >3
------------------------------------------------------ 
Function: atan2Int
Parameters: int xInput, int yInput

About

An Arduino Library for compass tilt compensation and hard iron offset

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages