├── Makefile ├── Example.cpp ├── MPU6050.h ├── README.md ├── MPU6050.cpp └── LICENSE /Makefile: -------------------------------------------------------------------------------- 1 | CC=g++ 2 | 3 | DEPS=MPU6050.h 4 | CFLAGS=-fPIC -Wall 5 | 6 | LIBS=-li2c 7 | LFLAGS=-shared 8 | 9 | OBJ=MPU6050.o 10 | OLIB=libMPU6050.so 11 | 12 | 13 | 14 | %.o: %.cpp $(DEPS) 15 | $(CC) -c $< -o $@ $(CFLAGS) 16 | 17 | all: $(OBJ) 18 | $(CC) -o $(OLIB) $< $(LIBS) $(LFLAGS) 19 | 20 | install: all $(OLIB) $(DEPS) 21 | install -m 755 -p $(OLIB) /usr/lib/ 22 | install -m 644 -p $(DEPS) /usr/include/ 23 | 24 | uninstall: 25 | rm -f /usr/include/MPU6050.h 26 | rm -f /usr/lib/libMPU6050.so 27 | 28 | clean: 29 | rm -f Example 30 | rm -f Example.o 31 | rm -f MPU6050.o 32 | rm -f libMPU6050.so 33 | 34 | example: Example.o 35 | $(CC) $< -o Example -lMPU6050 -pthread 36 | -------------------------------------------------------------------------------- /Example.cpp: -------------------------------------------------------------------------------- 1 | //-------------------------------MPU6050 Accelerometer and Gyroscope C++ library----------------------------- 2 | //Copyright (c) 2019, Alex Mous 3 | //Licensed under the CC BY-NC SA 4.0 4 | 5 | //Example code 6 | 7 | #include 8 | 9 | MPU6050 device(0x68); 10 | 11 | int main() { 12 | float ax, ay, az, gr, gp, gy; //Variables to store the accel, gyro and angle values 13 | 14 | sleep(1); //Wait for the MPU6050 to stabilize 15 | 16 | /* 17 | //Calculate the offsets 18 | std::cout << "Calculating the offsets...\n Please keep the accelerometer level and still\n This could take a couple of minutes..."; 19 | device.getOffsets(&ax, &ay, &az, &gr, &gp, &gy); 20 | std::cout << "Gyroscope R,P,Y: " << gr << "," << gp << "," << gy << "\nAccelerometer X,Y,Z: " << ax << "," << ay << "," << az << "\n"; 21 | */ 22 | 23 | //Read the current yaw angle 24 | device.calc_yaw = true; 25 | 26 | for (int i = 0; i < 40; i++) { 27 | device.getAngle(0, &gr); 28 | device.getAngle(1, &gp); 29 | device.getAngle(2, &gy); 30 | std::cout << "Current angle around the roll axis: " << gr << "\n"; 31 | std::cout << "Current angle around the pitch axis: " << gp << "\n"; 32 | std::cout << "Current angle around the yaw axis: " << gy << "\n"; 33 | usleep(250000); //0.25sec 34 | } 35 | 36 | //Get the current accelerometer values 37 | device.getAccel(&ax, &ay, &az); 38 | std::cout << "Accelerometer Readings: X: " << ax << ", Y: " << ay << ", Z: " << az << "\n"; 39 | 40 | //Get the current gyroscope values 41 | device.getGyro(&gr, &gp, &gy); 42 | std::cout << "Gyroscope Readings: X: " << gr << ", Y: " << gp << ", Z: " << gy << "\n"; 43 | 44 | return 0; 45 | } 46 | 47 | 48 | -------------------------------------------------------------------------------- /MPU6050.h: -------------------------------------------------------------------------------- 1 | //-------------------------------MPU6050 Accelerometer and Gyroscope C++ library----------------------------- 2 | //Copyright (c) 2019, Alex Mous 3 | //Licensed under the CC BY-NC SA 4.0 4 | 5 | 6 | //-----------------------MODIFY THESE PARAMETERS----------------------- 7 | 8 | #define GYRO_RANGE 0 //Select which gyroscope range to use (see the table below) - Default is 0 9 | // Gyroscope Range 10 | // 0 +/- 250 degrees/second 11 | // 1 +/- 500 degrees/second 12 | // 2 +/- 1000 degrees/second 13 | // 3 +/- 2000 degrees/second 14 | //See the MPU6000 Register Map for more information 15 | 16 | 17 | #define ACCEL_RANGE 0 //Select which accelerometer range to use (see the table below) - Default is 0 18 | // Accelerometer Range 19 | // 0 +/- 2g 20 | // 1 +/- 4g 21 | // 2 +/- 8g 22 | // 3 +/- 16g 23 | //See the MPU6000 Register Map for more information 24 | 25 | 26 | //Offsets - supply your own here (calculate offsets with getOffsets function) 27 | // Accelerometer 28 | #define A_OFF_X 19402 29 | #define A_OFF_Y -2692 30 | #define A_OFF_Z -8625 31 | // Gyroscope 32 | #define G_OFF_X -733 33 | #define G_OFF_Y 433 34 | #define G_OFF_Z -75 35 | 36 | //-----------------------END MODIFY THESE PARAMETERS----------------------- 37 | 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | extern "C" { 45 | #include 46 | #include 47 | } 48 | #include 49 | #include 50 | 51 | #define _POSIX_C_SOURCE 200809L //Used for calculating time 52 | 53 | #define TAU 0.05 //Complementary filter percentage 54 | #define RAD_T_DEG 57.29577951308 //Radians to degrees (180/PI) 55 | 56 | //Select the appropriate settings 57 | #if GYRO_RANGE == 1 58 | #define GYRO_SENS 65.5 59 | #define GYRO_CONFIG 0b00001000 60 | #elif GYRO_RANGE == 2 61 | #define GYRO_SENS 32.8 62 | #define GYRO_CONFIG 0b00010000 63 | #elif GYRO_RANGE == 3 64 | #define GYRO_SENS 16.4 65 | #define GYRO_CONFIG 0b00011000 66 | #else //Otherwise, default to 0 67 | #define GYRO_SENS 131.0 68 | #define GYRO_CONFIG 0b00000000 69 | #endif 70 | #undef GYRO_RANGE 71 | 72 | 73 | #if ACCEL_RANGE == 1 74 | #define ACCEL_SENS 8192.0 75 | #define ACCEL_CONFIG 0b00001000 76 | #elif ACCEL_RANGE == 2 77 | #define ACCEL_SENS 4096.0 78 | #define ACCEL_CONFIG 0b00010000 79 | #elif ACCEL_RANGE == 3 80 | #define ACCEL_SENS 2048.0 81 | #define ACCEL_CONFIG 0b00011000 82 | #else //Otherwise, default to 0 83 | #define ACCEL_SENS 16384.0 84 | #define ACCEL_CONFIG 0b00000000 85 | #endif 86 | #undef ACCEL_RANGE 87 | 88 | 89 | 90 | 91 | class MPU6050 { 92 | private: 93 | void _update(); 94 | 95 | float _accel_angle[3]; 96 | float _gyro_angle[3]; 97 | float _angle[3]; //Store all angles (accel roll, accel pitch, accel yaw, gyro roll, gyro pitch, gyro yaw, comb roll, comb pitch comb yaw) 98 | 99 | float ax, ay, az, gr, gp, gy; //Temporary storage variables used in _update() 100 | 101 | int MPU6050_addr; 102 | int f_dev; //Device file 103 | 104 | float dt; //Loop time (recalculated with each loop) 105 | 106 | struct timespec start,end; //Create a time structure 107 | 108 | bool _first_run = 1; //Variable for whether to set gyro angle to acceleration angle in compFilter 109 | public: 110 | MPU6050(int8_t addr); 111 | MPU6050(int8_t addr, bool run_update_thread); 112 | void getAccelRaw(float *x, float *y, float *z); 113 | void getGyroRaw(float *roll, float *pitch, float *yaw); 114 | void getAccel(float *x, float *y, float *z); 115 | void getGyro(float *roll, float *pitch, float *yaw); 116 | void getOffsets(float *ax_off, float *ay_off, float *az_off, float *gr_off, float *gp_off, float *gy_off); 117 | int getAngle(int axis, float *result); 118 | bool calc_yaw; 119 | }; 120 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

