Giter Site home page Giter Site logo

Comments (2)

aler9 avatar aler9 commented on August 21, 2024

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"
)

func main() {
	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 target
		OutSystemID: 10,
	})
	if err != nil {
		panic(err)
	}
	defer node1.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 target
		OutSystemID: 11,
	})
	if err != nil {
		panic(err)
	}
	defer node2.Close()

	for evt := range node1.Events() {
		if frm, ok := evt.(*gomavlib.EventFrame); ok {
			// route frame to every other channel
			node.WriteFrameExcept(frm.Channel, frm.Frame)

		 	// route to serial only if a certain condition is satisfied
			if conditionSatisfied {
				node2.WriteFrameAll(frm.Frame)
			}
		}
	}
}

from mavp2p.

gediminasgu avatar gediminasgu commented on August 21, 2024

That's exactly how I did solve it. Thank you a lot for a comprehensive answer!

from mavp2p.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.