Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix parser so that it doesn't miss boards without any commands. #20

Merged
merged 2 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 34 additions & 20 deletions src/RoveComm/RoveCommManifest.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* @file RoveCommManifest.h
* @author Missouri S&T - Mars Rover Design Team
* @date 2024-03-05
* @date 2024-03-14
*
* @copyright Copyright Mars Rover Design Team 2024 - All Rights Reserved
******************************************************************************/
Expand All @@ -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-03-05
* @date 2024-03-14
******************************************************************************/
enum DataTypes
{
Expand All @@ -44,7 +44,7 @@ namespace manifest
* @brief IP Address Object for RoveComm.
*
* @author Missouri S&T - Mars Rover Design Team
* @date 2024-03-05
* @date 2024-03-14
******************************************************************************/
struct AddressEntry
{
Expand All @@ -60,7 +60,7 @@ namespace manifest
* @brief Manifest Entry Object for RoveComm.
*
* @author Missouri S&T - Mars Rover Design Team
* @date 2024-03-05
* @date 2024-03-14
******************************************************************************/
struct ManifestEntry
{
Expand All @@ -74,7 +74,7 @@ namespace manifest
* @brief BMS Board IP Address, Commands, Telemetry, and Error Packet
*
* @author Missouri S&T - Mars Rover Design Team
* @date 2024-03-05
* @date 2024-03-14
******************************************************************************/
namespace BMS
{
Expand Down Expand Up @@ -109,7 +109,7 @@ namespace manifest
* @brief Power Board IP Address, Commands, Telemetry, and Error Packet
*
* @author Missouri S&T - Mars Rover Design Team
* @date 2024-03-05
* @date 2024-03-14
******************************************************************************/
namespace Power
{
Expand Down Expand Up @@ -139,7 +139,7 @@ namespace manifest
* @brief Core Board IP Address, Commands, Telemetry, and Error Packet
*
* @author Missouri S&T - Mars Rover Design Team
* @date 2024-03-05
* @date 2024-03-14
******************************************************************************/
namespace Core
{
Expand Down Expand Up @@ -196,7 +196,7 @@ namespace manifest
* @brief Nav Board IP Address, Commands, Telemetry, and Error Packet
*
* @author Missouri S&T - Mars Rover Design Team
* @date 2024-03-05
* @date 2024-03-14
******************************************************************************/
namespace Nav
{
Expand Down Expand Up @@ -225,7 +225,7 @@ namespace manifest
* @brief SignalStack Board IP Address, Commands, Telemetry, and Error Packet
*
* @author Missouri S&T - Mars Rover Design Team
* @date 2024-03-05
* @date 2024-03-14
******************************************************************************/
namespace SignalStack
{
Expand Down Expand Up @@ -255,7 +255,7 @@ namespace manifest
* @brief Arm Board IP Address, Commands, Telemetry, and Error Packet
*
* @author Missouri S&T - Mars Rover Design Team
* @date 2024-03-05
* @date 2024-03-14
******************************************************************************/
namespace Arm
{
Expand Down Expand Up @@ -297,7 +297,7 @@ namespace manifest
* @brief ScienceActuation Board IP Address, Commands, Telemetry, and Error
*
* @author Missouri S&T - Mars Rover Design Team
* @date 2024-03-05
* @date 2024-03-14
******************************************************************************/
namespace ScienceActuation
{
Expand Down Expand Up @@ -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-03-05
* @date 2024-03-14
******************************************************************************/
namespace Autonomy
{
Expand Down Expand Up @@ -384,7 +384,7 @@ namespace manifest
* @brief Camera1 Board IP Address, Commands, Telemetry, and Error Packet
*
* @author Missouri S&T - Mars Rover Design Team
* @date 2024-03-05
* @date 2024-03-14
******************************************************************************/
namespace Camera1
{
Expand Down Expand Up @@ -412,7 +412,7 @@ namespace manifest
* @brief Camera2 Board IP Address, Commands, Telemetry, and Error Packet
*
* @author Missouri S&T - Mars Rover Design Team
* @date 2024-03-05
* @date 2024-03-14
******************************************************************************/
namespace Camera2
{
Expand All @@ -431,7 +431,7 @@ namespace manifest
* @brief RamanSpectrometer Board IP Address, Commands, Telemetry, and Error
*
* @author Missouri S&T - Mars Rover Design Team
* @date 2024-03-05
* @date 2024-03-14
******************************************************************************/
namespace RamanSpectrometer
{
Expand Down Expand Up @@ -461,7 +461,7 @@ namespace manifest
* @brief Fluorometer Board IP Address, Commands, Telemetry, and Error Packet
*
* @author Missouri S&T - Mars Rover Design Team
* @date 2024-03-05
* @date 2024-03-14
******************************************************************************/
namespace Fluorometer
{
Expand All @@ -487,7 +487,7 @@ namespace manifest
* @brief IRSpectrometer Board IP Address, Commands, Telemetry, and Error
*
* @author Missouri S&T - Mars Rover Design Team
* @date 2024-03-05
* @date 2024-03-14
******************************************************************************/
namespace IRSpectrometer
{
Expand All @@ -506,7 +506,7 @@ namespace manifest
* @brief RoveComm General Information
*
* @author Missouri S&T - Mars Rover Design Team
* @date 2024-03-05
* @date 2024-03-14
******************************************************************************/
namespace General
{
Expand All @@ -521,7 +521,7 @@ namespace manifest
* @brief RoveComm System Information
*
* @author Missouri S&T - Mars Rover Design Team
* @date 2024-03-05
* @date 2024-03-14
******************************************************************************/
namespace System
{
Expand All @@ -537,7 +537,7 @@ namespace manifest
* @brief RoveComm Helper Functions
*
* @author Missouri S&T - Mars Rover Design Team
* @date 2024-03-05
* @date 2024-03-14
******************************************************************************/
namespace Helpers
{
Expand Down Expand Up @@ -603,6 +603,20 @@ namespace manifest
return GetDataTypeFromMap(Core::ERROR, dataId);
}
break;
case 6: // Nav Board
if (dataTypeCode == 0)
{
return GetDataTypeFromMap(Nav::COMMANDS, dataId);
}
else if (dataTypeCode == 1)
{
return GetDataTypeFromMap(Nav::TELEMETRY, dataId);
}
else if (dataTypeCode == 2)
{
return GetDataTypeFromMap(Nav::ERROR, dataId);
}
break;
case 7: // SignalStack Board
if (dataTypeCode == 0)
{
Expand Down
29 changes: 16 additions & 13 deletions tools/RoveComm/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,19 +242,22 @@ def find_board_and_data_id(json_file):
with open(json_file) as f:
data = json.load(f)

for board_name, component in data['RovecommManifest'].items():
if 'Commands' in component:
for command in component['Commands'].values():
data_id = command['dataId'] // 1000
results.add((board_name, data_id))
elif 'Telemetry' in component:
for telemetry in component['Telemetry'].values():
data_id = telemetry['dataId'] // 1000
results.add((board_name, data_id))
elif 'Error' in component:
for error in component['Error'].values():
data_id = error['dataId'] // 1000
results.add((board_name, data_id))
for board_name in data['RovecommManifest'].keys():
print(1, board_name)
for component in data['RovecommManifest'][board_name].keys():
print(2, component)
if 'Commands' in component:
for command in data['RovecommManifest'][board_name]['Commands'].values():
data_id = command['dataId'] // 1000
results.add((board_name, data_id))
if 'Telemetry' in component:
for telemetry in data['RovecommManifest'][board_name]['Telemetry'].values():
data_id = telemetry['dataId'] // 1000
results.add((board_name, data_id))
if 'Error' in component:
for error in data['RovecommManifest'][board_name]['Error'].values():
data_id = error['dataId'] // 1000
results.add((board_name, data_id))

return sorted(results, key=lambda x: x[1])

Expand Down