icewwn / ardu-imu

Automatically exported from code.google.com/p/ardu-imu
0 stars 0 forks source link

Error Compiling with USE_MAGNETOMETER == 1 #11

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Setting USE_MAGNETOMETER == 1 

What version of the product are you using? On what operating system?
IMU v2+; Windows 7

Please provide any additional information below.

#if USE_MAGNETOMETER == 1
    APM_Compass.Init(); // I2C initialization
    debug_handler(3);
#endif

arduimu.cpp: In function 'void setup()':
arduimu:286: error: 'APM_Compass' was not declared in this scope
arduimu.cpp: In function 'void loop()':
arduimu:385: error: 'APM_Compass' was not declared in this scope
arduimu.cpp: In function 'void Drift_correction()':
DCM:170: error: 'AP_Compass' was not declared in this scope

also, how does one define which orientation matrix to use? is it here?

virtual void set_orientation(const Matrix3f &rotation_matrix);

Original issue reported on code.google.com by darrylni...@hotmail.com on 27 Dec 2010 at 3:18

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Same problem when setting use magnetometer to 1 I get 'APM_COMPASS' was not 
declared in this scope

Original comment by JDCL...@gmail.com on 23 Jan 2011 at 4:00

GoogleCodeExporter commented 8 years ago
try to insert as global variable
APM_Compass_Class APM_Compass; 

Original comment by vito.amm...@gmail.com on 30 Apr 2011 at 1:55

GoogleCodeExporter commented 8 years ago
I added APM_Compass as a global variable but there were other problems - in 
some places AP_Compass versus APM_Compass, etc... I'll see if I can debug 
those, but in the meantime I turned off magnetometer. 

Original comment by devangel...@gmail.com on 1 May 2011 at 9:12

GoogleCodeExporter commented 8 years ago
You need to change all AP_Compass into APM_Compass and if you don't use the 
binary output, change also 
    #if USE_MAGNETOMETER == 1
        Serial.print("MGX:");
        Serial.print(APM_Compass.Mag_X);
        Serial.print (",MGY:");
        Serial.print(APM_Compass.Mag_Y);
        Serial.print (",MGZ:");
        Serial.print(APM_Compass.Mag_Z);
        Serial.print (",MGH:");
        Serial.print(APM_Compass.Heading);
        Serial.print (",");
    #endif

Original comment by vito.amm...@gmail.com on 1 May 2011 at 9:41

GoogleCodeExporter commented 8 years ago
There is one spot where you have to change from a global variable Mag_HeadingX 
or something like that to calling the APM_Compass.Heading_X.

Separate from that, lines to initialize the compass offset, declination and 
orientation on airframe need to be added.  The airframe one is confusing - 
reading the APM_Compass.h file and looking at the markings on the boards say 
that a RH coordinate system is not in use and that components up, pins right 
should be a 45 yaw rotation (which the markings say it's just -yaw????) 

Original comment by devangel...@gmail.com on 5 May 2011 at 3:24

GoogleCodeExporter commented 8 years ago
The attached patch fixed compiling the ArduIMU 1.8.2 code with the Magnetometer 
for me. It would be nice if it could be included in the code base. Thanks!

Original comment by Lenz.Gri...@gmail.com on 26 Jun 2011 at 12:49

Attachments:

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I have spent a lot of time trying to fix this problem i have finally fix it i 
will attach the patch file. This worked for me so pleases cheek it out let me 
know.

Note: You will need to update the IMU Library's to the latest revision and put 
the files APM_Compass.h and APM_Compass.cpp in your 
(Documents\Arduino\libraries\AP_Compass) folder

Original comment by justinro...@yahoo.com on 6 Sep 2011 at 9:41

Attachments:

GoogleCodeExporter commented 8 years ago
I've noticed that if I have 
#define USE_MAGNETOMETER 0
and
#define PRINT_MAGNETOMETER 1
then I get a similar problem. 
I'm using ArduIMU 1.9.8
Solution: make both "1" or "0"

Original comment by intuitiv...@gmail.com on 10 Nov 2013 at 11:38