8000 GitHub - Shanthosh1/goroslib: ROS client library for the Go programming language
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Shanthosh1/goroslib

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

90 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

goroslib

GoDoc Go Report Card Build Status

goroslib is a library in pure Go that allows to build clients (nodes) for the Robot Operating System (ROS).

The Robot Operating System (ROS) is a project that provides a protocol specification to make multiple programs communicate with each other over time, exchanging structured data through topics, services and parameters. It was conceived for linking sensors, algorithms and actuators in unmanned ground vehicles (UGVs) and robots, but it is not bounded to the robot world and can be used anywhere there's the need of building streams of data (for example in video processing).

The official project provides libraries for writing nodes in C++ and Python, but they require the download of over 1GB of data and work only through a cmake-based buildchain, that is computationally intensive and difficult to customize. This library allows to write lightweight nodes that can be built with the standard Go compiler, do not need any runtime library and have a size of some megabytes.

Features:

  • Subscribe and publish to topics
  • Call and provide services
  • Get and set parameters
  • Get infos about other nodes, topics, services
  • Compilation of .msg files is not necessary, message definitions are deducted from code
  • Standard messages are available in folder msgs/
  • Examples provided for every feature, comprehensive test suite, continuous integration

The library provides its features by implementing in pure Go all the ROS protocols (xml-rpc, TCPROS) and APIs (Master API, Parameter Server API, Slave API).

Installation

Go ≥ 1.12 is required, and modules must be enabled (there must be a go.mod file in your project folder, that can be created with the command go mod init main). To install the library, it is enough to write its name in the import section of the source files that will use it. Go will take care of downloading the needed files:

import (
    "github.com/aler9/goroslib"
)

Examples

Standard messages

Standard messages are listed in the documentation.

Custom messages

To define custom messages, the standard ROS C++/Python libraries require .msg files in this format:

bool field1
int32 field2

This library doesn't require any .msg file, it is enough to write Go structures in this format:

import (
    "github.com/aler9/goroslib/msgs"
)

type MessageName struct {
    msgs.Package `ros:"my_package"`
    Field1 bool
    Field2 int32
}

The type of a message field can be one of the following:

  • one of the primitive field types:
    • bool
    • int8
    • uint8
    • int16
    • uint16
    • int32
    • uint32
    • int64
    • uint64
    • float32
    • float64
    • string
    • time.Time
    • time.Duration
  • another standard or custom message

A command-line utility is provided to convert existing .msg files into their equivalent Go structures:

go get github.com/aler9/goroslib/commands/msg-import
msg-import --rospackage=my_package mymessage.msg

Documentation

https://godoc.org/github.com/aler9/goroslib

Testing

If you want to hack the library and test the results, unit tests can be launched with:

make test

Links

(v1) Protocol documentation

Messages

Other Go libraries

Other non-Go libraries

About

ROS client library for the Go programming language

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 93.1%
  • CMake 2.2%
  • C++ 1.4%
  • Dockerfile 1.3%
  • Shell 1.1%
  • Makefile 0.9%
0