project help gyro cam

hi there
i’m trying to get this code to work
gyro cam project
i have all the hardware ready
i have been , down loading any , and all , i can find of the kalman.h lib’s , but still compile error???

need to find wich kalman.h lib will work with project
and how to add to lib
and any help and info wood be excellent
i have been trying for about 2 weeks to get this to compile
cheerzzz

#include <Wire.h>

/ *
GYRO CAMERA - saft7.com

Demonstrates auto-leveling Camera Video by using Gyro and Accelerometer with Arduino

The circuit:
Servo controlled by Arduino, Gyro and Accelerometer using as reference of movement.

Created March 12, 2013
by Firman Saftari
www.saft7.com

This code and complete article can be found at:

http://www.saft7.com/

Programming Language: C + +

* /
# Include <Servo.h>
Servo xservo;

# Include <Wire.h>
# Include "Kalman.h"
Kalman kalmanX;
Kalman kalmanY;

uint8_t IMUAddress = 0x68; / / MPU6050 Address

/ * IMU Data * /
accX int16_t;
accy int16_t;
accZ int16_t;
tempRaw int16_t;
gyroX int16_t;
gyroY int16_t;
gyroZ int16_t;

Movex int;
MapX int;
int correctionX;

double accXangle;
double accYangle;
double gyroXangle = 9;
double gyroYangle = 180;
double compAngleX = 90;
double compAngleY ??= 90;
double kalAngleX;
double kalAngleY;
uint32_t timer;
/ / ---------- -------------- VOID SETUP START /
void setup () {
Serial.begin (115200);
xservo.attach (10);

Wire.begin ();
i2cWrite (0x6B, 0x00); / / Disable sleep mode
if (i2cRead (0x75, 1) [0]! = 0x68) {/ / Read "WHO_AM_I" register
Serial.print (F ("MPU-6050 with address 0x"));
Serial.print (IMUAddress, HEX);
Serial.println (F ("is not connected"));
while (1);
}
kalmanX.setAngle (90); / / Set the starting angle
kalmanY.setAngle (90);
timer = micros ();
}

/ / VOID ---------- -------------- END SETUP /
/ / ---------------------- -------------- VOID LOOP START /
void loop () {
/ * Update all the values ??* /
uint8_t * data = i2cRead (0x3B, 14);
accX = ((data [0] << 8) | Data [1]);
accy = ((data [2] << 8) | Data [3]);
accZ = ((data [4] << 8) | the data [5]);
tempRaw = ((data [6] << 8) | Data [7]);
gyroX = ((data [8] << 8) | Data [9]);
gyroY = ((data [10] << 8) | the data [11]);
gyroZ = ((data [12] << 8) | the data [13]);

/ * Calculate the angls based on the different sensors and algorithms * /

accYangle = (atan2 (accX, accZ) + PI) * RAD_TO_DEG;
accXangle = (atan2 (accy, accZ) + PI) * RAD_TO_DEG;
double gyroXrate = (double) gyroX/131.0;
double gyroYrate = - ((double) gyroY/131.0);
gyroXangle gyroXrate + = * ((double) (micros ()-timer) / 1000000); / / Calculate gyro angle without any filters

gyroXangle kalmanX.getRate + = () * ((double) (micros ()-timer) / 1000000); / / Calculate using the gyro angle Unbiased rate
compAngleX = (0.93 * (compAngleX + (gyroXrate * (double) (micros ()-timer) / 1000000))) + (0.07 * accXangle); / / Calculate the angle using a Complimentary filter

kalAngleX = kalmanX.getAngle (accXangle, gyroXrate, (double) (micros ()-timer) / 1000000); / / Calculate the angle using a Kalman filter
timer = micros ();
MapX = map (kalAngleX, 0, 200, 0, 179); / / calculate limitation of mechanical servo

/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /

correctionX = 27; / / EDIT THIS VALUE FOR CORRECTION ANGLE SERVO

/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
Movex = 270 - (kalAngleX) + correctionX;

/ / ------- START PRINT SEND TO SERIAL ----- /

Serial.print ("saft7.com X Pos:");
Serial.print (Movex); Serial.print ("\ t");
Serial.print ("\ n");

/ / ------- END PRINT SEND TO SERIAL ----- /
/ / ------- ----- SEND TO SERVO START /

xservo.write (Movex); / / Send signal to servo
delay (15); / / delay to allow the servos to move (ms)

/ / ------- ----- END SEND TO SERVO /

delay (1); / / The accelerometer's maximum rate is 1kHz samples
}
/ / ---------------------- END LOOP VOID -------------- /

 

/ / - START FUNCTIONS -
void i2cWrite (registerAddress uint8_t, uint8_t data) {
Wire.beginTransmission (IMUAddress);
Wire.write (registerAddress);
Wire.write (data);
Wire.endTransmission (); / / Send stop
}

uint8_t * i2cRead (registerAddress uint8_t, uint8_t nbytes) {
Data uint8_t [nbytes];
Wire.beginTransmission (IMUAddress);
Wire.write (registerAddress);
Wire.endTransmission (false); / / Do not release the bus
Wire.requestFrom (IMUAddress, nbytes); / / Send a repeated start and then release the bus after reading
for (uint8_t i = 0; i <nbytes; i + +)
the data [i] = Wire.read ();
return data;
}
/ / - END FUNCTIONS -

/ / GYROCAM BY SAFT7.COM / /

/ / END :stuck_out_tongue_closed_eyes: :stuck_out_tongue_closed_eyes: :stuck_out_tongue_closed_eyes: :stuck_out_tongue_closed_eyes:
[code]

[/code]

hi there
i’m trying to get this code to work
gyro cam project
i have all the hardware ready
i have been , down loading any , and all , i can find of the kalman.h lib’s , but still compile error???

need to find wich kalman.h lib will work with project
and how to add to lib
and any help and info wood be excellent
i have been trying for about 2 weeks to get this to compile

gyrocameramotorcycle.ino (4.04 KB)

I can't find the kalman library, do you have a link to it ?

What errors are you getting? Where did you put the library you are using? What version of the IDE are you using?

You've made a total of two posts, in two different sections of the forum, asking the same question. You are not off to a good start.

littlepete1127: need to find wich kalman.h lib will work with project

Is this somebody else's project you're trying to build? If so, you need to use whichever library was used for the original project.

Without knowing what the original project was, or what library it used, or what libraries you've tried, or the errors you got when trying them, I don't see any way to help you.

@littlepete1127, please do not cross-post. Threads merged.

i have the same library for my gyrocam project.... if you need the kalman.h i can dens it to you via e-mail. you will also need the i2c library ..

i tried your approach and had no luck ... i was writing the sensor angle value to the servomotor ... the thing was jittering badly.. but there is a big problem with the centrifugal force whie riding the motorcycle... i got my project working perfectly in stand-still but on the motorbike there is the problem of centrifugal force ... and i'm currently delaing on how to compensate the centrifugal force :~

Did you make any progress by cleaning out centrifugal forces?