Skip to content

Trying to send a takeoff command to the SITL but nothing happens. #128

Closed Answered by aler9
razsa asked this question in Q&A
Discussion options

You must be logged in to vote

Hello, the only error i see in your code is that you are stopping the event queue for 5 seconds:

// Wait for a few seconds to see the response
log.Println("Waiting for response...")
time.Sleep(5 * time.Second)

This stops event processing, that might be related to the ability to send or receive messages.

The right approach consists in always listening for incoming messages. The listen procedure is "blocking", not "non-blocking", therefore there's no need to wait, since the waiting is already performed by dc.node.Events():

for evt := range dc.node.Events() {
	if frm, ok := evt.(*gomavlib.EventFrame); ok {
		log.Printf("Received: id=%d, %+v\n", frm.Message().GetID(), frm.Message())
	}
}

Even…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by razsa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants