diff --git a/ale b/ale index 37bb560ac6a5327063f6c36d8259b3dbb6880bab..7bd25687480f8e6b60319026ef0982ae41ef027e 160000 --- a/ale +++ b/ale @@ -1 +1 @@ -Subproject commit 37bb560ac6a5327063f6c36d8259b3dbb6880bab +Subproject commit 7bd25687480f8e6b60319026ef0982ae41ef027e diff --git a/src/UsgsAstroFrameSensorModel.cpp b/src/UsgsAstroFrameSensorModel.cpp index e5bb483ea4c47c1cb1a19a65a3db9c2ca73259a0..d7942b51de432c517f4268da9e85a3a04058649e 100644 --- a/src/UsgsAstroFrameSensorModel.cpp +++ b/src/UsgsAstroFrameSensorModel.cpp @@ -964,6 +964,30 @@ std::string UsgsAstroFrameSensorModel::constructStateFromIsd( // get sensor_orientation quaternion ale::Orientations j2000_to_sensor = ale::getInstrumentPointing(parsedIsd); + + // Work-around for issues in ALE <=0.8.5 where Orientations without angular + // velocities seg fault when you multiply them. This will make the angular + // velocities in the final Orientations dubious but they are not used + // in any calculations so this is okay. + if (j2000_to_sensor.getAngularVelocities().empty()) { + j2000_to_sensor = ale::Orientations( + j2000_to_sensor.getRotations(), + j2000_to_sensor.getTimes(), + std::vector<ale::Vec3d>(j2000_to_sensor.getTimes().size()), + j2000_to_sensor.getConstantRotation(), + j2000_to_sensor.getConstantFrames(), + j2000_to_sensor.getTimeDependentFrames()); + } + if (j2000_to_target.getAngularVelocities().empty()) { + j2000_to_target = ale::Orientations( + j2000_to_target.getRotations(), + j2000_to_target.getTimes(), + std::vector<ale::Vec3d>(j2000_to_target.getTimes().size()), + j2000_to_target.getConstantRotation(), + j2000_to_target.getConstantFrames(), + j2000_to_target.getTimeDependentFrames()); + } + ale::Orientations sensor_to_j2000 = j2000_to_sensor.inverse(); ale::Orientations sensor_to_target = j2000_to_target * sensor_to_j2000; ephemTime = sensor_to_target.getTimes(); diff --git a/src/UsgsAstroLsSensorModel.cpp b/src/UsgsAstroLsSensorModel.cpp index 6362a214a5b1abf5c37b74b976bff37ae787a372..1b45dcb82c944ec88f2df7a2c2f2569640c4f7dd 100644 --- a/src/UsgsAstroLsSensorModel.cpp +++ b/src/UsgsAstroLsSensorModel.cpp @@ -2413,6 +2413,29 @@ std::string UsgsAstroLsSensorModel::constructStateFromIsd( state["m_velocities"] = velocities; MESSAGE_LOG("m_velocities: {}", state["m_velocities"].dump()) + // Work-around for issues in ALE <=0.8.5 where Orientations without angular + // velocities seg fault when you multiply them. This will make the angular + // velocities in the final Orientations dubious but they are not used + // in any calculations so this is okay. + if (j2000_to_sensor.getAngularVelocities().empty()) { + j2000_to_sensor = ale::Orientations( + j2000_to_sensor.getRotations(), + j2000_to_sensor.getTimes(), + std::vector<ale::Vec3d>(j2000_to_sensor.getTimes().size()), + j2000_to_sensor.getConstantRotation(), + j2000_to_sensor.getConstantFrames(), + j2000_to_sensor.getTimeDependentFrames()); + } + if (j2000_to_target.getAngularVelocities().empty()) { + j2000_to_target = ale::Orientations( + j2000_to_target.getRotations(), + j2000_to_target.getTimes(), + std::vector<ale::Vec3d>(j2000_to_target.getTimes().size()), + j2000_to_target.getConstantRotation(), + j2000_to_target.getConstantFrames(), + j2000_to_target.getTimeDependentFrames()); + } + ale::Orientations sensor_to_j2000 = j2000_to_sensor.inverse(); ale::Orientations sensor_to_target = j2000_to_target * sensor_to_j2000; ephemTime = sensor_to_target.getTimes();