mavlink / mavlink2rest

mavlink2rest creates a REST server that provides mavlink information from a mavlink source
MIT License
89 stars 28 forks source link

NAMED_VALUE_FLOAT is invalid message #52

Closed 1chick closed 2 years ago

1chick commented 2 years ago

pi@raspberrypi:~/companion $ curl --request POST http://0.0.0.0:8088/mavlink -H "Content-Type: application/json" --data '{ "header": { "system_id": 255, "component_id": 0, "sequence": 0 }, "message": { "type":"NAMED_VALUE_FLOAT", "time_boot_ms":0, "name":"leak", "value":0.0 } }' Failed to parse message, not a valid MAVLinkMessage.

1chick commented 2 years ago

message changed to it ,getcha

'{ "header": { "system_id": 255, "component_id": 0, "sequence": 0 }, "message": { "type": "NAMED_VALUE_FLOAT", "time_boot_ms": 0, "value": 2.0, "name": [ "l", "e", "a", "k", "\u0000", "\u0000", "\u0000", "\u0000", "\u0000", "\u0000" ] } }'

patrickelectric commented 2 years ago

Hi @1chick,

I would recommend to check the helper endpoint for message example:

 curl http://blueos.local:6040/helper/mavlink\?name\=NAMED_VALUE_FLOAT                               
{
  "header": {
    "system_id": 255,
    "component_id": 0,
    "sequence": 0
  },
  "message": {
    "type": "NAMED_VALUE_FLOAT",
    "time_boot_ms": 0,
    "value": 0.0,
    "name": [
      "\u0000",
      "\u0000",
      "\u0000",
      "\u0000",
      "\u0000",
      "\u0000",
      "\u0000",
      "\u0000",
      "\u0000",
      "\u0000"
    ]
  }
}%                                                       
1chick commented 2 years ago

Thanks @patrickelectric bro! the NAMED_VALUE_FLOAT message directly can not be sent to GCS by mavlink2rest, have to edit the code logic in ardusub's firmware function GCS_MAVLINK_Sub::handleMessage. is it right?

1chick commented 2 years ago

hi bro @patrickelectric when post data,it response slowly,sometime need 40s. how to Optimize?