Browse Source

Add dissector for adcs TM - 253, 241, 130, 133, 129, 134, 135, 137, 195, 196, 184

priyadharsan 2 months ago
parent
commit
5c2e8dc617

+ 34 - 0
Dissector/tm_adcs_get_est_attitude_angl.lua

@@ -0,0 +1,34 @@
+-- Define the dissector function for the new structure
+function tm_get_adcs_estimated_angle(buffer, pinfo, tree, adcs_estimated_angle, offset)
+
+-- Define ProtoFields for the new structure fields
+
+local f_roll_angle = ProtoField.double("adcs_estimated_angle.roll_angle", "Roll Angle", base.DEC)
+local f_pitch_angle = ProtoField.double("adcs_estimated_angle.pitch_angle", "Pitch Angle", base.DEC)
+local f_yaw_angle = ProtoField.double("adcs_estimated_angle.yaw_angle", "Yaw Angle", base.DEC)
+
+-- Add the fields to the protocol
+adcs_estimated_angle.fields = { 
+     f_roll_angle, f_pitch_angle, f_yaw_angle
+}
+
+local subtree = tree:add(adcs_estimated_angle, buffer(), "ADCS ESTIMATED ANGLE")
+
+        
+        offset = offset + 4
+
+        -- dissect commanded roll angle (2 bytes)
+        local roll_angle = buffer(offset, 8):le_float()
+        subtree:add(f_roll_angle, roll_angle):set_text(string.format("Roll Angle : %0.6f",roll_angle))
+        offset = offset + 8
+
+        -- dissect commanded pitch angle (2 bytes)
+        local pitch_angle = buffer(offset, 8):le_float()
+        subtree:add(f_pitch_angle, pitch_angle):set_text(string.format("Pitch Angle : %0.6f",pitch_angle))
+        offset = offset + 8
+
+        -- dissect commanded yaw angle (2 bytes)
+        local yaw_angle = buffer(offset, 8):le_float()
+        subtree:add(f_yaw_angle, yaw_angle):set_text(string.format("Yaw Angle : %0.6f",yaw_angle))
+        offset = offset + 8
+end

+ 23 - 0
Dissector/tm_adcs_state_cfg.lua

@@ -0,0 +1,23 @@
+function tm_adcs_state_cfg(buffer, pinfo, tree, adcs_state_cfg, offset)
+    -- Define ProtoFields
+    local f_auto_comm_flag = ProtoField.uint8("adcs_state_cfg.auto_comm_flag", "Auto Commissioning Flag", base.DEC)
+    local f_fsm_state = ProtoField.uint8("adcs_state_cfg.fsm_state", "FSM State", base.DEC)
+
+    -- Register the fields in the protocol
+    adcs_state_cfg.fields = {f_auto_comm_flag, f_fsm_state}
+
+    -- Create the subtree for `auto_commissioning`
+    local subtree = tree:add(adcs_state_cfg, buffer(), "TM GET ADCS STATE CFG")
+    
+    offset = offset + 4
+
+    -- Parse `Auto Commissioning Flag`
+    subtree:add(f_auto_comm_flag, buffer(offset, 1))
+    offset = offset + 1
+
+    -- Parse `FSM State`
+    subtree:add(f_fsm_state, buffer(offset, 1))
+    offset = offset + 1
+
+    return offset
+end

+ 29 - 0
Dissector/tm_get_adcs_commanded_wheel_speed.lua

@@ -0,0 +1,29 @@
+function tm_get_command_wheel_speed(buffer, pinfo, tree, command_wheel_speed, offset)
+    -- Define ProtoFields
+    local f_num_wheels = ProtoField.uint8("command_wheel_speed.num_wheels", "Number of Reaction Wheels", base.DEC)
+    local f_wheel_speed = ProtoField.uint16("command_wheel_speed.wheel_speed", "Wheel Speed", base.DEC)
+
+    -- Add the fields to the protocol
+    command_wheel_speed.fields = { 
+        f_num_wheels, f_wheel_speed
+    }
+
+    -- Add a subtree for the structure
+    local subtree = tree:add(command_wheel_speed, buffer(), "Command Wheel Speed")
+    
+    offset = offset + 4
+
+    -- Dissect the number of reaction wheels (1 byte)
+    local num_wheels = buffer(offset, 1):le_uint()
+    subtree:add(f_num_wheels, num_wheels):set_text(string.format("Number of Reaction Wheels: %d", num_wheels))
+    offset = offset + 1
+
+    -- Dissect the array of wheel speeds (2 * N bytes)
+    --local wheel_speeds_subtree = subtree:add(buffer(offset, 2 * num_wheels), "Wheel Speeds")
+    for i = 1, num_wheels  do
+        local wheel_speed = buffer(offset, 2):le_uint()
+        subtree:add(f_wheel_speed, wheel_speed):set_text(string.format("Commanded Wheel %d Speed : %d", i , wheel_speed))
+        offset = offset + 2
+    end
+
+end

+ 28 - 0
Dissector/tm_get_adcs_css_vector.lua

@@ -0,0 +1,28 @@
+function tm_get_adcs_css_vector(buffer, pinfo, tree, adcs_css, offset)
+
+local f_x_sun_vector = ProtoField.float("adcs_css.x_sun_vector", "X Sun Vector", base.DEC)
+local f_y_sun_vector = ProtoField.float("adcs_css.y_sun_vector", "Y Sun Vector", base.DEC)
+local f_z_sun_vector = ProtoField.float("adcs_css.z_sun_vector", "Z Sun Vector", base.DEC)
+
+-- Register fields to the protocol
+adcs_css.fields = { f_x_sun_vector, f_y_sun_vector, f_z_sun_vector }
+
+local subtree = tree:add(adcs_css, buffer(), "ADCS CSS VECTOR")
+
+    offset = offset + 4
+    -- X-axis Sun Vector  
+    local x_sun_vector = buffer(offset, 4):le_float()  
+    subtree:add(f_x_sun_vector, x_sun_vector):set_text(string.format(" X Sun Vector : %0.6f", x_sun_vector))  -- Add to subtree with scaling
+    offset = offset + 4  -- Update offset
+
+    -- Y-axis Sun Vector 
+    local y_sun_vector = buffer(offset, 4):le_float()  
+    subtree:add(f_y_sun_vector, y_sun_vector):set_text(string.format(" Y Sun Vector : %0.6f", y_sun_vector)) -- Add to subtree with scaling
+    offset = offset + 4  -- Update offset
+
+    -- Z-axis Sun Vector 
+    local z_sun_vector = buffer(offset, 4):le_float() 
+    subtree:add(f_z_sun_vector, z_sun_vector):set_text(string.format(" Z Sun Vector : %0.6f", z_sun_vector))  -- Add to subtree with scaling
+    offset = offset + 4  -- Update offset
+    
+end

+ 34 - 0
Dissector/tm_get_adcs_est_rate.lua

@@ -0,0 +1,34 @@
+-- Define the dissector function for the new structure
+function tm_get_adcs_est_rate(buffer, pinfo, tree, adcs_est_angular_rate, offset)
+
+-- Define ProtoFields for the new structure fields
+
+local f_x_angular_rate = ProtoField.double("adcs_est_angular_rate.f_x_angular_rate", "X Angular Rate", base.DEC)
+local f_y_angular_rate = ProtoField.double("adcs_est_angular_rate.f_y_angular_rate", "Y Angular Rate", base.DEC)
+local f_z_angular_rate = ProtoField.double("adcs_est_angular_rate.f_z_angular_rate", "Z Angular Rate", base.DEC)
+
+-- Add the fields to the protocol
+adcs_est_angular_rate.fields = { 
+     f_x_angular_rate, f_y_angular_rate, f_z_angular_rate
+}
+
+local subtree = tree:add(adcs_est_angular_rate, buffer(), "ADCS ESTIMATED ANGULAR RATES")
+
+        
+        offset = offset + 4
+
+        -- dissect commanded roll angle (2 bytes)
+        local x_angular_rate = buffer(offset, 8):le_float()
+        subtree:add(f_x_angular_rate, x_angular_rate):set_text(string.format("Rate Sensor X : %0.6f", x_angular_rate))
+        offset = offset + 8
+
+        -- dissect commanded pitch angle (2 bytes)
+        local y_angular_rate = buffer(offset, 8):le_float()
+        subtree:add(f_y_angular_rate, y_angular_rate):set_text(string.format("Rate Sensor Y : %0.6f", y_angular_rate))
+        offset = offset + 8
+
+        -- dissect commanded yaw angle (2 bytes)
+        local z_angular_rate = buffer(offset, 8):le_float()
+        subtree:add(f_z_angular_rate, z_angular_rate):set_text(string.format("Rate Sensor Z : %0.6f", z_angular_rate))
+        offset = offset + 8
+end

+ 28 - 0
Dissector/tm_get_adcs_fss_vector.lua

@@ -0,0 +1,28 @@
+function tm_get_adcs_fss_vector(buffer, pinfo, tree, adcs_fss, offset)
+
+local fss_x_vector = ProtoField.float("adcs_fss.x_sun_vector", "X Sun Vector", base.DEC)
+local fss_y_vector = ProtoField.float("adcs_fss.y_sun_vector", "Y Sun Vector", base.DEC)
+local fss_z_vector = ProtoField.float("adcs_fss.z_sun_vector", "Z Sun Vector", base.DEC)
+
+-- Register fields to the protocol
+adcs_fss.fields = { fss_x_vector, fss_y_vector, fss_z_vector }
+
+local subtree = tree:add(adcs_fss, buffer(), "ADCS FSS VECTOR")
+
+    offset = offset + 4
+    -- X-axis Sun Vector  
+    local x_vector = buffer(offset, 4):le_float()  
+    subtree:add(fss_x_vector, x_vector):set_text(string.format(" FSS X Vector : %0.6f", x_vector))  -- Add to subtree with scaling
+    offset = offset + 4  -- Update offset
+
+    -- Y-axis Sun Vector 
+    local y_vector = buffer(offset, 4):le_float()  
+    subtree:add(fss_y_vector, y_vector):set_text(string.format(" FSS Y Vector : %0.6f", y_vector)) -- Add to subtree with scaling
+    offset = offset + 4  -- Update offset
+
+    -- Z-axis Sun Vector 
+    local z_vector = buffer(offset, 4):le_float() 
+    subtree:add(fss_z_vector, z_vector):set_text(string.format(" FSS Z Vector : %0.6f", z_vector))  -- Add to subtree with scaling
+    offset = offset + 4  -- Update offset
+    
+end

