-
Notifications
You must be signed in to change notification settings - Fork 54
Closed
Description
How do I subscribe to several mavlink messages simultaneously if these messages are from custom xml?
I subscribe to the "OBSTACLE_DISTANCE" command and one custom command. If I subscribe to only one command, both work fine, but if I subscribe to both at the same time, only the first one works, and the subsequent one starts arriving simultaneously and doesn't transmit data.
drone.mavlinkDirect.getMessage("AGRO_TANK_STATUS")
.subscribe({ mavlinkMessageAgroTankStatus ->
val deserialized: AgroTankStatus =
jsonAgroTankStatus.decodeFromString<AgroTankStatus>(
mavlinkMessageAgroTankStatus.fieldsJson
)
println("AgroTankStatus: weight - ${deserialized.weight}")
}, { error ->
Log.e("MAVLink", "AgroTankStatus error", error)
})
drone.mavlinkDirect.getMessage("OBSTACLE_DISTANCE")
.subscribe { mavlinkMessage ->
val deserialized: ObstacleDistance =
jsonObstacleDistance.decodeFromString<ObstacleDistance>(
mavlinkMessage.fieldsJson
)
println(
"ObstacleDistance: distances - ${
deserialized.distances.joinToString(
separator = ", "
)
}"
)
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels