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.
Diff: structs.h
- Revision:
- 0:4dd2d995f7d0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/structs.h Tue May 07 01:56:53 2019 +0000
@@ -0,0 +1,47 @@
+#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