rticonnextdds-connector-go

所属分类:其他
开发工具:C
文件大小:0KB
下载次数:0
上传日期:2023-05-22 15:19:21
上 传 者sh-1993
说明:  用于Connext DDS的RTI连接器是一种轻量级技术,可以使用Go.、。,
(RTI Connector for Connext DDS is a lightweight technology that enables DDS data to be accessed with Go.,)

文件列表:
.golangci.yaml (3277, 2023-05-19)
.travis.yml (678, 2023-05-19)
CONTRIBUTING.md (860, 2023-05-19)
Dockerfile (340, 2023-05-19)
LICENSE.md (703, 2023-05-19)
Makefile (922, 2023-05-19)
build_dynamic.go (925, 2023-05-19)
build_static.go (607, 2023-05-19)
examples/ (0, 2023-05-19)
examples/array/ (0, 2023-05-19)
examples/array/ShapeArrayExample.xml (2506, 2023-05-19)
examples/array/reader/ (0, 2023-05-19)
examples/array/reader/reader.go (2109, 2023-05-19)
examples/array/writer/ (0, 2023-05-19)
examples/array/writer/writer.go (1818, 2023-05-19)
examples/dockerfiles/ (0, 2023-05-19)
examples/dockerfiles/simple_reader/ (0, 2023-05-19)
examples/dockerfiles/simple_reader/Dockerfile (454, 2023-05-19)
examples/dockerfiles/simple_writer/ (0, 2023-05-19)
examples/dockerfiles/simple_writer/Dockerfile (454, 2023-05-19)
examples/go_struct/ (0, 2023-05-19)
examples/go_struct/ShapeExample.xml (2462, 2023-05-19)
examples/go_struct/reader/ (0, 2023-05-19)
examples/go_struct/reader/json_reader.go (2099, 2023-05-19)
examples/go_struct/writer/ (0, 2023-05-19)
examples/go_struct/writer/json_writer.go (1794, 2023-05-19)
examples/module/ (0, 2023-05-19)
examples/module/ShapeModuleExample.xml (2057, 2023-05-19)
examples/module/reader/ (0, 2023-05-19)
examples/module/reader/reader.go (2119, 2023-05-19)
... ...

