tm_get_adcs_est_rate.lua 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. -- Define the dissector function for the new structure
  2. function tm_get_adcs_est_rate(buffer, pinfo, tree, adcs_est_angular_rate, offset)
  3. -- Define ProtoFields for the new structure fields
  4. local f_x_angular_rate = ProtoField.double("adcs_est_angular_rate.f_x_angular_rate", "X Angular Rate", base.DEC)
  5. local f_y_angular_rate = ProtoField.double("adcs_est_angular_rate.f_y_angular_rate", "Y Angular Rate", base.DEC)
  6. local f_z_angular_rate = ProtoField.double("adcs_est_angular_rate.f_z_angular_rate", "Z Angular Rate", base.DEC)
  7. -- Add the fields to the protocol
  8. adcs_est_angular_rate.fields = {
  9. f_x_angular_rate, f_y_angular_rate, f_z_angular_rate
  10. }
  11. local subtree = tree:add(adcs_est_angular_rate, buffer(), "ADCS ESTIMATED ANGULAR RATES")
  12. offset = offset + 3
  13. local data = buffer(offset,1):le_int()
  14. offset = offset + 1
  15. if data == 0 then
  16. -- dissect commanded roll angle (2 bytes)
  17. local x_angular_rate = buffer(offset, 8):le_float()
  18. subtree:add(f_x_angular_rate, x_angular_rate):set_text(string.format("Rate Sensor X : %0.6f", x_angular_rate))
  19. offset = offset + 8
  20. -- dissect commanded pitch angle (2 bytes)
  21. local y_angular_rate = buffer(offset, 8):le_float()
  22. subtree:add(f_y_angular_rate, y_angular_rate):set_text(string.format("Rate Sensor Y : %0.6f", y_angular_rate))
  23. offset = offset + 8
  24. -- dissect commanded yaw angle (2 bytes)
  25. local z_angular_rate = buffer(offset, 8):le_float()
  26. subtree:add(f_z_angular_rate, z_angular_rate):set_text(string.format("Rate Sensor Z : %0.6f", z_angular_rate))
  27. offset = offset + 8
  28. elseif data == -1 then
  29. subtree:add(" ADCS operation failure ")
  30. elseif data == -2 then
  31. subtree:add(" TC TM error ")
  32. elseif data == -3 then
  33. subtree:add(" Interface error ")
  34. elseif data == -4 then
  35. subtree:add(" Id not support ")
  36. elseif data == -5 then
  37. subtree:add(" ADCS HW in invalid power state ")
  38. elseif data == -6 then
  39. subtree:add(" ADCS Semaphore take failure ")
  40. elseif data == -6 then
  41. subtree:add(" ADCS Operating Mode Mismatch error ")
  42. elseif data == -6 then
  43. subtree:add(" ADCS responded data is not in a valid range ")
  44. end
  45. end