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.
structs.h
- Committer:
- benkatz
- Date:
- 2019-05-07
- Revision:
- 0:4dd2d995f7d0
File content as of revision 0:4dd2d995f7d0:
#ifndef STRUCTS_H
#define STRUCTS_H
#include <Eigen/Dense.h>
using namespace Eigen;
// Union for easily converting floats to bytes for serial //
union f_b
{
float f;
uint8_t bytes[4];
};
union u16_b
{
uint16_t i;
uint8_t bytes[2];
};
typedef struct
{
Vector2f q, qd, qdd, tau, g;
Matrix2f h, c;
} StateStruct;
typedef struct
{
int encoder_count[2];
float q_sensed[2], qd_sensed[2];
}SensorStruct;
typedef struct
{
float tau, p_setpoint, p_gain, v_setpoint, v_gain;
}ControlStruct;
typedef struct
{
// Inputs //
u16_b p_setpoint, p_gain, v_setpoint, v_gain;
// Outputs //
u16_b encoder_0, encoder_1;
f_b q0, q1, qd0, qd1, torque_command;
}CommunicationStruct;
#endif