+ 33 - 0
Dissector/tm_get_adcs_mag_field_vector.lua

@@ -0,0 +1,33 @@
+function tm_get_adcs_mag_field_vector(buffer, pinfo, tree, adcs_magnetic_field, offset, num_of_instance)
+
+local f_magnetic_field_x = ProtoField.float("adcs_magnetic_field.magnetic_field_x", "X Axis Magnetic Field Vector", base.DEC)
+local f_magnetic_field_y = ProtoField.float("adcs_magnetic_field.magnetic_field_y", "Y Axis Magnetic Field Vector", base.DEC)
+local f_magnetic_field_z = ProtoField.float("adcs_magnetic_field.magnetic_field_z", "Z Axis Magnetic Field Vector", base.DEC)
+
+-- Add the protocol fields to the protocol
+adcs_magnetic_field.fields = {
+    f_magnetic_field_x,
+    f_magnetic_field_y,
+    f_magnetic_field_z
+}
+
+local subtree = tree:add(adcs_magnetic_field, buffer(), "ADCS MAGNETIC FIELD VECTOR")
+    
+    offset = offset + 4
+	
+    -- X Axis Magnetic Field Vector (2 bytes, INT)
+    local x_field = buffer(offset, 4):le_float()  -- Apply the scaling factor (RAWVAL * 0.01)
+    subtree:add(f_magnetic_field_x, x_field):set_text(string.format("X Axis Magnetic Field Vector : %3.6f",x_field))
+    offset = offset + 4  -- Update offset
+
+    -- Y Axis Magnetic Field Vector (2 bytes, INT)
+    local y_field = buffer(offset, 4):le_float() -- Apply the scaling factor (RAWVAL * 0.01)
+    subtree:add(f_magnetic_field_y, y_field):set_text(string.format("Y Axis Magnetic Field Vector : %3.6f",y_field))
+    offset = offset + 4  -- Update offset
+
+    -- Z Axis Magnetic Field Vector (2 bytes, INT)
+    local z_field = buffer(offset, 4):le_float()   -- Apply the scaling factor (RAWVAL * 0.01)
+    subtree:add(f_magnetic_field_z, z_field):set_text(string.format("Z Axis Magnetic Field Vector : %3.6f",z_field))
+    offset = offset + 4  -- Update offset
+    
+end

+ 29 - 0
Dissector/tm_get_adcs_rw_speed_measure.lua

@@ -0,0 +1,29 @@
+function tm_get_adcs_rw_speed_measure(buffer, pinfo, tree, adcs_rw_speed_wheel, offset)
+    -- Define ProtoFields
+    local f_num_wheels = ProtoField.uint8("command_wheel_speed.num_wheels", "Number of Reaction Wheels", base.DEC)
+    local f_wheel_speed = ProtoField.uint16("command_wheel_speed.wheel_speed", "Wheel Speed", base.DEC)
+
+    -- Add the fields to the protocol
+    adcs_rw_speed_wheel.fields = { 
+        f_num_wheels, f_wheel_speed
+    }
+
+    -- Add a subtree for the structure
+    local subtree = tree:add(adcs_rw_speed_wheel, buffer(), "Reaction Wheel Speed Measure")
+    
+    offset = offset + 4
+
+    -- Dissect the number of reaction wheels (1 byte)
+    local num_wheels = buffer(offset, 1):le_uint()
+    subtree:add(f_num_wheels, num_wheels):set_text(string.format("Number of Reaction Wheels: %d", num_wheels))
+    offset = offset + 1
+
+    -- Dissect the array of wheel speeds (2 * N bytes)
+    --local wheel_speeds_subtree = subtree:add(buffer(offset, 2 * num_wheels), "Wheel Speeds")
+    for i = 1, num_wheels  do
+        local wheel_speed = buffer(offset, 2):le_uint()
+        subtree:add(f_wheel_speed, wheel_speed):set_text(string.format("Measured Wheel %d Speed : %d", i , wheel_speed))
+        offset = offset + 2
+    end
+
+end

+ 34 - 0
Dissector/tm_get_adcs_sensor_vector.lua

