You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thank you for a great example of the mavlink router on Go. I really like it.
I have a question. I'm routing messages between all endpoints as it is presented in an example (https://github.com/aler9/mavp2p/blob/main/main.go#L220). But for one endpoint (microcontroller which runs on serial) I want to route just some specific messages to do not overload it with all incoming traffic.
Hello, i'm a little rusty about this project since i did it almost 3 years ago, but if i remember correctly you should be able to perform this task by by writing a very simple Golang program and instantiating two nodes:
one with all the endpoints except the serial one
another with the serial endpoint
package main
import (
"fmt""github.com/aler9/gomavlib"
)
funcmain() {
node1, err:=gomavlib.NewNode(gomavlib.NodeConf{
Endpoints: []gomavlib.EndpointConf{
gomavlib.EndpointUDPClient{"1.2.3.4:5900"},
// insert any other endpoint here
},
Dialect: nil,
OutVersion: gomavlib.V2, // change to V1 if you're unable to communicate with the targetOutSystemID: 10,
})
iferr!=nil {
panic(err)
}
defernode1.Close()
node2, err:=gomavlib.NewNode(gomavlib.NodeConf{
Endpoints: []gomavlib.EndpointConf{
gomavlib.EndpointSerial{"/dev/ttyUSB0:57600"},
},
Dialect: nil,
OutVersion: gomavlib.V2, // change to V1 if you're unable to communicate with the targetOutSystemID: 11,
})
iferr!=nil {
panic(err)
}
defernode2.Close()
forevt:=rangenode1.Events() {
iffrm, ok:=evt.(*gomavlib.EventFrame); ok {
// route frame to every other channelnode.WriteFrameExcept(frm.Channel, frm.Frame)
// route to serial only if a certain condition is satisfiedifconditionSatisfied {
node2.WriteFrameAll(frm.Frame)
}
}
}
}
Thank you for a great example of the mavlink router on Go. I really like it.
I have a question. I'm routing messages between all endpoints as it is presented in an example (https://github.com/aler9/mavp2p/blob/main/main.go#L220). But for one endpoint (microcontroller which runs on serial) I want to route just some specific messages to do not overload it with all incoming traffic.
When creating a node, I need to pass endpoints (https://github.com/aler9/mavp2p/blob/main/main.go#L153) but later we need to operate with channels (https://github.com/aler9/mavp2p/blob/main/main.go#L220). Is it possible to get a channel from an endpoint? Or any other ideas on how to implement the following logic:
I would be very thankful for ideas here.
The text was updated successfully, but these errors were encountered: