All Projects → aler9 → goroslib

aler9 / goroslib

Licence: MIT license
ROS client library for the Go programming language

Programming Languages

go
31211 projects - #10 most used programming language
CMake
9771 projects
C++
36643 projects - #6 most used programming language
Dockerfile
14818 projects

Projects that are alternatives of or similar to goroslib

staubli
ROS-Industrial Staubli support (http://wiki.ros.org/staubli)
Stars: ✭ 15 (-93.36%)
Mutual labels:  ros-industrial
flexgui industrial
Moved to: https://github.com/PPM-Robotics-AS/flexgui4.0
Stars: ✭ 30 (-86.73%)
Mutual labels:  ros-industrial
Universal Robots ExternalControl URCap
Example implementation of how to use ROS driver on-demand in a URCap.
Stars: ✭ 32 (-85.84%)
Mutual labels:  ros-industrial
abb librws
A C++ library for interfacing with ABB robot controllers supporting Robot Web Services
Stars: ✭ 54 (-76.11%)
Mutual labels:  ros-industrial
abb robot driver
The new ROS driver for ABB robots
Stars: ✭ 55 (-75.66%)
Mutual labels:  ros-industrial
docker
ROS-Industrial docker and cloud tools
Stars: ✭ 23 (-89.82%)
Mutual labels:  ros-industrial
ros2 examples
Examples for individual ROS2 functionalities inc. Subscribers, Publishers, Timers, Services, Parameters. ...
Stars: ✭ 46 (-79.65%)
Mutual labels:  robot-operating-system
installROS
Install ROS Melodic on NVIDIA Jetson Development Kits
Stars: ✭ 75 (-66.81%)
Mutual labels:  robot-operating-system
kuka
ROS-Industrial KUKA support (http://wiki.ros.org/kuka)
Stars: ✭ 23 (-89.82%)
Mutual labels:  ros-industrial
ZeroSimROSUnity
Robotic simulation in Unity with ROS integration.
Stars: ✭ 112 (-50.44%)
Mutual labels:  robot-operating-system
industrial calibration
Contains libraries/algorithms for calibration industrial systems
Stars: ✭ 91 (-59.73%)
Mutual labels:  ros-industrial
hybrid planning experiments
Sampler + Optimizing Motion Planning Demonstrations
Stars: ✭ 23 (-89.82%)
Mutual labels:  ros-industrial
ros webconsole
🌐 A ROS WEB console to control remotely your robot. Based with robotwebtools.
Stars: ✭ 71 (-68.58%)
Mutual labels:  ros-melodic
yak
yak (yet another kinfu) is a library and ROS wrapper for Truncated Signed Distance Fields (TSDFs).
Stars: ✭ 25 (-88.94%)
Mutual labels:  ros-industrial
abb libegm
A C++ library for interfacing with ABB robot controllers supporting Externally Guided Motion (689-1)
Stars: ✭ 71 (-68.58%)
Mutual labels:  ros-industrial
Virtual-Robot-Challenge
How-to on simulating a robot with V-REP and controlling it with ROS
Stars: ✭ 83 (-63.27%)
Mutual labels:  robot-operating-system
annotate
Create 3D labelled bounding boxes in RViz
Stars: ✭ 104 (-53.98%)
Mutual labels:  ros-melodic
motoman project
Repository for Motoman ROS applications
Stars: ✭ 50 (-77.88%)
Mutual labels:  ros-industrial
yolov4 trt ros
YOLOv4 object detector using TensorRT engine
Stars: ✭ 89 (-60.62%)
Mutual labels:  ros-melodic
uPy-rosserial
An implementation of rosserial for uPy.
Stars: ✭ 19 (-91.59%)
Mutual labels:  ros-melodic

goroslib

Test Lint Go Report Card CodeCov PkgGoDev

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 specification to make multiple programs communicate with each other over time, exchanging structured data with topics, services, actions and parameters. It was conceived to link 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).

Features:

  • publish and subscribe to topics with TCP or UDP
  • provide and call services
  • provide and call actions
  • provide and call simple actions
  • get and set parameters
  • support namespaces and relative topics
  • support IPv6 (stateful addresses only)
  • support time API
  • compilation of .msg files is not necessary, message definitions are extracted from code
  • compile or cross-compile for all Go supported OSs (Linux, Windows, Mac OS X) and architectures
  • examples provided for every feature, comprehensive test suite, continuous integration

Table of contents

Installation

  1. Install Go ≥ 1.17.

  2. Create an empty folder, open a terminal in it and initialize the Go modules system:

    go mod init main
    
  3. Download one of the example files and place it in the folder:

  4. Compile and run (a ROS master must be already running in the background)

    go run name-of-the-go-file.go
    

API Documentation

https://pkg.go.dev/github.com/aler9/goroslib#pkg-index

FAQs

Comparison with other libraries

goroslib vs official C++/Python libraries

The official project provides libraries to write nodes in C++ and Python, but they require the download of over 1GB of data and work only with a fixed buildchain. 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. Another advantage lies in the possibility of compiling nodes for all the Golang supported operating systems (Linux, Windows, Mac OS X, etc) and architectures.

goroslib vs rosgo

rosgo is currently unmaintained; furthermore, it requires compilation of .msg files, doesn't support UDP, doesn't support actions, doesn't support simulated clocks.

Full list of features

Current and missing features are described in the FEATURES document.

Use standard messages, services and actions

This library provides most of the standard messages, services and actions in the folder pkg/msgs:

package documentation repository
ackermann_msgs link link
actionlib link link
actionlib_msgs link link
audio_common_msgs link link
control_msgs link link
diagnostic_msgs link link
geometry_msgs link link
geographic_msgs link link
mavros_msgs link link
nav_msgs link link
rosgraph_msgs link link
sensor_msgs link link
shape_msgs link link
sound_play link link
std_msgs link link
std_srvs link link
stereo_msgs link link
tf link link
tf2_msgs link link
trajectory_msgs link link
uuid_msgs link link
velodyne_msgs link link
vision_msgs link link
visualization_msgs link link

Define custom messages, services and actions

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/pkg/msgs"
)

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

