Skip to content

Commit

Permalink
Telem fixes (#48)
Browse files Browse the repository at this point in the history
* Make gps positions a little more accurate

* removed comments

* added newline

---------

Co-authored-by: Zyun Lam <[email protected]>
Co-authored-by: Aidan Costello <[email protected]>
  • Loading branch information
3 people authored Apr 26, 2024
1 parent 5909915 commit 9c11fda
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion MIDAS/src/hardware/Barometer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ Barometer BarometerSensor::read() {
float pressure = static_cast<float>(MS.getPressure() * 0.01 + 26.03);
float temperature = static_cast<float>(MS.getTemperature() * 0.01);
float altitude = static_cast<float>(-log(pressure * 0.000987) * (temperature + 273.15) * 29.254);

return Barometer(temperature, pressure, altitude);
}
1 change: 1 addition & 0 deletions MIDAS/src/hardware/GPSSensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ ErrorCode GPSSensor::init() {
return ErrorCode::NoError;
}

// GPS Coordinates are ddmm.mmmm, so please convert with some code
GPS GPSSensor::read() {
teseo.update();
GPGGA_Info_t gpgga_message = teseo.getGPGGAData();
Expand Down
5 changes: 3 additions & 2 deletions MIDAS/src/telemetry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ TelemetryPacket Telemetry::makePacket(RocketData& data) {

packet.lat = gps.latitude;
packet.lon = gps.longitude;
packet.alt = uint16_t(gps.altitude);
packet.baro_alt = uint16_t(barometer.altitude);
packet.alt = (int16_t) gps.altitude;
// Convert range of value so that we can also account for negative altitudes
packet.baro_alt = inv_convert_range<int16_t>(barometer.altitude, 1 << 17);
auto [ax,ay,az] = pack_highg_tilt(highg, 33);
packet.highg_ax = ax;
packet.highg_ay = ay;
Expand Down

0 comments on commit 9c11fda

Please sign in to comment.