Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed MODSERIAL FATFileSystem
IMU/IMU.h
- Committer:
- mkelly10
- Date:
- 2017-10-20
- Revision:
- 9:d5fcdcb3c89d
- Child:
- 10:085ab7328054
File content as of revision 9:d5fcdcb3c89d:
#include "mbed.h" #include "MODSERIAL.h" #define _PI ((float) 3.14159265359) class IMU{ public: IMU(); void initialize(); void update(); void start(); void stop(); protected: Ticker interval; MODSERIAL _rs232; unsigned char SYNC1; // First sync byte will always be 'u' (0x75) unsigned char SYNC2; // Second sync byte will always be 'e' (0x65) unsigned char descripter_set; // Descriptor set byte for AHRS (0x80) int payload_length; // Payload length byte for CF Euler Angles (0x0E) int field_length; // Field length byte for CF Euler Angles (0x0E) unsigned char data_descriptor; // Data descriptor byte for CF Euler Angles (0x0C) unsigned char data[30]; // Data sent CF euler angles rpy [radians] int data_offset; // Binary offset int roll_offset; // Binary offset int pitch_offset; // Binary offset int yaw_offset; // Binary offset float euler[3]; int i; // set packet_length based on field_length (convert from hex to int) unsigned char current; unsigned char last; float float_from_char(unsigned char * value); };