Skip to content

Commit 566073b

Browse files
Merge pull request #204 from ISSUIUC/luna-prelaunch-cleanup
MIDAS Mini LUNA Cleanup. w cleanup
2 parents 0c97556 + b78e6e2 commit 566073b

File tree

13 files changed

+37
-69
lines changed

13 files changed

+37
-69
lines changed

MIDAS/lib/TCAL9538/TCAL9538.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@ bool TCAL9538Init(int reset_pin){
3232
TwoWire& wire = tcal_get_wire_by_id(i);
3333
uint8_t addr = addrs[i];
3434

35-
// remove this when done
36-
Serial.print("Testing ");
37-
Serial.println(addr);
38-
3935
wire.beginTransmission(addr);
4036
wire.write(REG_OUTPUT);
4137
if(wire.endTransmission() != 0){

MIDAS/src/data_logging.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ ASSOCIATE(FSMState, ID_FSM)
2424
ASSOCIATE(PyroState, ID_PYRO)
2525
ASSOCIATE(CameraData, ID_CAMERADATA)
2626
ASSOCIATE(AngularKalmanData, ID_ANGULARKALMAN)
27-
ASSOCIATE(IMU_SFLP, ID_SFLPHW)
27+
ASSOCIATE(IMU_SFLP, ID_SFLP)
2828

2929

3030
/**
@@ -83,15 +83,11 @@ void log_data(LogSink& sink, RocketData& data) {
8383
log_from_sensor_data(sink, data.voltage);
8484
log_from_sensor_data(sink, data.gps);
8585
log_from_sensor_data(sink, data.magnetometer);
86-
//log_from_sensor_data(sink, data.orientation);
8786
log_from_sensor_data(sink, data.fsm_state);
8887
log_from_sensor_data(sink, data.kalman);
8988
log_from_sensor_data(sink, data.angular_kalman_data);
9089
log_from_sensor_data(sink, data.pyro);
91-
92-
//log_from_sensor_data(sink, data.quaternions);
9390
log_from_sensor_data(sink, data.cam_data);
94-
9591
}
9692

9793
#ifndef SILSIM

MIDAS/src/hardware/Barometer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Barometer BarometerSensor::read() {
2828
*/
2929
uint32_t pressure = MS.getPressure(); // Pascals
3030
float temperature = MS.getTemperature(); // Celcius
31-
float altitude = MS.getAltitude();
31+
float altitude = MS.getAltitudeExtendedModel();
3232

3333
return Barometer(temperature, pressure, altitude);
3434
}

MIDAS/src/hardware/IMU.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ IMU IMUSensor::read(){
3636

3737
//Angular rate
3838
if(status.gda){
39-
//Serial.println("oh we are angular");
4039
LSM6DSV.get_angular_velocity_from_fs2000_to_dps(&reading.angular_velocity.vx,
4140
&reading.angular_velocity.vy,
4241
&reading.angular_velocity.vz);

MIDAS/src/hardware/Pyro.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ bool error_is_failure(GpioError error_code) {
2626
*/
2727
bool can_fire_igniter(AngularKalmanData angular_kalman_data) {
2828
// With new GNC orientation code we can add a simple check.
29-
return angular_kalman_data.comp_tilt < MAXIMUM_TILT_ANGLE; // comp_tilt or mq_tilt?
29+
return angular_kalman_data.mq_tilt < MAXIMUM_TILT_ANGLE;
3030
}
3131

3232

MIDAS/src/hardware/pins.h

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#pragma once
22

33
// SPI sensor bus
4-
#define SPI_MISO 3//
5-
#define SPI_MOSI 2//
6-
#define SPI_SCK 1//
4+
#define SPI_MISO 3
5+
#define SPI_MOSI 2
6+
#define SPI_SCK 1
77

88
// barometer chip select
99
#define MS5611_CS 44
@@ -17,21 +17,21 @@
1717
#define IMU_IRQ_PIN 15
1818

1919
// i2c bus pins
20-
#define I2C_SDA 21//
21-
#define I2C_SCL 26//
20+
#define I2C_SDA 21
21+
#define I2C_SCL 26
2222

2323
// Buzzer pins
2424
#define BUZZER_PIN 12
2525
#define BUZZER_CHANNEL 1
2626

2727
// GPIO Expander pins
2828
#define EXP_RESET 13
29-
#define EXP_INT 48//
29+
#define EXP_INT 48
3030

3131
// GPS pins
32-
#define SAM_RESET 5//
32+
#define SAM_RESET 5
3333

34-
// pyro pins //hmmm
34+
// pyro pins
3535
#define PYRO_GLOBAL_ARM_PIN GpioAddress(0, 3)
3636
#define PYROA_FIRE_PIN GpioAddress(0, 0)
3737
#define PYROB_FIRE_PIN GpioAddress(0, 1)
@@ -46,30 +46,29 @@
4646
#define SENSE_D 5
4747

4848
// Voltage pins (on the ADC)
49-
#define PYRO_SENSE 2 //hmmm
49+
#define PYRO_SENSE 2
5050
#define VCAP_SENSE 6
5151
#define VBAT_SENSE 7
5252

5353
// E22 (radio)
54-
#define E22_CS 37//
55-
#define E22_DI01 41//
56-
#define E22_DI03 40//
57-
#define E22_BUSY 38//
58-
#define E22_RXEN 39//
59-
#define E22_RESET 6//
60-
61-
// LEDs hmmmm
54+
#define E22_CS 37
55+
#define E22_DI01 41
56+
#define E22_DI03 40
57+
#define E22_BUSY 38
58+
#define E22_RXEN 39
59+
#define E22_RESET 6
60+
61+
// LEDs
6262
#define LED_BLUE 8
6363
#define LED_GREEN 9
6464
#define LED_ORANGE 10
6565
#define LED_RED 11
6666

6767
// FLASH memory pins
68-
69-
#define FLASH_CMD 47//
68+
#define FLASH_CMD 47
7069
#define FLASH_CLK 16
71-
#define FLASH_DAT0 33//
72-
#define FLASH_DAT1 34//
70+
#define FLASH_DAT0 33
71+
#define FLASH_DAT1 34
7372
#define FLASH_DAT2 18
7473
#define FLASH_DAT3 17
7574

MIDAS/src/log_format.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ enum ReadingDiscriminant {
1818
ID_PYRO = 10,
1919
ID_CAMERADATA = 11,
2020
ID_ANGULARKALMAN = 12,
21-
ID_SFLPHW = 13,
21+
ID_SFLP = 13,
2222
};
2323

2424

@@ -39,12 +39,11 @@ struct LoggedReading {
3939
uint32_t timestamp_ms;
4040
union {
4141
IMU imu;
42-
IMU_SFLP hw_filt;
42+
IMU_SFLP sflp;
4343
Barometer barometer;
4444
Voltage voltage;
4545
GPS gps;
4646
Magnetometer magnetometer;
47-
//Orientation orientation;
4847
KalmanData kalman;
4948
AngularKalmanData angular_kalman;
5049
FSMState fsm;

MIDAS/src/rocket_state.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,7 @@ struct CommandFlags {
184184
*/
185185
struct RocketData {
186186
public:
187-
//SensorData<LSM> lsm;
188-
187+
189188
SensorData<KalmanData> kalman;
190189
SensorData<AngularKalmanData> angular_kalman_data;
191190
BufferedSensorData<IMU, 16> imu;

MIDAS/src/sensor_data.h

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -142,18 +142,9 @@ enum class OrientationReadingType {
142142
/**
143143
* @struct SFLP
144144
*
145-
* @brief Data from the Sensor Fusion Low Power module
145+
* @brief Data from the LSM6DSV320X Sensor Fusion Low Power module
146146
*
147147
*/
148-
149-
/**
150-
*
151-
* @brief Implementing obtaining SFLP data from FIFO
152-
*
153-
*
154-
*/
155-
156-
// Raw IMU data from the LS6DSV320X this is hw filtered
157148
struct IMU_SFLP {
158149
Quaternion quaternion;
159150
Acceleration gravity;
@@ -273,10 +264,8 @@ struct KalmanData {
273264
struct AngularKalmanData {
274265
Quaternion quaternion;
275266
float gyrobias[3];
276-
double comp_tilt = 0.0;
277267
double mq_tilt = 0.0;
278268
bool has_data = false;
279-
OrientationReadingType reading_type = OrientationReadingType::FULL_READING;
280269

281270
float yaw = 0;
282271
float pitch = 0;

MIDAS/src/systems.cpp

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,7 @@ DECLARE_THREAD(barometer, RocketSystems *arg)
6161
arg->rocket_data.barometer.update(reading);
6262
prev_reading = reading; // Only update prev_reading with accepted readings
6363
}
64-
// Serial.print("Barometer ");
65-
// Serial.print(reading.altitude);
66-
// Serial.print(" ");
67-
// Serial.print(reading.pressure);
68-
// Serial.print(" ");
69-
// Serial.println(reading.temperature);
64+
7065
THREAD_SLEEP(6);
7166
}
7267
}
@@ -263,7 +258,7 @@ DECLARE_THREAD(buzzer, RocketSystems *arg)
263258
DECLARE_THREAD(angularkalman, RocketSystems *arg)
264259
{ //
265260
mqekf.initialize(arg);
266-
// Serial.println("Initialized ekf :(");
261+
// Serial.println("Initialized mqekf :(");
267262
TickType_t last = xTaskGetTickCount();
268263

269264
while (true)
@@ -301,7 +296,7 @@ DECLARE_THREAD(angularkalman, RocketSystems *arg)
301296
arg->rocket_data.angular_kalman_data.update(current_state);
302297

303298
last = xTaskGetTickCount();
304-
// Serial.println("Angular Kalman");
299+
305300
THREAD_SLEEP(50);
306301
}
307302
}
@@ -347,12 +342,8 @@ DECLARE_THREAD(kalman, RocketSystems *arg)
347342

348343
arg->rocket_data.kalman.update(current_state);
349344

350-
// Serial.print("MQ tilt: ");
351-
// Serial.println(current_angular_kalman.mq_tilt);
352-
// Serial.println();
353-
354345
last = xTaskGetTickCount();
355-
// Serial.println("Kalman");
346+
356347
THREAD_SLEEP(50);
357348
}
358349
}

0 commit comments

Comments
 (0)