@@ -0,0 +1,34 @@
+-- Define the dissector function for the new structure
+function tm_get_adcs_sensor_vector(buffer, pinfo, tree, adcs_sensor_vector, offset)
+
+-- Define ProtoFields for the new structure fields
+
+local f_x_rate_measurement = ProtoField.double("adcs_sensor_vector.roll_angle", "Roll Angle", base.DEC)
+local f_y_rate_measurement = ProtoField.double("adcs_sensor_vector.pitch_angle", "Pitch Angle", base.DEC)
+local f_z_rate_measurement = ProtoField.double("adcs_sensor_vector.yaw_angle", "Yaw Angle", base.DEC)
+
+-- Add the fields to the protocol
+adcs_sensor_vector.fields = { 
+     f_x_rate_measurement, f_y_rate_measurement, f_z_rate_measurement
+}
+
+local subtree = tree:add(adcs_sensor_vector, buffer(), "ADCS SENSOR VECTOR")
+
+        
+        offset = offset + 4
+
+        -- dissect commanded roll angle (2 bytes)
+        local x_rate_measurement = buffer(offset, 8):le_float()
+        subtree:add(f_x_rate_measurement, x_rate_measurement):set_text(string.format("Rate Sensor X : %0.6f", x_rate_measurement))
+        offset = offset + 8
+
+        -- dissect commanded pitch angle (2 bytes)
+        local y_rate_measurement = buffer(offset, 8):le_float()
+        subtree:add(f_y_rate_measurement, y_rate_measurement):set_text(string.format("Rate Sensor Y : %0.6f", y_rate_measurement))
+        offset = offset + 8
+
+        -- dissect commanded yaw angle (2 bytes)
+        local z_rate_measurement = buffer(offset, 8):le_float()
+        subtree:add(f_z_rate_measurement, z_rate_measurement):set_text(string.format("Rate Sensor Z : %0.6f", z_rate_measurement))
+        offset = offset + 8
+end

+ 271 - 0
Dissector/tm_get_adcs_state.lua

