view main/packages/common/chrobotics/um7_proto.h @ 245:44333100915a main

Initial checkin for the UM7 support code
author Bob Cook <bob@bobcookdev.com>
date Thu, 06 Aug 2015 21:47:44 -0700
parents
children
line wrap: on
line source

// ----------------------------------------------------------------------------------------
//
//  common/chrobotics/um7_proto.h
//    
//  Bob Cook Development, Robotics Library
//  http://www.bobcookdev.com/rl/
//
//  Structure definitions for the binary protocol of the CHRobotics UM7.
//
//  Copyright (c) 2015 Bob Cook
//  
//  Permission is hereby granted, free of charge, to any person obtaining a copy
//  of this software and associated documentation files (the "Software"), to deal
//  in the Software without restriction, including without limitation the rights
//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//  copies of the Software, and to permit persons to whom the Software is
//  furnished to do so, subject to the following conditions:
//  
//  The above copyright notice and this permission notice shall be included in
//  all copies or substantial portions of the Software.
//  
//  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
//  THE SOFTWARE.
//
// ----------------------------------------------------------------------------------------

#if !defined( BCDRL_COMMON_CHROBOTICS_UM7_PROTO_H )
#define BCDRL_COMMON_CHROBOTICS_UM7_PROTO_H

#include <stdint.h>

#if !defined( __AVR__ )
#pragma pack(push,1)
#endif

// ----------------------------------------------------------------------------------------

const uint8_t um7_addr_creg_com_rates1 = 0x01;
const uint8_t um7_addr_creg_com_rates2 = 0x02;
const uint8_t um7_addr_creg_com_rates3 = 0x03;
const uint8_t um7_addr_creg_com_rates4 = 0x04;
const uint8_t um7_addr_creg_com_rates5 = 0x05;
const uint8_t um7_addr_creg_com_rates6 = 0x06;
const uint8_t um7_addr_creg_com_rates7 = 0x07;

struct
{
    uint8_t raw_accel_rate;
    uint8_t raw_gyro_rate;
    uint8_t raw_mag_rate;
    uint8_t reserved;

} um7_creg_com_rates1;

struct
{
    uint8_t temp_rate;
    uint8_t reserved1;
    uint8_t reserved2;
    uint8_t all_raw_rate;

} um7_creg_com_rates2;

struct
{
    uint8_t proc_accel_rate;
    uint8_t proc_gyro_rate;
    uint8_t proc_mag_rate;
    uint8_t reserved;

} um7_creg_com_rates3;

struct
{
    uint8_t reserved1;
    uint8_t reserved2;
    uint8_t reserved3;
    uint8_t all_proc_rate;

} um7_creg_com_rates4;

struct
{
    uint8_t quat_rate;
    uint8_t euler_rate;
    uint8_t position_rate;
    uint8_t velocity_rate;

} um7_creg_com_rates5;

struct
{
    uint8_t  pose_rate;
    uint8_t  reserved1 : 4;
    uint8_t  health_rate : 4;
    uint16_t reserved2;

} um7_creg_com_rates6;

struct
{
    uint8_t health_rate : 4;
    uint8_t pose_rate : 4;
    uint8_t attitude_rate : 4;
    uint8_t sensor_rate : 4;
    uint8_t rates_rate : 4;
    uint8_t gps_pose_rate : 4;
    uint8_t quat_rate : 4;
    uint8_t reserved1 : 4;

} um7_creg_com_rates7;

// ----------------------------------------------------------------------------------------

const uint8_t um7_addr_dreg_health = 0x55;

struct 
{
    uint8_t  sats_used : 6;
    uint16_t hdop : 10;
    uint8_t  sats_in_view : 6;
    uint8_t  reserved1 : 1;
    uint8_t  ovf : 1;
    uint8_t  reserved2 : 1;
    uint8_t  mg_n : 1;
    uint8_t  acc_n : 1;
    uint8_t  accel : 1;
    uint8_t  gyro : 1;
    uint8_t  mag : 1;
    uint8_t  gps : 1;

} um7_dreg_health;

// ----------------------------------------------------------------------------------------

const uint8_t um7_addr_dreg_euler_phi_theta     = 0x70;
const uint8_t um7_addr_dreg_euler_psi           = 0x71;
const uint8_t um7_addr_dreg_euler_phi_theta_dot = 0x72;
const uint8_t um7_addr_dreg_euler_psi_dot       = 0x73;
const uint8_t um7_addr_dreg_euler_time          = 0x74;

struct
{
    uint16_t phi;
    uint16_t theta;

} um7_dreg_euler_phi_theta;

struct
{
    uint16_t psi;
    uint16_t reserved;

} um7_dreg_euler_psi;

struct
{
    uint16_t roll_rate;
    uint16_t pitch_rate;

} um7_dreg_euler_phi_theta_dot;

struct
{
    uint16_t yaw_rate;
    uint16_t reserved;

} um7_dreg_euler_psi_dot;

struct
{
    uint32_t euler_time;

} um7_dreg_euler_time;

// ----------------------------------------------------------------------------------------

#if !defined( __AVR__ )
#pragma pack(pop)
#endif

#endif  // #if defined( BCDRL_COMMON_CHROBOTICS_UM7_PROTO_H )
// ----------------------------------------------------------------------------------------