Example #1
0
def get_imu_rph_data(index, imu_data):
    roll, pitch, heading = gyro.gyro_to_angles(
        float(imu_data[index]['orientation_x']),
        float(imu_data[index]['orientation_y']),
        float(imu_data[index]['orientation_z']),
        float(imu_data[index]['orientation_w']))
    return roll, pitch, heading
Example #2
0
        # for now diplay GPS/IMU data on image if we have it

        if (len(gps_data) >= index):
            text = "GPS: lat.=%2f long.=%2f alt.=%2f"\
                %(float(gps_data[index]['latitude']),
                float(gps_data[index]['longitude']),
                float(gps_data[index]['altitude']))
            cv2.putText(img, text, (20, 40), cv2.FONT_HERSHEY_PLAIN, 1,
                        (0, 0, 255), 1, 12)

        if (len(imu_data) >= index):

            roll, pitch, heading = gyro.gyro_to_angles(
                float(imu_data[index]['orientation_x']),
                float(imu_data[index]['orientation_y']),
                float(imu_data[index]['orientation_z']),
                float(imu_data[index]['orientation_w']))

            text = "IMU: roll/pitch/heading. (%2f, %2f, %2f) "\
                %(roll, pitch, heading)
            cv2.putText(img, text, (20, 60), cv2.FONT_HERSHEY_PLAIN, 1,
                        (0, 0, 255), 1, 12)

            text = "IMU: angular velocity (%2f, %2f, %2f)"\
                %(float(imu_data[index]['angular_velocity_x']),
                float(imu_data[index]['angular_velocity_y']),
                float(imu_data[index]['angular_velocity_z']))
            cv2.putText(img, text, (20, 80), cv2.FONT_HERSHEY_PLAIN, 1,
                        (0, 0, 255), 1, 12)