MPU6050 Accelerometer and Gyroscope C++ library


2 |

Description


    This is a basic 3 | control library for using the MPU6050 accelerometer and gyroscope module with Raspberry Pi using i2c protocol
    It provides functions to read raw accelerometer data and fully 4 | corrected (with complementary filters and some logic) angles on any axis (roll, pitch, yaw)

Installation


5 | The dependencies for this library are libi2c-dev, i2c-tools, and libi2c0. These can be installed with apt. The latest version of this code now works on Raspbian Buster. Note: to run the code, you will need to enable I2C in raspi-config.

Function 6 | Definitions

    

__constructor__ (MPU6050)

7 |         args:
            int8_t 8 | addr - the address of the MPU6050 (usually 0x68; can find with command "i2cdetect -y 1" (may need to be installed - run "sudo 9 | apt-get install i2c-tools -y")
        description:
10 |             sets up i2c device and starts loop to read the angle
11 |     

getAccelRaw

        args:
12 |             float *x - pointer to the variable where the X axis results should 13 | be stored
            float *y - pointer to the variable where the Y axis 14 | results should be stored
            float *z - pointer to the variable 15 | where the Z axis results should be stored
        description:
16 |             gets the raw accelerometer values from the MPU6050 registers
17 |     

getAccel

        args:
18 |             float *x - pointer to the variable where the X axis results 19 | should be stored
            float *y - pointer to the variable where the 20 | Y axis results should be stored
           &nbpfloat *z - pointer to the 21 | variable where the Z axis results should be stored
        description:
22 |             gets the accelerometer values (in g), rounded to three decimal 23 | places
    

getGyroRaw

        args:
24 |             float *roll - pointer to the variable where the roll (X) axis 25 | results should be stored
            float *pitch - pointer to the 26 | variable where the pitch (Y) axis results should be stored
27 |             float *yaw - pointer to the variable where the yaw (Z) axis 28 | results should be stored
        description:
29 |             gets the raw gyroscope values from the MPU6050 registers
30 |  nbsp  

getGyro

        args:
31 |             float *roll - pointer to the variable where the roll (X) axis 32 | results should be stored
            float *pitch - pointer to the 33 | variable where the pitch (Y) axis results should be stored
34 |             float *yaw - pointer to the variable where the yaw (Z) axis 35 | results should be stored
        description:
36 |             gets the gyroscope values (in degrees/second)
37 |     

getOffsets

        args:
38 |             float *ax_off - pointer to the variable where the accelerometer x 39 | axis offset will be stored
         &nsp  float *ay_off - pointer to the 40 | variable where the accelerometer y axis offset will be stored
41 |             float *az_off - pointer to the variable where the accelerometer z 42 | axis offset will be stored
            float *gr_off - pointer to the 43 | variable where the gyroscope roll axis offset will be stored
44 |             float *gp_off - pointer to the variable where the gyroscope pitch 45 | axis offset will be stored
            float *gy_off - pointer to the 46 | variable where the gyroscope yaw axis offset will be stored
47 |         description:
48 |             finds the offsets needed
49 |             before running, place the module on a completely flat surface 50 | (check with a sirit level if possible) and make sure that it stays still while running this function, the results will be 51 | stored in the variables ax_off, ay_off, az_off, gr_off, gp_off, gy_off for accel x offset... and gyro roll offset..., take 52 | these values and put them into the MPU6050.h file (A_OFF_X, A_OFF_Y, A_OFF_Z, G_OFF_X, G_OFF_Y and G_OFF_Z)
53 |     

getAngle

        args:
54 |             int axis - which axis to use (0 for roll (x), 1 for pitch (Y) and 55 | 2 for yaw (Z))
            float *results - pointer to the variable where 56 | the angle will be stored
        description:
57 |             gets the current combined (accelerometer and gyroscope) angle
58 |             NOTE: the yaw axis will return 0 unless 'calc_yaw' i set to true 59 | - See Parameters

Parameters:

    

calc_yaw

60 |         type:
            bool
61 |         description:
62 |             set this to true when you want to calculate the angle around the 63 | yaw axis (remember to change this back to false after taking the yaw readings to prevent gyroscope drift)
64 |             this is used to prevent drift because only the gyroscope is used 65 | to calculate the yaw rotation
Copyright (c) 2019, Alex Mous
Licensed under the Creative Commons 66 | Attribution-ShareAlike 4.0 International (CC-BY-4.0)



67 | -------------------------------------------------------------------------------- /MPU6050.cpp: -------------------------------------------------------------------------------- 1 | //-------------------------------MPU6050 Accelerometer and Gyroscope C++ library----------------------------- 2 | //Copyright (c) 2019, Alex Mous 3 | //Licensed under the CC BY-NC SA 4.0 4 | 5 | //Include the header file for this class 6 | #include "MPU6050.h" 7 | 8 | MPU6050::MPU6050(int8_t addr, bool run_update_thread) { 9 | int status; 10 | 11 | MPU6050_addr = addr; 12 | dt = 0.009; //Loop time (recalculated with each loop) 13 | _first_run = 1; //Variable for whether to set gyro angle to acceleration angle in compFilter 14 | calc_yaw = false; 15 | 16 | f_dev = open("/dev/i2c-1", O_RDWR); //Open the I2C device file 17 | if (f_dev < 0) { //Catch errors 18 | std::cout << "ERR (MPU6050.cpp:MPU6050()): Failed to open /dev/i2c-1. Please check that I2C is enabled with raspi-config\n"; //Print error message 19 | } 20 | 21 | status = ioctl(f_dev, I2C_SLAVE, MPU6050_addr); //Set the I2C bus to use the correct address 22 | if (status < 0) { 23 | std::cout << "ERR (MPU6050.cpp:MPU6050()): Could not get I2C bus with " << addr << " address. Please confirm that this address is correct\n"; //Print error message 24 | } 25 | 26 | i2c_smbus_write_byte_data(f_dev, 0x6b, 0b00000000); //Take MPU6050 out of sleep mode - see Register Map 27 | 28 | i2c_smbus_write_byte_data(f_dev, 0x1a, 0b00000011); //Set DLPF (low pass filter) to 44Hz (so no noise above 44Hz will pass through) 29 | 30 | i2c_smbus_write_byte_data(f_dev, 0x19, 0b00000100); //Set sample rate divider (to 200Hz) - see Register Map 31 | 32 | i2c_smbus_write_byte_data(f_dev, 0x1b, GYRO_CONFIG); //Configure gyroscope settings - see Register Map (see MPU6050.h for the GYRO_CONFIG parameter) 33 | 34 | i2c_smbus_write_byte_data(f_dev, 0x1c, ACCEL_CONFIG); //Configure accelerometer settings - see Register Map (see MPU6050.h for the GYRO_CONFIG parameter) 35 | 36 | //Set offsets to zero 37 | i2c_smbus_write_byte_data(f_dev, 0x06, 0b00000000), i2c_smbus_write_byte_data(f_dev, 0x07, 0b00000000), i2c_smbus_write_byte_data(f_dev, 0x08, 0b00000000), i2c_smbus_write_byte_data(f_dev, 0x09, 0b00000000), i2c_smbus_write_byte_data(f_dev, 0x0A, 0b00000000), i2c_smbus_write_byte_data(f_dev, 0x0B, 0b00000000), i2c_smbus_write_byte_data(f_dev, 0x00, 0b10000001), i2c_smbus_write_byte_data(f_dev, 0x01, 0b00000001), i2c_smbus_write_byte_data(f_dev, 0x02, 0b10000001); 38 | 39 | if (run_update_thread){ 40 | std::thread(&MPU6050::_update, this).detach(); //Create a seperate thread, for the update routine to run in the background, and detach it, allowing the program to continue 41 | } 42 | } 43 | 44 | MPU6050::MPU6050(int8_t addr) : MPU6050(addr, true){} 45 | 46 | void MPU6050::getGyroRaw(float *roll, float *pitch, float *yaw) { 47 | int16_t X = i2c_smbus_read_byte_data(f_dev, 0x43) << 8 | i2c_smbus_read_byte_data(f_dev, 0x44); //Read X registers 48 | int16_t Y = i2c_smbus_read_byte_data(f_dev, 0x45) << 8 | i2c_smbus_read_byte_data(f_dev, 0x46); //Read Y registers 49 | int16_t Z = i2c_smbus_read_byte_data(f_dev, 0x47) << 8 | i2c_smbus_read_byte_data(f_dev, 0x48); //Read Z registers 50 | *roll = (float)X; //Roll on X axis 51 | *pitch = (float)Y; //Pitch on Y axis 52 | *yaw = (float)Z; //Yaw on Z axis 53 | } 54 | 55 | void MPU6050::getGyro(float *roll, float *pitch, float *yaw) { 56 | getGyroRaw(roll, pitch, yaw); //Store raw values into variables 57 | *roll = round((*roll - G_OFF_X) * 1000.0 / GYRO_SENS) / 1000.0; //Remove the offset and divide by the gyroscope sensetivity (use 1000 and round() to round the value to three decimal places) 58 | *pitch = round((*pitch - G_OFF_Y) * 1000.0 / GYRO_SENS) / 1000.0; 59 | *yaw = round((*yaw - G_OFF_Z) * 1000.0 / GYRO_SENS) / 1000.0; 60 | } 61 | 62 | void MPU6050::getAccelRaw(float *x, float *y, float *z) { 63 | int16_t X = i2c_smbus_read_byte_data(f_dev, 0x3b) << 8 | i2c_smbus_read_byte_data(f_dev, 0x3c); //Read X registers 64 | int16_t Y = i2c_smbus_read_byte_data(f_dev, 0x3d) << 8 | i2c_smbus_read_byte_data(f_dev, 0x3e); //Read Y registers 65 | int16_t Z = i2c_smbus_read_byte_data(f_dev, 0x3f) << 8 | i2c_smbus_read_byte_data(f_dev, 0x40); //Read Z registers 66 | *x = (float)X; 67 | *y = (float)Y; 68 | *z = (float)Z; 69 | } 70 | 71 | void MPU6050::getAccel(float *x, float *y, float *z) { 72 | getAccelRaw(x, y, z); //Store raw values into variables 73 | *x = round((*x - A_OFF_X) * 1000.0 / ACCEL_SENS) / 1000.0; //Remove the offset and divide by the accelerometer sensetivity (use 1000 and round() to round the value to three decimal places) 74 | *y = round((*y - A_OFF_Y) * 1000.0 / ACCEL_SENS) / 1000.0; 75 | *z = round((*z - A_OFF_Z) * 1000.0 / ACCEL_SENS) / 1000.0; 76 | } 77 | 78 | void MPU6050::getOffsets(float *ax_off, float *ay_off, float *az_off, float *gr_off, float *gp_off, float *gy_off) { 79 | float gyro_off[3]; //Temporary storage 80 | float accel_off[3]; 81 | 82 | *gr_off = 0, *gp_off = 0, *gy_off = 0; //Initialize the offsets to zero 83 | *ax_off = 0, *ay_off = 0, *az_off = 0; //Initialize the offsets to zero 84 | 85 | for (int i = 0; i < 10000; i++) { //Use loop to average offsets 86 | getGyroRaw(&gyro_off[0], &gyro_off[1], &gyro_off[2]); //Raw gyroscope values 87 | *gr_off = *gr_off + gyro_off[0], *gp_off = *gp_off + gyro_off[1], *gy_off = *gy_off + gyro_off[2]; //Add to sum 88 | 89 | getAccelRaw(&accel_off[0], &accel_off[1], &accel_off[2]); //Raw accelerometer values 90 | *ax_off = *ax_off + accel_off[0], *ay_off = *ay_off + accel_off[1], *az_off = *az_off + accel_off[2]; //Add to sum 91 | } 92 | 93 | *gr_off = *gr_off / 10000, *gp_off = *gp_off / 10000, *gy_off = *gy_off / 10000; //Divide by number of loops (to average) 94 | *ax_off = *ax_off / 10000, *ay_off = *ay_off / 10000, *az_off = *az_off / 10000; 95 | 96 | *az_off = *az_off - ACCEL_SENS; //Remove 1g from the value calculated to compensate for gravity) 97 | } 98 | 99 | int MPU6050::getAngle(int axis, float *result) { 100 | if (axis >= 0 && axis <= 2) { //Check that the axis is in the valid range 101 | *result = _angle[axis]; //Get the result 102 | return 0; 103 | } 104 | else { 105 | std::cout << "ERR (MPU6050.cpp:getAngle()): 'axis' must be between 0 and 2 (for roll, pitch or yaw)\n"; //Print error message 106 | *result = 0; //Set result to zero 107 | return 1; 108 | } 109 | } 110 | 111 | void MPU6050::_update() { //Main update function - runs continuously 112 | clock_gettime(CLOCK_REALTIME, &start); //Read current time into start variable 113 | 114 | while (1) { //Loop forever 115 | getGyro(&gr, &gp, &gy); //Get the data from the sensors 116 | getAccel(&ax, &ay, &az); 117 | 118 | //X (roll) axis 119 | _accel_angle[0] = atan2(az, ay) * RAD_T_DEG - 90.0; //Calculate the angle with z and y convert to degrees and subtract 90 degrees to rotate 120 | _gyro_angle[0] = _angle[0] + gr*dt; //Use roll axis (X axis) 121 | 122 | //Y (pitch) axis 123 | _accel_angle[1] = atan2(az, ax) * RAD_T_DEG - 90.0; //Calculate the angle with z and x convert to degrees and subtract 90 degrees to rotate 124 | _gyro_angle[1] = _angle[1] + gp*dt; //Use pitch axis (Y axis) 125 | 126 | //Z (yaw) axis 127 | if (calc_yaw) { 128 | _gyro_angle[2] = _angle[2] + gy*dt; //Use yaw axis (Z axis) 129 | } 130 | 131 | 132 | if (_first_run) { //Set the gyroscope angle reference point if this is the first function run 133 | for (int i = 0; i <= 1; i++) { 134 | _gyro_angle[i] = _accel_angle[i]; //Start off with angle from accelerometer (absolute angle since gyroscope is relative) 135 | } 136 | _gyro_angle[2] = 0; //Set the yaw axis to zero (because the angle cannot be calculated with the accelerometer when vertical) 137 | _first_run = 0; 138 | } 139 | 140 | float asum = abs(ax) + abs(ay) + abs(az); //Calculate the sum of the accelerations 141 | float gsum = abs(gr) + abs(gp) + abs(gy); //Calculate the sum of the gyro readings 142 | 143 | for (int i = 0; i <= 1; i++) { //Loop through roll and pitch axes 144 | if (abs(_gyro_angle[i] - _accel_angle[i]) > 5) { //Correct for very large drift (or incorrect measurment of gyroscope by longer loop time) 145 | _gyro_angle[i] = _accel_angle[i]; 146 | } 147 | 148 | //Create result from either complementary filter or directly from gyroscope or accelerometer depending on conditions 149 | if (asum > 0.1 && asum < 3 && gsum > 0.3) { //Check that th movement is not very high (therefore providing inacurate angles) 150 | _angle[i] = (1 - TAU)*(_gyro_angle[i]) + (TAU)*(_accel_angle[i]); //Calculate the angle using a complementary filter 151 | } 152 | else if (gsum > 0.3) { //Use the gyroscope angle if the acceleration is high 153 | _angle[i] = _gyro_angle[i]; 154 | } 155 | else if (gsum <= 0.3) { //Use accelerometer angle if not much movement 156 | _angle[i] = _accel_angle[i]; 157 | } 158 | } 159 | 160 | //The yaw axis will not work with the accelerometer angle, so only use gyroscope angle 161 | if (calc_yaw) { //Only calculate the angle when we want it to prevent large drift 162 | _angle[2] = _gyro_angle[2]; 163 | } 164 | else { 165 | _angle[2] = 0; 166 | _gyro_angle[2] = 0; 167 | } 168 | 169 | clock_gettime(CLOCK_REALTIME, &end); //Save time to end clock 170 | dt = (end.tv_sec - start.tv_sec) + (end.tv_nsec - start.tv_nsec) / 1e9; //Calculate new dt 171 | clock_gettime(CLOCK_REALTIME, &start); //Save time to start clock 172 | } 173 | } 174 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Attribution-ShareAlike 4.0 International 2 | 3 | ======================================================================= 4 | 5 | Creative Commons Corporation ("Creative Commons") is not a law firm and 6 | does not provide legal services or legal advice. Distribution of 7 | Creative Commons public licenses does not create a lawyer-client or 8 | other relationship. Creative Commons makes its licenses and related 9 | information available on an "as-is" basis. Creative Commons gives no 10 | warranties regarding its licenses, any material licensed under their 11 | terms and conditions, or any related information. Creative Commons 12 | disclaims all liability for damages resulting from their use to the 13 | fullest extent possible. 14 | 15 | Using Creative Commons Public Licenses 16 | 17 | Creative Commons public licenses provide a standard set of terms and 18 | conditions that creators and other rights holders may use to share 19 | original works of authorship and other material subject to copyright 20 | and certain other rights specified in the public license below. The 21 | following considerations are for informational purposes only, are not 22 | exhaustive, and do not form part of our licenses. 23 | 24 | Considerations for licensors: Our public licenses are 25 | intended for use by those authorized to give the public 26 | permission to use material in ways otherwise restricted by 27 | copyright and certain other rights. Our licenses are 28 | irrevocable. Licensors should read and understand the terms 29 | and conditions of the license they choose before applying it. 30 | Licensors should also secure all rights necessary before 31 | applying our licenses so that the public can reuse the 32 | material as expected. Licensors should clearly mark any 33 | material not subject to the license. This includes other CC- 34 | licensed material, or material used under an exception or 35 | limitation to copyright. More considerations for licensors: 36 | wiki.creativecommons.org/Considerations_for_licensors 37 | 38 | Considerations for the public: By using one of our public 39 | licenses, a licensor grants the public permission to use the 40 | licensed material under specified terms and conditions. If 41 | the licensor's permission is not necessary for any reason--for 42 | example, because of any applicable exception or limitation to 43 | copyright--then that use is not regulated by the license. Our 44 | licenses grant only permissions under copyright and certain 45 | other rights that a licensor has authority to grant. Use of 46 | the licensed material may still be restricted for other 47 | reasons, including because others have copyright or other 48 | rights in the material. A licensor may make special requests, 49 | such as asking that all changes be marked or described. 50 | Although not required by our licenses, you are encouraged to 51 | respect those requests where reasonable. More_considerations 52 | for the public: 53 | wiki.creativecommons.org/Considerations_for_licensees 54 | 55 | ======================================================================= 56 | 57 | Creative Commons Attribution-ShareAlike 4.0 International Public 58 | License 59 | 60 | By exercising the Licensed Rights (defined below), You accept and agree 61 | to be bound by the terms and conditions of this Creative Commons 62 | Attribution-ShareAlike 4.0 International Public License ("Public 63 | License"). To the extent this Public License may be interpreted as a 64 | contract, You are granted the Licensed Rights in consideration of Your 65 | acceptance of these terms and conditions, and the Licensor grants You 66 | such rights in consideration of benefits the Licensor receives from 67 | making the Licensed Material available under these terms and 68 | conditions. 69 | 70 | 71 | Section 1 -- Definitions. 72 | 73 | a. Adapted Material means material subject to Copyright and Similar 74 | Rights that is derived from or based upon the Licensed Material 75 | and in which the Licensed Material is translated, altered, 76 | arranged, transformed, or otherwise modified in a manner requiring 77 | permission under the Copyright and Similar Rights held by the 78 | Licensor. For purposes of this Public License, where the Licensed 79 | Material is a musical work, performance, or sound recording, 80 | Adapted Material is always produced where the Licensed Material is 81 | synched in timed relation with a moving image. 82 | 83 | b. Adapter's License means the license You apply to Your Copyright 84 | and Similar Rights in Your contributions to Adapted Material in 85 | accordance with the terms and conditions of this Public License. 86 | 87 | c. BY-SA Compatible License means a license listed at 88 | creativecommons.org/compatiblelicenses, approved by Creative 89 | Commons as essentially the equivalent of this Public License. 90 | 91 | d. Copyright and Similar Rights means copyright and/or similar rights 92 | closely related to copyright including, without limitation, 93 | performance, broadcast, sound recording, and Sui Generis Database 94 | Rights, without regard to how the rights are labeled or 95 | categorized. For purposes of this Public License, the rights 96 | specified in Section 2(b)(1)-(2) are not Copyright and Similar 97 | Rights. 98 | 99 | e. Effective Technological Measures means those measures that, in the 100 | absence of proper authority, may not be circumvented under laws 101 | fulfilling obligations under Article 11 of the WIPO Copyright 102 | Treaty adopted on December 20, 1996, and/or similar international 103 | agreements. 104 | 105 | f. Exceptions and Limitations means fair use, fair dealing, and/or 106 | any other exception or limitation to Copyright and Similar Rights 107 | that applies to Your use of the Licensed Material. 108 | 109 | g. License Elements means the license attributes listed in the name 110 | of a Creative Commons Public License. The License Elements of this 111 | Public License are Attribution and ShareAlike. 112 | 113 | h. Licensed Material means the artistic or literary work, database, 114 | or other material to which the Licensor applied this Public 115 | License. 116 | 117 | i. Licensed Rights means the rights granted to You subject to the 118 | terms and conditions of this Public License, which are limited to 119 | all Copyright and Similar Rights that apply to Your use of the 120 | Licensed Material and that the Licensor has authority to license. 121 | 122 | j. Licensor means the individual(s) or entity(ies) granting rights 123 | under this Public License. 124 | 125 | k. Share means to provide material to the public by any means or 126 | process that requires permission under the Licensed Rights, such 127 | as reproduction, public display, public performance, distribution, 128 | dissemination, communication, or importation, and to make material 129 | available to the public including in ways that members of the 130 | public may access the material from a place and at a time 131 | individually chosen by them. 132 | 133 | l. Sui Generis Database Rights means rights other than copyright 134 | resulting from Directive 96/9/EC of the European Parliament and of 135 | the Council of 11 March 1996 on the legal protection of databases, 136 | as amended and/or succeeded, as well as other essentially 137 | equivalent rights anywhere in the world. 138 | 139 | m. You means the individual or entity exercising the Licensed Rights 140 | under this Public License. Your has a corresponding meaning. 141 | 142 | 143 | Section 2 -- Scope. 144 | 145 | a. License grant. 146 | 147 | 1. Subject to the terms and conditions of this Public License, 148 | the Licensor hereby grants You a worldwide, royalty-free, 149 | non-sublicensable, non-exclusive, irrevocable license to 150 | exercise the Licensed Rights in the Licensed Material to: 151 | 152 | a. reproduce and Share the Licensed Material, in whole or 153 | in part; and 154 | 155 | b. produce, reproduce, and Share Adapted Material. 156 | 157 | 2. Exceptions and Limitations. For the avoidance of doubt, where 158 | Exceptions and Limitations apply to Your use, this Public 159 | License does not apply, and You do not need to comply with 160 | its terms and conditions. 161 | 162 | 3. Term. The term of this Public License is specified in Section 163 | 6(a). 164 | 165 | 4. Media and formats; technical modifications allowed. The 166 | Licensor authorizes You to exercise the Licensed Rights in 167 | all media and formats whether now known or hereafter created, 168 | and to make technical modifications necessary to do so. The 169 | Licensor waives and/or agrees not to assert any right or 170 | authority to forbid You from making technical modifications 171 | necessary to exercise the Licensed Rights, including 172 | technical modifications necessary to circumvent Effective 173 | Technological Measures. For purposes of this Public License, 174 | simply making modifications authorized by this Section 2(a) 175 | (4) never produces Adapted Material. 176 | 177 | 5. Downstream recipients. 178 | 179 | a. Offer from the Licensor -- Licensed Material. Every 180 | recipient of the Licensed Material automatically 181 | receives an offer from the Licensor to exercise the 182 | Licensed Rights under the terms and conditions of this 183 | Public License. 184 | 185 | b. Additional offer from the Licensor -- Adapted Material. 186 | Every recipient of Adapted Material from You 187 | automatically receives an offer from the Licensor to 188 | exercise the Licensed Rights in the Adapted Material 189 | under the conditions of the Adapter's License You apply. 190 | 191 | c. No downstream restrictions. You may not offer or impose 192 | any additional or different terms or conditions on, or 193 | apply any Effective Technological Measures to, the 194 | Licensed Material if doing so restricts exercise of the 195 | Licensed Rights by any recipient of the Licensed 196 | Material. 197 | 198 | 6. No endorsement. Nothing in this Public License constitutes or 199 | may be construed as permission to assert or imply that You 200 | are, or that Your use of the Licensed Material is, connected 201 | with, or sponsored, endorsed, or granted official status by, 202 | the Licensor or others designated to receive attribution as 203 | provided in Section 3(a)(1)(A)(i). 204 | 205 | b. Other rights. 206 | 207 | 1. Moral rights, such as the right of integrity, are not 208 | licensed under this Public License, nor are publicity, 209 | privacy, and/or other similar personality rights; however, to 210 | the extent possible, the Licensor waives and/or agrees not to 211 | assert any such rights held by the Licensor to the limited 212 | extent necessary to allow You to exercise the Licensed 213 | Rights, but not otherwise. 214 | 215 | 2. Patent and trademark rights are not licensed under this 216 | Public License. 217 | 218 | 3. To the extent possible, the Licensor waives any right to 219 | collect royalties from You for the exercise of the Licensed 220 | Rights, whether directly or through a collecting society 221 | under any voluntary or waivable statutory or compulsory 222 | licensing scheme. In all other cases the Licensor expressly 223 | reserves any right to collect such royalties. 224 | 225 | 226 | Section 3 -- License Conditions. 227 | 228 | Your exercise of the Licensed Rights is expressly made subject to the 229 | following conditions. 230 | 231 | a. Attribution. 232 | 233 | 1. If You Share the Licensed Material (including in modified 234 | form), You must: 235 | 236 | a. retain the following if it is supplied by the Licensor 237 | with the Licensed Material: 238 | 239 | i. identification of the creator(s) of the Licensed 240 | Material and any others designated to receive 241 | attribution, in any reasonable manner requested by 242 | the Licensor (including by pseudonym if 243 | designated); 244 | 245 | ii. a copyright notice; 246 | 247 | iii. a notice that refers to this Public License; 248 | 249 | iv. a notice that refers to the disclaimer of 250 | warranties; 251 | 252 | v. a URI or hyperlink to the Licensed Material to the 253 | extent reasonably practicable; 254 | 255 | b. indicate if You modified the Licensed Material and 256 | retain an indication of any previous modifications; and 257 | 258 | c. indicate the Licensed Material is licensed under this 259 | Public License, and include the text of, or the URI or 260 | hyperlink to, this Public License. 261 | 262 | 2. You may satisfy the conditions in Section 3(a)(1) in any 263 | reasonable manner based on the medium, means, and context in 264 | which You Share the Licensed Material. For example, it may be 265 | reasonable to satisfy the conditions by providing a URI or 266 | hyperlink to a resource that includes the required 267 | information. 268 | 269 | 3. If requested by the Licensor, You must remove any of the 270 | information required by Section 3(a)(1)(A) to the extent 271 | reasonably practicable. 272 | 273 | b. ShareAlike. 274 | 275 | In addition to the conditions in Section 3(a), if You Share 276 | Adapted Material You produce, the following conditions also apply. 277 | 278 | 1. The Adapter's License You apply must be a Creative Commons 279 | license with the same License Elements, this version or 280 | later, or a BY-SA Compatible License. 281 | 282 | 2. You must include the text of, or the URI or hyperlink to, the 283 | Adapter's License You apply. You may satisfy this condition 284 | in any reasonable manner based on the medium, means, and 285 | context in which You Share Adapted Material. 286 | 287 | 3. You may not offer or impose any additional or different terms 288 | or conditions on, or apply any Effective Technological 289 | Measures to, Adapted Material that restrict exercise of the 290 | rights granted under the Adapter's License You apply. 291 | 292 | 293 | Section 4 -- Sui Generis Database Rights. 294 | 295 | Where the Licensed Rights include Sui Generis Database Rights that 296 | apply to Your use of the Licensed Material: 297 | 298 | a. for the avoidance of doubt, Section 2(a)(1) grants You the right 299 | to extract, reuse, reproduce, and Share all or a substantial 300 | portion of the contents of the database; 301 | 302 | b. if You include all or a substantial portion of the database 303 | contents in a database in which You have Sui Generis Database 304 | Rights, then the database in which You have Sui Generis Database 305 | Rights (but not its individual contents) is Adapted Material, 306 | 307 | including for purposes of Section 3(b); and 308 | c. You must comply with the conditions in Section 3(a) if You Share 309 | all or a substantial portion of the contents of the database. 310 | 311 | For the avoidance of doubt, this Section 4 supplements and does not 312 | replace Your obligations under this Public License where the Licensed 313 | Rights include other Copyright and Similar Rights. 314 | 315 | 316 | Section 5 -- Disclaimer of Warranties and Limitation of Liability. 317 | 318 | a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE 319 | EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS 320 | AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF 321 | ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, 322 | IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, 323 | WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR 324 | PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, 325 | ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT 326 | KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT 327 | ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. 328 | 329 | b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE 330 | TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, 331 | NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, 332 | INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, 333 | COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR 334 | USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN 335 | ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR 336 | DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR 337 | IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. 338 | 339 | c. The disclaimer of warranties and limitation of liability provided 340 | above shall be interpreted in a manner that, to the extent 341 | possible, most closely approximates an absolute disclaimer and 342 | waiver of all liability. 343 | 344 | 345 | Section 6 -- Term and Termination. 346 | 347 | a. This Public License applies for the term of the Copyright and 348 | Similar Rights licensed here. However, if You fail to comply with 349 | this Public License, then Your rights under this Public License 350 | terminate automatically. 351 | 352 | b. Where Your right to use the Licensed Material has terminated under 353 | Section 6(a), it reinstates: 354 | 355 | 1. automatically as of the date the violation is cured, provided 356 | it is cured within 30 days of Your discovery of the 357 | violation; or 358 | 359 | 2. upon express reinstatement by the Licensor. 360 | 361 | For the avoidance of doubt, this Section 6(b) does not affect any 362 | right the Licensor may have to seek remedies for Your violations 363 | of this Public License. 364 | 365 | c. For the avoidance of doubt, the Licensor may also offer the 366 | Licensed Material under separate terms or conditions or stop 367 | distributing the Licensed Material at any time; however, doing so 368 | will not terminate this Public License. 369 | 370 | d. Sections 1, 5, 6, 7, and 8 survive termination of this Public 371 | License. 372 | 373 | 374 | Section 7 -- Other Terms and Conditions. 375 | 376 | a. The Licensor shall not be bound by any additional or different 377 | terms or conditions communicated by You unless expressly agreed. 378 | 379 | b. Any arrangements, understandings, or agreements regarding the 380 | Licensed Material not stated herein are separate from and 381 | independent of the terms and conditions of this Public License. 382 | 383 | 384 | Section 8 -- Interpretation. 385 | 386 | a. For the avoidance of doubt, this Public License does not, and 387 | shall not be interpreted to, reduce, limit, restrict, or impose 388 | conditions on any use of the Licensed Material that could lawfully 389 | be made without permission under this Public License. 390 | 391 | b. To the extent possible, if any provision of this Public License is 392 | deemed unenforceable, it shall be automatically reformed to the 393 | minimum extent necessary to make it enforceable. If the provision 394 | cannot be reformed, it shall be severed from this Public License 395 | without affecting the enforceability of the remaining terms and 396 | conditions. 397 | 398 | c. No term or condition of this Public License will be waived and no 399 | failure to comply consented to unless expressly agreed to by the 400 | Licensor. 401 | 402 | d. Nothing in this Public License constitutes or may be interpreted 403 | as a limitation upon, or waiver of, any privileges and immunities 404 | that apply to the Licensor or You, including from the legal 405 | processes of any jurisdiction or authority. 406 | 407 | 408 | ======================================================================= 409 | 410 | Creative Commons is not a party to its public 411 | licenses. Notwithstanding, Creative Commons may elect to apply one of 412 | its public licenses to material it publishes and in those instances 413 | will be considered the “Licensor.” The text of the Creative Commons 414 | public licenses is dedicated to the public domain under the CC0 Public 415 | Domain Dedication. Except for the limited purpose of indicating that 416 | material is shared under a Creative Commons public license or as 417 | otherwise permitted by the Creative Commons policies published at 418 | creativecommons.org/policies, Creative Commons does not authorize the 419 | use of the trademark "Creative Commons" or any other trademark or logo 420 | of Creative Commons without its prior written consent including, 421 | without limitation, in connection with any unauthorized modifications 422 | to any of its public licenses or any other arrangements, 423 | understandings, or agreements concerning use of licensed material. For 424 | the avoidance of doubt, this paragraph does not form part of the 425 | public licenses. 426 | 427 | Creative Commons may be contacted at creativecommons.org. 428 | --------------------------------------------------------------------------------