The type of a 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

The name of a field must be in CamelCase, and is converted to snake_case when interacting with C++/Python nodes. If this conversion is not possible, the tag rosname can be used to override the field name:

type MessageName struct {
    msg.Package `ros:"my_package"`
    Field bool  `rosname:"FIELD"`
}

Services in this format:

uint32 input
---
uint32 output

Are equivalent to Go structures in this format:

type ServiceNameReq struct {
    Input uint32
}

type ServiceNameRes struct {
	Output uint32
}

type ServiceName struct {
	msg.Package `ros:"my_package"`
	ServiceNameReq
	ServiceNameRes
}

Actions in this format:

uint32 goal
---
uint32 result
---
uint32 feedback

Are equivalent to Go structures in this format:

type ActionNameGoal struct {
	Goal uint32
}

type ActionNameResult struct {
	Result uint32
}

type ActionNameFeedback struct {
	Feedback uint32
}

type ActionName struct {
	msg.Package `ros:"my_package"`
	ActionNameGoal
	ActionNameResult
	ActionNameFeedback
}

Import existing messages, services and actions

You can convert existing .msg files into their equivalent Go structures by using the msg-import tool:

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

You can convert existing .srv files into their equivalent Go structures by using the srv-import tool:

go get github.com/aler9/goroslib/cmd/srv-import
srv-import --rospackage=my_package myservice.srv > myservice.go

You can convert existing .action files into their equivalent Go structures by using the action-import tool:

go get github.com/aler9/goroslib/cmd/action-import
action-import --rospackage=my_package myaction.action > myaction.go

Compile a node for another operating system

To compile a node for another OS, it's enough to follow the standard Golang procedure to cross-compile, that consists in setting the GOOS and GOARCH environment variables according to the target machine. For instance, to build a node for Windows from another OS, run:

GOOS=windows GOARCH=amd64 go build -o node.exe name-of-source-file.go

Edit the library

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

make test

Links

Other Go libraries

Other non-Go libraries

Standards

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].