cmdsample.py 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. import message_pb2 as message
  2. import google.protobuf.text_format as tf
  3. if __name__=="__main__":
  4. statu=message.table_statu()
  5. statu.execute_statu=message.eError
  6. statu.statu_description="正常"
  7. measure_info=message.measure_info()
  8. measure_info.cx=0.1
  9. measure_info.cy=0.2
  10. measure_info.theta=3.0
  11. measure_info.length=4.5
  12. measure_info.width=1.8
  13. measure_info.height=1.4
  14. measure_info.wheelbase=2.77
  15. measure_info.border_stuta=0
  16. parkcmd=message.park_table()
  17. parkcmd.statu.CopyFrom(statu)
  18. parkcmd.car_number="鄂A6X3B0"
  19. parkcmd.unit_id=1
  20. parkcmd.terminal_id=0
  21. parkcmd.entrance_measure_info.CopyFrom(measure_info)
  22. print(tf.MessageToString(parkcmd,as_utf8=True))
  23. pickcmd=message.pick_table()
  24. pickcmd.statu.CopyFrom(statu)
  25. pickcmd.primary_key="1234-abcd"
  26. pickcmd.terminal_id=0
  27. print(tf.MessageToString(pickcmd,as_utf8=True))
  28. '''
  29. statu {
  30. execute_statu: eNormal
  31. statu_description: "正常"
  32. }
  33. car_number: "鄂A6X3B0"
  34. unit_id: 1
  35. terminal_id:0
  36. entrance_measure_info {
  37. cx: 0.1
  38. cy: 0.2
  39. theta: 3.0
  40. length: 4.5
  41. width: 1.8
  42. height: 1.4
  43. wheelbase: 2.77
  44. }
  45. statu {
  46. }
  47. unit_id: 1
  48. terminal_id: 2
  49. primary_key: "4fa9d036-3b1c-11ed-a9a2-4db9316878b6"
  50. actually_space_info {
  51. id: 1
  52. unit_id: 1
  53. floor: 5
  54. room_id: 1
  55. }
  56. actually_measure_info {
  57. cx: 0.1
  58. cy: 0.2
  59. theta: 3.0
  60. length: 4.5
  61. width: 1.8
  62. height: 1.5
  63. wheelbase: 2.77
  64. }
  65. '''