@@ -0,0 +1,271 @@
+function tm_get_adcs_state(buffer, pinfo, tree, adcs_protocol, offset)
+
+local f_operation_status = ProtoField.uint8("adcs_protocol.operation_status", "Operation Status", base.HEX)
+local f_epoch_time = ProtoField.uint32("adcs_protocol.epoch_time", "Epoch Time", base.DEC)
+local f_attitude_estimation_mode = ProtoField.uint8("adcs_protocol.attitude_estimation_mode", "Attitude Estimation Mode", base.DEC)
+local f_control_mode = ProtoField.uint8("adcs_protocol.control_mode", "Control Mode", base.DEC)
+local f_adcs_run_mode = ProtoField.uint8("adcs_protocol.adcs_run_mode", "ADCS Run Mode", base.DEC)
+local f_asgp4_mode = ProtoField.uint8("adcs_protocol.asgp4_mode", "ASGP4 Mode", base.DEC)
+
+-- Define boolean fields for enabled flags
+local f_cube_control_signal_enabled = ProtoField.bool("adcs_protocol.cube_control_signal_enabled", "Cube Control Signal Enabled")
+local f_cube_control_motor_enabled = ProtoField.bool("adcs_protocol.cube_control_motor_enabled", "Cube Control Motor Enabled")
+local f_cubesense1_enabled = ProtoField.bool("adcs_protocol.cubesense1_enabled", "Cubesense1 Enabled")
+local f_cubesense2_enabled = ProtoField.bool("adcs_protocol.cubesense2_enabled", "Cubesense2 Enabled")
+local f_cube_wheel1_enabled = ProtoField.bool("adcs_protocol.cube_wheel1_enabled", "Cube Wheel 1 Enabled")
+local f_cube_wheel2_enabled = ProtoField.bool("adcs_protocol.cube_wheel2_enabled", "Cube Wheel 2 Enabled")
+local f_cube_wheel3_enabled = ProtoField.bool("adcs_protocol.cube_wheel3_enabled", "Cube Wheel 3 Enabled")
+local f_cube_star_enabled = ProtoField.bool("adcs_protocol.cube_star_enabled", "Cube Star Enabled")
+local f_gps_receiver_enabled = ProtoField.bool("adcs_protocol.gps_receiver_enabled", "GPS Receiver Enabled")
+local f_gps_lna_power_enabled = ProtoField.bool("adcs_protocol.gps_lna_power_enabled", "GPS LNA Power Enabled")
+local f_motor_driver_enabled = ProtoField.bool("adcs_protocol.motor_driver_enabled", "Motor Driver Enabled")
+local f_sun_is_above_local_horizon = ProtoField.bool("adcs_protocol.sun_is_above_local_horizon", "Sun is Above Local Horizon")
+
+-- Communication error fields
+local f_cubesense1_comm_error = ProtoField.bool("adcs_protocol.cubesense1_comm_error", "Cubesense1 Communications Error")
+local f_cubesense2_comm_error = ProtoField.bool("adcs_protocol.cubesense2_comm_error", "Cubesense2 Communications Error")
+local f_cubcontrol_signal_comm_error = ProtoField.bool("adcs_protocol.cubcontrol_signal_comm_error", "CubeControl Signal Communications Error")
+local f_cubcontrol_motor_comm_error = ProtoField.bool("adcs_protocol.cubcontrol_motor_comm_error", "CubeControl Motor Communications Error")
+local f_cubewheel1_comm_error = ProtoField.bool("adcs_protocol.cubewheel1_comm_error", "Cube Wheel 1 Communications Error")
+local f_cubewheel2_comm_error = ProtoField.bool("adcs_protocol.cubewheel2_comm_error", "Cube Wheel 2 Communications Error")
+
+local f_cubewheel3_comm_error = ProtoField.bool("adcs_protocol.cubewheel2_comm_error", "Cube Wheel 3 Communications Error")
+local f_cubestar_comm_error = ProtoField.bool("adcs_protocol.cubewheel2_comm_error", "Cube star communications Error")
+
+local f_magnetometer_range_error = ProtoField.bool("adcs_protocol.magnetometer_range_error", "Magnetometer Range Error")
+local f_cam1_sram_overcurrent = ProtoField.bool("adcs_protocol.cam1_sram_overcurrent", "Cam1 SRAM Overcurrent Detected")
+local f_cam1_3v3_overcurrent = ProtoField.bool("adcs_protocol.cam1_3v3_overcurrent", "Cam1 3v3 Overcurrent Detected")
+local f_cam1_sensor_busy = ProtoField.bool("adcs_protocol.cam1_sensor_busy", "Cam1 Sensor Busy Error")
+local f_cam1_sensor_detection_error = ProtoField.bool("adcs_protocol.cam1_sensor_detection_error", "Cam1 Sensor Detection Error")
+local f_sun_sensor_range_error = ProtoField.bool("adcs_protocol.sun_sensor_range_error", "Sun Sensor Range Error")
+local f_cam2_sram_overcurrent = ProtoField.bool("adcs_protocol.cam2_sram_overcurrent", "Cam2 SRAM Overcurrent Detected")
+local f_cam2_3v3_overcurrent = ProtoField.bool("adcs_protocol.cam2_3v3_overcurrent", "Cam2 3v3 Overcurrent Detected")
+local f_cam2_sensor_busy = ProtoField.bool("adcs_protocol.cam2_sensor_busy", "Cam2 Sensor Busy Error")
+local f_cam2_sensor_detection_error = ProtoField.bool("adcs_protocol.cam2_sensor_detection_error", "Cam2 Sensor Detection Error")
+local f_nadir_sensor_range_error = ProtoField.bool("adcs_protocol.nadir_sensor_range_error", "Nadir Sensor Range Error")
+local f_rate_sensor_range_error = ProtoField.bool("adcs_protocol.rate_sensor_range_error", "Rate Sensor Range Error")
+local f_wheel_speed_range_error = ProtoField.bool("adcs_protocol.wheel_speed_range_error", "Wheel Speed Range Error")
+local f_coarse_sun_sensor_error = ProtoField.bool("adcs_protocol.coarse_sun_sensor_error", "Coarse Sun Sensor Error")
+local f_star_tracker_match_error = ProtoField.bool("adcs_protocol.star_tracker_match_error", "Star Tracker Match Error")
+local f_star_tracker_overcurrent = ProtoField.bool("adcs_protocol.star_tracker_overcurrent", "Star Tracker Overcurrent Detected")
+local f_orbit_parameters_invalid = ProtoField.bool("adcs_protocol.orbit_parameters_invalid", "Orbit Parameters are Invalid")
+local f_configuration_invalid = ProtoField.bool("adcs_protocol.configuration_invalid", "Configuration is Invalid")
+local f_control_mode_change_not_allowed = ProtoField.bool("adcs_protocol.control_mode_change_not_allowed", "Control Mode Change is not allowed")
+local f_estimator_change_not_allowed = ProtoField.bool("adcs_protocol.estimator_change_not_allowed", "Estimator Change is not allowed")
+
+-- Define Magnetometer Sampling Mode field (2 bytes)
+local f_magnetometer_sampling_mode = ProtoField.uint8("adcs_protocol.magnetometer_sampling_mode", "Magnetometer Sampling Mode", base.DEC)
+
+-- Define runtime error fields
+local f_cubesense1_runtime_error = ProtoField.bool("adcs_protocol.cubesense1_runtime_error", "CubeSense1 Runtime Error")
+local f_cubesense2_runtime_error = ProtoField.bool("adcs_protocol.cubesense2_runtime_error", "CubeSense2 Runtime Error")
+local f_cubecontrol_signal_runtime_error = ProtoField.bool("adcs_protocol.cubecontrol_signal_runtime_error", "CubeControl Signal Runtime Error")
+local f_cubecontrol_motor_runtime_error = ProtoField.bool("adcs_protocol.cubecontrol_motor_runtime_error", "CubeControl Motor Runtime Error")
+local f_cubewheel1_runtime_error = ProtoField.bool("adcs_protocol.cubewheel1_runtime_error", "CubeWheel1 Runtime Error")
+local f_a = ProtoField.bool("adcs_protocol.cubewheel1_runtime_error", "CubeWheel1 Runtime Error")
+local f_b = ProtoField.bool("adcs_protocol.cubewheel1_runtime_error", "CubeWheel1 Runtime Error")
+local f_cubewheel2_runtime_error = ProtoField.bool("adcs_protocol.cubewheel2_runtime_error", "CubeWheel2 Runtime Error")
+local f_cubewheel3_runtime_error = ProtoField.bool("adcs_protocol.cubewheel3_runtime_error", "CubeWheel3 Runtime Error")
+local f_cubestar_runtime_error = ProtoField.bool("adcs_protocol.cubestar_runtime_error", "CubeStar Runtime Error")
+local f_magnetometer_error = ProtoField.bool("adcs_protocol.magnetometer_error", "Magnetometer Error")
+local f_rate_sensor_failure = ProtoField.bool("adcs_protocol.rate_sensor_failure", "Rate Sensor Failure")
+
+-- Add all fields to the protocol
+adcs_protocol.fields = {
+    f_operation_status,
+    f_epoch_time,
+    f_attitude_estimation_mode,
+    f_control_mode,
+    f_adcs_run_mode,
+    f_asgp4_mode,
+    f_cube_control_signal_enabled,
+    f_cube_control_motor_enabled,
+    f_cubesense1_enabled,
+    f_cubesense2_enabled,
+    f_cube_wheel1_enabled,
+    f_cube_wheel2_enabled,
+    f_cube_wheel3_enabled,
+    f_cube_star_enabled,
+    f_gps_receiver_enabled,
+    f_gps_lna_power_enabled,
+    f_motor_driver_enabled,
+    f_sun_is_above_local_horizon,
+    f_cubesense1_comm_error,
+    f_cubesense2_comm_error,
+    f_cubcontrol_signal_comm_error,
+    f_cubcontrol_motor_comm_error,
+    f_cubewheel1_comm_error,
+    f_cubewheel2_comm_error,
+    f_cubewheel3_comm_error,
+    f_cubestar_comm_error,
+    f_magnetometer_range_error,
+    f_cam1_sram_overcurrent,
+    f_cam1_3v3_overcurrent,
+    f_cam1_sensor_busy,
+    f_cam1_sensor_detection_error,
+    f_sun_sensor_range_error,
+    f_cam2_sram_overcurrent,
+    f_cam2_3v3_overcurrent,
+    f_cam2_sensor_busy,
+    f_cam2_sensor_detection_error,
+    f_nadir_sensor_range_error,
+    f_rate_sensor_range_error,
+    f_wheel_speed_range_error,
+    f_coarse_sun_sensor_error,
+    f_star_tracker_match_error,
+    f_star_tracker_overcurrent,
+    f_orbit_parameters_invalid,
+    f_a,
+    f_b,
+    f_configuration_invalid,
+    f_control_mode_change_not_allowed,
+    f_estimator_change_not_allowed,
+    f_magnetometer_sampling_mode,
+    f_cubesense1_runtime_error,
+    f_cubesense2_runtime_error,
+    f_cubecontrol_signal_runtime_error,
+    f_cubecontrol_motor_runtime_error,
+    f_cubewheel1_runtime_error,
+    f_cubewheel2_runtime_error,
+    f_cubewheel3_runtime_error,
+    f_cubestar_runtime_error,
+    f_magnetometer_error,
+    f_rate_sensor_failure
+}
+
+local subtree = tree:add(adcs_protocol, buffer(), "ADCS")
+  
+ 
+    --subtree:add(f_operation_status, buffer(offset, 1):le_uint())
+    --offset = offset + 1
+    --subtree:add(f_epoch_time, buffer(offset, 4):le_uint())
+    --offset = offset + 4
+
+    -- Parse Attitude Estimation Mode (8 bits)
+    subtree:add(f_attitude_estimation_mode, buffer(offset, 1):le_uint())
+    offset = offset + 1
+
+    -- Parse Control Mode (8 bits)
+    subtree:add(f_control_mode, buffer(offset, 1):le_uint())
+    offset = offset + 1
+
+    -- Parse ADCS Run Mode (2 bits / 2 bytes)
+    local a=buffer(offset, 1):le_uint()
+    subtree:add(f_adcs_run_mode, a & 0x03)
+
+    -- Parse ASGP4 Mode (2 bits / 2 bytes)
+    subtree:add(f_asgp4_mode, (a >> 2) & 0x03)
+    
+    subtree:add(f_cube_control_signal_enabled, (a >> 4) & 0x01)
+    
+    subtree:add(f_cube_control_motor_enabled,(a >> 5) & 0x01 )
+    
+    subtree:add(f_cubesense1_enabled,(a >> 6) & 0x01 )
+  
+    subtree:add(f_cubesense2_enabled,(a >> 7) & 0x01 )
+    
+    offset = offset + 1
+    -- Parse CubeWheel Enabled Flags
+    a=buffer(offset, 1):le_uint()
+    
+    subtree:add(f_cube_wheel1_enabled, (a >> 0) & 0x01)
+    
+    subtree:add(f_cube_wheel2_enabled, (a >> 1) & 0x01)
+    
+    subtree:add(f_cube_wheel3_enabled, (a >> 2) & 0x01)
+    
+    subtree:add(f_cube_star_enabled, (a >> 3) & 0x01)
+
+    subtree:add(f_gps_receiver_enabled, (a >> 4) & 0x01)
+
+    subtree:add(f_gps_lna_power_enabled, (a >> 5) & 0x01)  -- GPS LNA Power Enabled
+    
+    subtree:add(f_motor_driver_enabled, (a >> 6) & 0x01)  -- Motor Driver Enabled
+
+    subtree:add(f_sun_is_above_local_horizon, (a >> 7) & 0x01)  -- Sun is Above Local Horizon
+    offset = offset + 1
+
+    a = buffer(offset, 1):le_uint()
+    
+    -- Communication error flags
+    subtree:add(f_cubesense1_comm_error, (a >> 0) & 0x01)  -- Cubesense1 Communications Error
+    subtree:add(f_cubesense2_comm_error, (a >> 1) & 0x01)  -- Cubesense2 Communications Error
+  
+    subtree:add(f_cubcontrol_signal_comm_error, (a >> 2) & 0x01)  -- CubeControl Signal Communications Error
+
+    subtree:add(f_cubcontrol_motor_comm_error, (a >> 3) & 0x01)  -- CubeControl Motor Communications Error
+    subtree:add(f_cubewheel1_comm_error, (a >> 4) & 0x01)  -- Cube Wheel1 Communications Error
+    subtree:add(f_cubewheel2_comm_error, (a >> 5) & 0x01)  -- Cube Wheel2 Communications Error
+    subtree:add(f_cubewheel3_comm_error, (a >> 6) & 0x01)
+    subtree:add(f_cubestar_comm_error, (a >> 7) & 0x01)
+    offset = offset + 1
+    
+    a=buffer(offset, 1):le_uint()
+
+    subtree:add(f_magnetometer_range_error, (a >> 0) & 0x01)  -- Magnetometer Range Error
+
+    subtree:add(f_cam1_sram_overcurrent, (a >> 1) & 0x01)  -- Cam1 SRAM Overcurrent Detected
+
+    subtree:add(f_cam1_3v3_overcurrent, (a >> 2) & 0x01)  -- Cam1 3v3 Overcurrent Detected
+    subtree:add(f_cam1_sensor_busy, (a >> 3) & 0x01)  -- Cam1 Sensor Busy Error
+
+    subtree:add(f_cam1_sensor_detection_error, (a >> 4) & 0x01 )  -- Cam1 Sensor Detection Error
+
+    subtree:add(f_sun_sensor_range_error, (a >> 5) & 0x01)  -- Sun Sensor Range Error
+    subtree:add(f_cam2_sram_overcurrent, (a >> 6) & 0x01)  -- Cam2 SRAM Overcurrent Detected
+    subtree:add(f_cam2_3v3_overcurrent, (a >> 7) & 0x01)  -- Cam2 3v3 Overcurrent Detected
+    offset=offset+1
+local data=buffer(offset, 1):le_uint()
+
+    subtree:add(f_cam2_sensor_busy, (data >> 0) & 0x01)  -- Cam2 Sensor Busy Error
+
+    subtree:add(f_cam2_sensor_detection_error, (data >> 1) & 0x01)  -- Cam2 Sensor Detection Error
+
+    subtree:add(f_nadir_sensor_range_error, (data >> 2) & 0x01)  -- Nadir Sensor Range Error
+    subtree:add(f_rate_sensor_range_error, (data >> 3) & 0x01)  -- Rate Sensor Range Error
+
+    subtree:add(f_wheel_speed_range_error,(data >> 4) & 0x01)  -- Wheel Speed Range Error
+
+    -- Error flags for sensors and system issues
+    subtree:add(f_coarse_sun_sensor_error,(data >> 5) & 0x01)  -- Coarse Sun Sensor Error
+    subtree:add(f_star_tracker_match_error, (data >> 6) & 0x01)  -- Star Tracker Match Error
+    subtree:add(f_star_tracker_overcurrent, (data >> 7) & 0x01)  -- Star Tracker Overcurrent Detected
+    offset = offset + 1
+    
+    data = buffer(offset, 1):le_uint()
+
+    subtree:add(f_orbit_parameters_invalid, (data >> 0) & 0x01)  -- Orbit Parameters are Invalid
+    subtree:add(f_configuration_invalid,(data >> 1) & 0x01)  -- Configuration is Invalid
+
+    subtree:add(f_control_mode_change_not_allowed, (data >> 2) & 0x01)  -- Control Mode Change is Not Allowed
+    subtree:add(f_estimator_change_not_allowed, (data >> 3) & 0x01)  -- Estimator Change is Not Allowed
+
+    -- Magnetometer Sampling Mode (2 bits)
+
+    subtree:add(f_magnetometer_sampling_mode, (data >> 4) & 0x03)  -- Current Magnetometer Sampling Mode
+
+    -- Runtime error flags for sensors and systems
+    subtree:add(f_a, (data >> 6 ) & 0x01)  -- CubeSense1 Runtime Error
+    subtree:add(f_b, (data >> 7) & 0x01)  -- CubeSense2 Runtime Error
+    offset=offset+1
+    
+    data = buffer(offset, 1):le_uint()
+
+    subtree:add(f_cubesense1_runtime_error, (data >> 0) & 0x01)  -- CubeSense1 Runtime Error
+    subtree:add(f_cubesense2_runtime_error, (data >> 1) & 0x01)  -- CubeSense2 Runtime Error
+    subtree:add(f_cubecontrol_signal_runtime_error, (data >> 2) & 0x01)  -- CubeControl Signal Runtime Error
+    subtree:add(f_cubecontrol_motor_runtime_error, (data >> 3) & 0x01)  -- CubeControl Motor Runtime Error
+    subtree:add(f_cubewheel1_runtime_error,(data >> 4) & 0x01)  -- CubeWheel1 Runtime Error
+    subtree:add(f_cubewheel2_runtime_error, (data >> 5) & 0x01)  -- CubeWheel2 Runtime Error
+    subtree:add(f_cubewheel3_runtime_error, (data >> 6) & 0x01)  -- CubeWheel3 Runtime Error
+    subtree:add(f_cubestar_runtime_error, (data >> 7) & 0x01)  -- CubeStar Runtime Error
+    offset=offset+1
+    
+    data = buffer(offset, 1):le_uint()
+    -- Magnetometer and sensor errors
+    subtree:add(f_magnetometer_error, (data >> 0) & 0x01)  -- Magnetometer Error
+    subtree:add(f_rate_sensor_failure, (data >> 1) & 0x01)  -- Rate Sensor Failure
+
+    offset = offset + 1
+
+end

+ 61 - 0
Dissector/tm_get_adcs_tle.lua

@@ -0,0 +1,61 @@
+function tm_get_adcs_tle(buffer, pinfo, tree, adcs_tle, offset)
+
+local f_inclination = ProtoField.double("adcs_tle.inclination", "Inclination (Degrees)")
+local f_eccentricity = ProtoField.double("adcs_tle.eccentricity", "Eccentricity")
+local f_raan = ProtoField.double("adcs_tle.raan", "Right-Ascension of the Ascending Node (Degrees)")
+local f_arg_perigee = ProtoField.double("adcs_tle.arg_perigee", "Argument of Perigee (Degrees)")
+local f_b_star = ProtoField.double("adcs_tle.b_star", "B-Star Drag Term")
+local f_mean_motion = ProtoField.double("adcs_tle.mean_motion", "Mean Motion (Revolutions per day)")
+local f_mean_anomaly = ProtoField.double("adcs_tle.mean_anomaly", "Mean Anomaly (Degrees)")
+local f_epoch_time = ProtoField.double("adcs_tle.epoch_time", "Epoch Time (Julian Date)")
+
+-- Register fields with the protocol
+adcs_tle.fields = {
+    f_inclination,
+    f_eccentricity,
+    f_raan,
+    f_arg_perigee,
+    f_b_star,
+    f_mean_motion,
+    f_mean_anomaly,
+    f_epoch_time
+}
+
+local subtree = tree:add(adcs_tle, buffer(), "TM GET ADCS TLE")
+
+    offset = offset + 4
+    
+    local data = buffer(offset,8):le_float()
+    subtree:add(f_inclination, data):set_text(string.format("Inclination : %0.6f",data))
+    offset = offset + 8
+    
+    data = buffer(offset,8):le_float()
+    subtree:add(f_eccentricity, data):set_text(string.format("Eccentricity : %0.6f",data))
+    offset = offset + 8
+    
+    data = buffer(offset,8):le_float()
+    subtree:add(f_raan, data):set_text(string.format("Raan : %0.6f",data))
+    offset = offset + 8
+    
+    data = buffer(offset,8):le_float()
+    subtree:add(f_arg_perigee, data):set_text(string.format("Arg perigee : %0.6f",data))
+    offset = offset + 8
+    
+    data = buffer(offset,8):le_float()
+    subtree:add(f_b_star, data):set_text(string.format("B star : %0.6f",data))
+    offset = offset + 8
+    
+    data = buffer(offset,8):le_float()
+    subtree:add(f_mean_motion, data):set_text(string.format("Mean motion : %0.6f",data))
+    offset = offset + 8
+    
+    data = buffer(offset,8):le_float()
+    subtree:add(f_mean_anomaly, data):set_text(string.format("Mean anomaly : %0.6f",data))
+    offset = offset + 8
+    
+    data = buffer(offset,8):le_float()
+    subtree:add(f_epoch_time, data):set_text(string.format("Epoch time : %0.6f",data))
+    offset = offset + 8
+    
+    
+end