From cad27d03664c10d6e66e76f2de669f869a4b29e2 Mon Sep 17 00:00:00 2001 From: clayjay3 Date: Fri, 27 Dec 2024 19:15:06 +0000 Subject: [PATCH 1/5] Fix potential segfault for certain packets. --- src/RoveComm/RoveCommPacket.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/RoveComm/RoveCommPacket.cpp b/src/RoveComm/RoveCommPacket.cpp index 5052592..f0d65cc 100644 --- a/src/RoveComm/RoveCommPacket.cpp +++ b/src/RoveComm/RoveCommPacket.cpp @@ -70,9 +70,13 @@ namespace rovecomm // INT8_T, UINT8_T, CHAR if constexpr (sizeof(T) == sizeof(uint8_t)) { - // No need to convert to network order. - memcpy(pDataPtr, &pPacketData[unInter], sizeof(uint8_t)); - pDataPtr += sizeof(uint8_t); + // Check if unIter is within the bounds of the packet data. + if (unInter < stPacket.vData.size()) + { + // No need to convert to network order. + memcpy(pDataPtr, &pPacketData[unInter], sizeof(uint8_t)); + pDataPtr += sizeof(uint8_t); + } } // INT16_T, UINT16_T else if constexpr (sizeof(T) == sizeof(uint16_t)) From 83a20e9b57bd9fcb84cf6b78fbf746eef1091ecc Mon Sep 17 00:00:00 2001 From: clayjay3 Date: Sun, 5 Jan 2025 12:28:00 -0600 Subject: [PATCH 2/5] Update Autonomy waypoint packet structure in manifest. --- data/RoveComm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/RoveComm b/data/RoveComm index 6007211..276cdfc 160000 --- a/data/RoveComm +++ b/data/RoveComm @@ -1 +1 @@ -Subproject commit 6007211449726041f91149d786bee9b79073e2e1 +Subproject commit 276cdfca4478e28f8dc4bbc51c6ce02eab3bd4ce From df13685b27be261ba9ae5c06f283d97ce7b63f08 Mon Sep 17 00:00:00 2001 From: clayjay3 Date: Sun, 5 Jan 2025 12:29:01 -0600 Subject: [PATCH 3/5] Update manifest commit. --- data/RoveComm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/RoveComm b/data/RoveComm index 276cdfc..2e65440 160000 --- a/data/RoveComm +++ b/data/RoveComm @@ -1 +1 @@ -Subproject commit 276cdfca4478e28f8dc4bbc51c6ce02eab3bd4ce +Subproject commit 2e65440a62ec60fc68cb4e8cb8f92354d8ff4bdc From 00e795bf5903812e810af05160626a265836e832 Mon Sep 17 00:00:00 2001 From: clayjay3 Date: Mon, 6 Jan 2025 12:32:46 -0600 Subject: [PATCH 4/5] Update manifest. --- data/RoveComm | 2 +- src/RoveComm/RoveCommManifest.h | 97 +++++++++++++++++++++++++-------- 2 files changed, 76 insertions(+), 23 deletions(-) diff --git a/data/RoveComm b/data/RoveComm index 2e65440..a371bca 160000 --- a/data/RoveComm +++ b/data/RoveComm @@ -1 +1 @@ -Subproject commit 2e65440a62ec60fc68cb4e8cb8f92354d8ff4bdc +Subproject commit a371bca35ab82100915268093ff49d49fe3d6aed diff --git a/src/RoveComm/RoveCommManifest.h b/src/RoveComm/RoveCommManifest.h index a34bf5d..2d9eb7a 100644 --- a/src/RoveComm/RoveCommManifest.h +++ b/src/RoveComm/RoveCommManifest.h @@ -7,9 +7,9 @@ * * @file RoveCommManifest.h * @author Missouri S&T - Mars Rover Design Team - * @date 2024-05-27 + * @date 2025-01-06 * - * @copyright Copyright Mars Rover Design Team 2024 - All Rights Reserved + * @copyright Copyright Mars Rover Design Team 2025 - All Rights Reserved ******************************************************************************/ #ifndef MANIFEST_H @@ -25,7 +25,7 @@ namespace manifest * @brief Enumeration of Data Types to be used in RoveComm * * @author Missouri S&T - Mars Rover Design Team - * @date 2024-05-27 + * @date 2025-01-06 ******************************************************************************/ enum DataTypes { @@ -44,7 +44,7 @@ namespace manifest * @brief IP Address Object for RoveComm. * * @author Missouri S&T - Mars Rover Design Team - * @date 2024-05-27 + * @date 2025-01-06 ******************************************************************************/ struct AddressEntry { @@ -60,7 +60,7 @@ namespace manifest * @brief Manifest Entry Object for RoveComm. * * @author Missouri S&T - Mars Rover Design Team - * @date 2024-05-27 + * @date 2025-01-06 ******************************************************************************/ struct ManifestEntry { @@ -74,7 +74,7 @@ namespace manifest * @brief Core Board IP Address, Commands, Telemetry, and Error Packet * * @author Missouri S&T - Mars Rover Design Team - * @date 2024-05-27 + * @date 2025-01-06 ******************************************************************************/ namespace Core { @@ -134,7 +134,7 @@ namespace manifest * @brief PMS Board IP Address, Commands, Telemetry, and Error Packet * * @author Missouri S&T - Mars Rover Design Team - * @date 2024-05-27 + * @date 2025-01-06 ******************************************************************************/ namespace PMS { @@ -174,7 +174,7 @@ namespace manifest * @brief Nav Board IP Address, Commands, Telemetry, and Error Packet * * @author Missouri S&T - Mars Rover Design Team - * @date 2024-05-27 + * @date 2025-01-06 ******************************************************************************/ namespace Nav { @@ -203,7 +203,7 @@ namespace manifest * @brief BaseStationNav Board IP Address, Commands, Telemetry, and Error * * @author Missouri S&T - Mars Rover Design Team - * @date 2024-05-27 + * @date 2025-01-06 ******************************************************************************/ namespace BaseStationNav { @@ -222,7 +222,7 @@ namespace manifest * @brief SignalStack Board IP Address, Commands, Telemetry, and Error Packet * * @author Missouri S&T - Mars Rover Design Team - * @date 2024-05-27 + * @date 2025-01-06 ******************************************************************************/ namespace SignalStack { @@ -252,7 +252,7 @@ namespace manifest * @brief Arm Board IP Address, Commands, Telemetry, and Error Packet * * @author Missouri S&T - Mars Rover Design Team - * @date 2024-05-27 + * @date 2025-01-06 ******************************************************************************/ namespace Arm { @@ -294,7 +294,7 @@ namespace manifest * @brief ScienceActuation Board IP Address, Commands, Telemetry, and Error * * @author Missouri S&T - Mars Rover Design Team - * @date 2024-05-27 + * @date 2025-01-06 ******************************************************************************/ namespace ScienceActuation { @@ -337,7 +337,7 @@ namespace manifest * @brief Autonomy Board IP Address, Commands, Telemetry, and Error Packet * * @author Missouri S&T - Mars Rover Design Team - * @date 2024-05-27 + * @date 2025-01-06 ******************************************************************************/ namespace Autonomy { @@ -349,8 +349,9 @@ namespace manifest {"STARTAUTONOMY", ManifestEntry{11000, 1, DataTypes::UINT8_T}}, {"DISABLEAUTONOMY", ManifestEntry{11001, 1, DataTypes::UINT8_T}}, {"ADDPOSITIONLEG", ManifestEntry{11002, 2, DataTypes::DOUBLE_T}}, - {"ADDMARKERLEG", ManifestEntry{11003, 2, DataTypes::DOUBLE_T}}, - {"ADDOBJECTLEG", ManifestEntry{11004, 2, DataTypes::DOUBLE_T}}, + {"ADDMARKERLEG", ManifestEntry{11003, 4, DataTypes::DOUBLE_T}}, + {"ADDOBJECTLEG", ManifestEntry{11004, 3, DataTypes::DOUBLE_T}}, + {"ADDOBSTACLE", ManifestEntry{11008, 3, DataTypes::DOUBLE_T}}, {"CLEARWAYPOINTS", ManifestEntry{11005, 1, DataTypes::UINT8_T}}, {"SETMAXSPEED", ManifestEntry{11006, 1, DataTypes::FLOAT_T}}, {"SETLOGGINGLEVELS", ManifestEntry{11007, 3, DataTypes::UINT8_T}}, @@ -389,6 +390,7 @@ namespace manifest TRACEL1, DEBUG, INFO, + NOTICE, WARNING, ERROR, CRITICAL @@ -400,7 +402,7 @@ namespace manifest * @brief Camera1 Board IP Address, Commands, Telemetry, and Error Packet * * @author Missouri S&T - Mars Rover Design Team - * @date 2024-05-27 + * @date 2025-01-06 ******************************************************************************/ namespace Camera1 { @@ -431,7 +433,7 @@ namespace manifest * @brief Camera2 Board IP Address, Commands, Telemetry, and Error Packet * * @author Missouri S&T - Mars Rover Design Team - * @date 2024-05-27 + * @date 2025-01-06 ******************************************************************************/ namespace Camera2 { @@ -453,11 +455,48 @@ namespace manifest const std::map ERROR = {}; } // namespace Camera2 + /****************************************************************************** + * @brief CameraServer Board IP Address, Commands, Telemetry, and Error + * + * @author Missouri S&T - Mars Rover Design Team + * @date 2025-01-06 + ******************************************************************************/ + namespace CameraServer + { + // IP Address + const AddressEntry IP_ADDRESS{192, 168, 4, 102}; + + // Commands + const std::map COMMANDS = { + {"TAKEPHOTO", ManifestEntry{14000, 1, DataTypes::UINT8_T}}, + {"TOGGLESTREAM", ManifestEntry{14001, 2, DataTypes::UINT8_T}}, + {"ADJUSTBRIGHTNESS", ManifestEntry{14002, 2, DataTypes::UINT8_T}}, + {"ADJUSTCONTRAST", ManifestEntry{14003, 2, DataTypes::UINT8_T}}, + {"ADJUSTSATURATION", ManifestEntry{14004, 2, DataTypes::UINT8_T}}, + {"ADJUSTHUE", ManifestEntry{14005, 2, DataTypes::UINT8_T}}, + {"SETWHITEBALANCE", ManifestEntry{14008, 2, DataTypes::UINT8_T}}, + {"ADJUSTBACKLIGHTCONTRAST", ManifestEntry{14009, 2, DataTypes::UINT8_T}}, + {"SETEXPOSURE", ManifestEntry{14010, 2, DataTypes::INT32_T}}, + }; + + // Telemetry + const std::map TELEMETRY = { + {"AVAILABLECAMERAS", ManifestEntry{14100, 1, DataTypes::UINT8_T}}, + {"STREAMINGCAMERAS", ManifestEntry{14101, 4, DataTypes::UINT8_T}}, + {"PICTURETAKEN1", ManifestEntry{14102, 1, DataTypes::UINT8_T}}, + }; + + // Error + const std::map ERROR = { + {"CAMERAUNAVAILABLE", ManifestEntry{14200, 1, DataTypes::UINT8_T}}, + }; + } // namespace CameraServer + /****************************************************************************** * @brief IRSpectrometer Board IP Address, Commands, Telemetry, and Error * * @author Missouri S&T - Mars Rover Design Team - * @date 2024-05-27 + * @date 2025-01-06 ******************************************************************************/ namespace IRSpectrometer { @@ -476,7 +515,7 @@ namespace manifest * @brief Instruments Board IP Address, Commands, Telemetry, and Error Packet * * @author Missouri S&T - Mars Rover Design Team - * @date 2024-05-27 + * @date 2025-01-06 ******************************************************************************/ namespace Instruments { @@ -510,7 +549,7 @@ namespace manifest * @brief RoveComm General Information * * @author Missouri S&T - Mars Rover Design Team - * @date 2024-05-27 + * @date 2025-01-06 ******************************************************************************/ namespace General { @@ -525,7 +564,7 @@ namespace manifest * @brief RoveComm System Information * * @author Missouri S&T - Mars Rover Design Team - * @date 2024-05-27 + * @date 2025-01-06 ******************************************************************************/ namespace System { @@ -541,7 +580,7 @@ namespace manifest * @brief RoveComm Helper Functions * * @author Missouri S&T - Mars Rover Design Team - * @date 2024-05-27 + * @date 2025-01-06 ******************************************************************************/ namespace Helpers { @@ -691,6 +730,20 @@ namespace manifest return GetDataTypeFromMap(Camera2::ERROR, dataId); } break; + case 14: // CameraServer Board + if (dataTypeCode == 0) + { + return GetDataTypeFromMap(CameraServer::COMMANDS, dataId); + } + else if (dataTypeCode == 1) + { + return GetDataTypeFromMap(CameraServer::TELEMETRY, dataId); + } + else if (dataTypeCode == 2) + { + return GetDataTypeFromMap(CameraServer::ERROR, dataId); + } + break; case 16: // Instruments Board if (dataTypeCode == 0) { From a089d53e0b47be0c7b6156d944d0a1d2790fc447 Mon Sep 17 00:00:00 2001 From: clayjay3 Date: Mon, 6 Jan 2025 12:35:03 -0600 Subject: [PATCH 5/5] Update submodule commit. --- data/RoveComm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/RoveComm b/data/RoveComm index a371bca..cc53e1e 160000 --- a/data/RoveComm +++ b/data/RoveComm @@ -1 +1 @@ -Subproject commit a371bca35ab82100915268093ff49d49fe3d6aed +Subproject commit cc53e1eddc95069d3330793ee9779e5832ea7623