rticonnextdds-connector-go ======= [![Coverage](https://codecov.io/gh/rticommunity/rticonnextdds-connector-go/branch/master/graph/badge.svg)](https://codecov.io/gh/rticommunity/rticonnextdds-connector-go) [![Go Report Card](https://goreportcard.com/badge/github.com/rticommunity/rticonnextdds-connector-go)](https://goreportcard.com/report/github.com/rticommunity/rticonnextdds-connector-go) [![Build and Test](https://github.com/rticommunity/rticonnextdds-connector-go/actions/workflows/build.yml/badge.svg)](https://github.com/rticommunity/rticonnextdds-connector-go/actions/workflows/build.yml) ### RTI Connector for Connext DDS *RTI Connector* for Connext DDS is a quick and easy way to access the power and functionality of [RTI Connext DDS](http://www.rti.com/products/index.html). It is based on [XML-Based Application Creation](https://community.rti.com/static/documentation/connext-dds/6.0.0/doc/manuals/connext_dds/xml_application_creation/RTI_ConnextDDS_CoreLibraries_XML_AppCreation_GettingStarted.pdf) and Dynamic Data. *Connector* was created by the RTI Research Group to quickly and easily develop demos and proofs of concept. It can be useful for anybody that needs a quick way to develop an application communicating over the Connext DDS Databus. Thanks to the binding with multiple programming languages, you can integrate with many other available technologies. The *Connector* library is provided in binary form for [select architectures](https://github.com/rticommunity/rticonnextdds-connector/tree/master/lib). Language bindings and examples are provided in source format. Go *Connector* leverages [cgo](https://golang.org/cmd/cgo) to call its C library; this detail is hidden in a Go wrapper. ### Examples #### Simple Reader ```golang package main import ( rti "github.com/rticommunity/rticonnextdds-connector-go" "log" ) func main() { // Create a connector defined in the XML configuration connector, err := rti.NewConnector("MyParticipantLibrary::Zero", "./ShapeExample.xml") if err != nil { log.Panic(err) } // Delete the connector when this main function returns defer connector.Delete() // Get an input from the connector input, err := connector.GetInput("MySubscriber::MySquareReader") if err != nil { log.Panic(err) } // Get values from a received sample and print them for { connector.Wait(-1) input.Take() numOfSamples, _ := input.Samples.GetLength() for i := 0; i < numOfSamples; i++ { valid, _ := input.Infos.IsValid(i) if valid { color, _ := input.Samples.GetString(i, "color") x, _ := input.Samples.GetInt(i, "x") y, _ := input.Samples.GetInt(i, "y") shapesize, _ := input.Samples.GetInt(i, "shapesize") log.Println("---Received Sample---") log.Printf("color: %s\n", color) log.Printf("x: %d\n", x) log.Printf("y: %d\n", y) log.Printf("shapesize: %d\n", shapesize) } } } } ``` #### Simple Writer ```golang package main import ( "github.com/rticommunity/rticonnextdds-connector-go" "log" "time" ) func main() { // Create a connector defined in the XML configuration connector, err := rti.NewConnector("MyParticipantLibrary::Zero", "./ShapeExample.xml") if err != nil { log.Panic(err) } // Delete the connector when this main function returns defer connector.Delete() // Get an output from the connector output, err := connector.GetOutput("MyPublisher::MySquareWriter") if err != nil { log.Panic(err) } // Set values to the instance and write the instance for i := 0; i < 10; i++ { output.Instance.SetInt("x", i) output.Instance.SetInt("y", i*2) output.Instance.SetInt("shapesize", 30) output.Instance.SetString("color", "BLUE") output.Write() log.Println("Writing...") time.Sleep(time.Second * 1) } } ``` #### XML Configurations ```xml UDPV4 | SHMEM ``` Please see [examples](examples/README.md) for usage details. ### Getting started #### Using Go Modules Be sure you have golang installed (we tested with golang v1.19). Import: ```golang import "github.com/rticommunity/rticonnextdds-connector-go" ``` Build: ```bash $ go build reader.go ``` A dependency to the latest stable version of rticonnextdds-connector-go should be automatically added to your `go.mod` file. Run: To run your application, you need to add the Connector C library to your library path. ```bash $ export LD_LIBRARY_PATH=$GOPATH//go/pkg/mod/github.com/rticommunity/rticonnextdds-connector-go\@{version}-{YYYYMMDDHHmm}-{commit_id}/rticonnextdds-connector/lib/linux-x64:$LD_LIBRARY_PATH $ ./simple_reader ``` ### Platform support Go *Connector* builds its library for few [select architectures](https://github.com/rticommunity/rticonnextdds-connector/tree/master/lib). If you need another architecture, please contact your RTI account manager or sales@rti.com. If you want to check the version of the libraries you can run the following command: ``` bash strings ./rticonnextdds-connector/lib/linux-x64/librtiddsconnector.so | grep BUILD ``` ### Threading model The *Connector* Native API does not yet implement any mechanism for thread safety. Originally, the *Connector* native code was built to work with *RTI Prototyper* and Lua. That was a single-threaded loop. RTI then introduced support for JavaScript, Python, and Go. For now, you are responsible for protecting calls to *Connector*. Thread safety may be implemented in the future. ### Support *Connector* is an experimental RTI product. If you have questions, please use the [RTI Community Forum](https://community.rti.com/forums/technical-questions). If you would like to report a bug or have a feature request, please create an [issue](https://github.com/rticommunity/rticonnextdds-connector-go/issues). ### Documentation The best way to get started with *Connector* is to look at the examples; you will see that it is very easy to use. ### Contributing Contributions to the code, examples, documentation are really appreciated. Please follow the steps below for contributions. 1. [Sign the CLA](CONTRIBUTING.md). 1. Create a fork and make your changes. 1. Run tests and linters (make test lint). 1. Push your branch. 1. Open a new [pull request](https://github.com/rticommunity/rticonnextdds-connector-go/compare).

近期下载者

相关文件


收藏者