goroslib

package module
Version: v0.0.0-...-776bf07 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 29, 2021 License: MIT Imports: 26 Imported by: 0

README

goroslib

Test Lint 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:

  • Subscribe and publish to topics, with TCP or UDP
  • Provide and call services
  • Provide and call actions and simple actions
  • Get and set parameters
  • Get infos about other nodes, topics, services
  • Use namespaces and relative topics
  • Use a time API to synchronize execution with a real or simulated clock
  • Support IPv6 (only stateful addresses, since stateless are not supported by the ROS master)
  • Compilation of .msg files is not necessary, message definitions are extracted from code
  • Compile or cross-compile ROS nodes for all Golang 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.14.

  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/ROBTTO/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/ROBTTO/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

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

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

Another one is provided to convert existing .srv files into their equivalent Go structures:

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

Another one is provided to convert existing .action files into their equivalent Go structures:

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

There's a field Namespace in the Node configuration:

goroslib.NewNode(goroslib.NodeConf{
    Namespace:     "/mynamespace",
    Name:          "goroslib",
    MasterAddress: "127.0.0.1:11311",
})

The default namespace is / (global namespace).

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

(v1) ROS Documentation

Other Go libraries

Other non-Go libraries

Conventions

Documentation

Overview

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

Basic example (more are available at https://github.com/ROBTTO/goroslib/tree/master/examples):

package main

import (
    "fmt"
    "github.com/ROBTTO/goroslib"
    "github.com/ROBTTO/goroslib/pkg/msgs/sensor_msgs"
)

func onMessage(msg *sensor_msgs.Imu) {
    fmt.Printf("Incoming: %+v\n", msg)
}

func main() {
    n, err := goroslib.NewNode(goroslib.NodeConf{
        Name:          "goroslib",
        MasterAddress: "127.0.0.1:11311",
    })
    if err != nil {
        panic(err)
    }
    defer n.Close()

    sub, err := goroslib.NewSubscriber(goroslib.SubscriberConf{
        Node:     n,
        Topic:    "test_topic",
        Callback: onMessage,
    })
    if err != nil {
        panic(err)
    }
    defer sub.Close()

    select {}
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionClient

type ActionClient struct {
	// contains filtered or unexported fields
}

ActionClient is a ROS action client, an entity that can call actions.

func NewActionClient

func NewActionClient(conf ActionClientConf) (*ActionClient, error)

NewActionClient allocates an ActionClient. See ActionClientConf for the options.

func (*ActionClient) CancelAllGoals

func (ac *ActionClient) CancelAllGoals()

CancelAllGoals cancels all goals running on the server.

func (*ActionClient) Close

func (ac *ActionClient) Close() error

Close closes an ActionClient and shuts down all its operations.

func (*ActionClient) SendGoal

SendGoal sends a goal.

func (*ActionClient) WaitForServer

func (ac *ActionClient) WaitForServer()

WaitForServer waits for the action server to start.

type ActionClientCommState

type ActionClientCommState int

ActionClientCommState is the communication state of the goal of an action client.

const (
	ActionClientCommStateWaitingForGoalAck ActionClientCommState = iota
	ActionClientCommStatePending
	ActionClientCommStateActive
	ActionClientCommStateWaitingForResult
	ActionClientCommStateWaitingForCancelAck
	ActionClientCommStateRecalling
	ActionClientCommStatePreempting
	ActionClientCommStateDone
	ActionClientCommStateLost
)

standard goal communication states.

func (ActionClientCommState) String

func (s ActionClientCommState) String() string

String implements fmt.Stringer.

type ActionClientConf

type ActionClientConf struct {
	// parent node.
	Node *Node

	// name of the action.
	Name string

	// an instance of the action type.
	Action interface{}
}

ActionClientConf is the configuration of an ActionClient.

type ActionClientGoalConf

type ActionClientGoalConf struct {
	// the goal to send.
	Goal interface{}

	// (optional) function in the form func(*ActionClientGoalHandler, *ActionResult)
	// that will be called when a status transition happens.
	OnTransition interface{}

	// (optional) function in the form func(*ActionFeedback) that will be called
	// when a feedback is received.
	OnFeedback interface{}
}

ActionClientGoalConf is the configuration of SendGoal().

type ActionClientGoalHandler

type ActionClientGoalHandler struct {
	// contains filtered or unexported fields
}

ActionClientGoalHandler is a goal handler of an ActionClient.

func (*ActionClientGoalHandler) Cancel

func (gh *ActionClientGoalHandler) Cancel()

Cancel cancels the goal.

func (*ActionClientGoalHandler) CommState

CommState returns the communication state of the goal handler.

func (*ActionClientGoalHandler) TerminalState

TerminalState returns the terminal state of the goal handler.

type ActionClientTerminalState

type ActionClientTerminalState int

ActionClientTerminalState is the terminal state of the goal of an action client.

func (ActionClientTerminalState) String

func (s ActionClientTerminalState) String() string

String implements fmt.Stringer.

type ActionServer

type ActionServer struct {
	// contains filtered or unexported fields
}

ActionServer is a ROS action server, an entity that can provide actions.

func NewActionServer

func NewActionServer(conf ActionServerConf) (*ActionServer, error)

NewActionServer allocates an ActionServer. See ActionServerConf for the options.

func (*ActionServer) Close

func (as *ActionServer) Close() error

Close closes an ActionServer and shuts down all its operations.

type ActionServerConf

type ActionServerConf struct {
	// parent node.
	Node *Node

	// name of the action.
	Name string

	// an instance of the action type.
	Action interface{}

	// (optional) status messages are published with this period.
	// It defaults to 200 ms.
	StatusPeriod time.Duration

	// (optional) goals are deleted after this duration.
	// It defaults to 5 secs.
	DeleteGoalAfter time.Duration

	// (optional) function in the form func(*ActionServerGoalHandler, *ActionGoal) that will be called
	// whenever a goal arrives.
	OnGoal interface{}

	// (optional) function in the form func(*ActionServerGoalHandler) that will be called
	// whenever a goal cancellation request arrives.
	OnCancel func(gh *ActionServerGoalHandler)
}

ActionServerConf is the configuration of an ActionServer.

type ActionServerGoalHandler

type ActionServerGoalHandler struct {
	// contains filtered or unexported fields
}

ActionServerGoalHandler is a goal handler of an ActionServer.

func (*ActionServerGoalHandler) PublishFeedback

func (gh *ActionServerGoalHandler) PublishFeedback(fb interface{})

PublishFeedback publishes a feedback about the goal,

func (*ActionServerGoalHandler) SetAborted

func (gh *ActionServerGoalHandler) SetAborted(res interface{})

SetAborted sets the goal as aborted.

func (*ActionServerGoalHandler) SetAccepted

func (gh *ActionServerGoalHandler) SetAccepted()

SetAccepted sets the goal as accepted.

func (*ActionServerGoalHandler) SetCanceled

func (gh *ActionServerGoalHandler) SetCanceled(res interface{})

SetCanceled sets the goal as canceled.

func (*ActionServerGoalHandler) SetRejected

func (gh *ActionServerGoalHandler) SetRejected(res interface{})

SetRejected sets the goal as rejected.

func (*ActionServerGoalHandler) SetSucceeded

func (gh *ActionServerGoalHandler) SetSucceeded(res interface{})

SetSucceeded sets the goal as succeeded.

type ActionServerGoalState

type ActionServerGoalState int

ActionServerGoalState is the state of the goal of an action server.

func (ActionServerGoalState) String

func (s ActionServerGoalState) String() string

String implements fmt.Stringer.

type InfoConnection

type InfoConnection struct {
	ID        int
	To        string
	Direction byte
	Transport string
	Topic     string
	Connected bool
}

InfoConnection contains information about a connection.

type InfoNode

type InfoNode struct {
	PublishedTopics  map[string]struct{}
	SubscribedTopics map[string]struct{}
	ProvidedServices map[string]struct{}
	Address          string
}

InfoNode contains informations about a node.

type InfoService

type InfoService struct {
	Providers map[string]struct{}
	Address   string
}

InfoService contains informations about a service.

type InfoTopic

type InfoTopic struct {
	Type        string
	Publishers  map[string]struct{}
	Subscribers map[string]struct{}
}

InfoTopic contains informations about a topic.

type Node

type Node struct {
	// contains filtered or unexported fields
}

Node is a ROS Node, an entity that can create subscribers, publishers, service providers and service clients.

func NewNode

func NewNode(conf NodeConf) (*Node, error)

NewNode allocates a Node. See NodeConf for the options.

func (*Node) Close

func (n *Node) Close() error

Close closes a Node and all its resources.

func (*Node) MasterGetMachines

func (n *Node) MasterGetMachines() (map[string]struct{}, error)

MasterGetMachines returns all the machines connected to the master with a node.

func (*Node) MasterGetNodes

func (n *Node) MasterGetNodes() (map[string]*InfoNode, error)

MasterGetNodes returns all the nodes connected to the master.

func (*Node) MasterGetServices

func (n *Node) MasterGetServices() (map[string]*InfoService, error)

MasterGetServices returns all the services provided by nodes connected to the server.

func (*Node) MasterGetTopics

func (n *Node) MasterGetTopics() (map[string]*InfoTopic, error)

MasterGetTopics returns all the topics published by nodes connected to the master.

func (*Node) NodeGetConns

func (n *Node) NodeGetConns(nodeName string) ([]InfoConnection, error)

NodeGetConns returns infos about connections of a node.

func (*Node) NodeKill

func (n *Node) NodeKill(nodeName string) error

NodeKill sends a kill request to a given node.

func (*Node) NodePing

func (n *Node) NodePing(nodeName string) (time.Duration, error)

NodePing sends a ping request to a given node, wait for the response and returns the elapsed time.

func (*Node) ParamGetBool

func (n *Node) ParamGetBool(key string) (bool, error)

ParamGetBool returns a bool parameter from the master.

func (*Node) ParamGetDouble

func (n *Node) ParamGetDouble(key string) (float64, error)

ParamGetDouble returns an double parameter from the master.

func (*Node) ParamGetInt

func (n *Node) ParamGetInt(key string) (int, error)

ParamGetInt returns an int parameter from the master.

func (*Node) ParamGetString

func (n *Node) ParamGetString(key string) (string, error)

ParamGetString returns a string parameter from the master.

func (*Node) ParamIsSet

func (n *Node) ParamIsSet(key string) (bool, error)

ParamIsSet returns whether a parameter is set into the master.

func (*Node) ParamSetBool

func (n *Node) ParamSetBool(key string, val bool) error

ParamSetBool sets a bool parameter in the master.

func (*Node) ParamSetDouble

func (n *Node) ParamSetDouble(key string, val float64) error

ParamSetDouble sets an double parameter in the master.

func (*Node) ParamSetInt

func (n *Node) ParamSetInt(key string, val int) error

ParamSetInt sets an int parameter in the master.

func (*Node) ParamSetString

func (n *Node) ParamSetString(key string, val string) error

ParamSetString sets a string parameter in the master.

func (*Node) TimeNow

func (n *Node) TimeNow() time.Time

TimeNow returns the current time. It supports simulated clocks provided by ROS clock servers.

func (*Node) TimeRate

func (n *Node) TimeRate(d time.Duration) *NodeRate

TimeRate returns an object that can be used to sleep periodically. It supports simulated clocks provided by ROS clock servers.

func (*Node) TimeSleep

func (n *Node) TimeSleep(d time.Duration)

TimeSleep sleeps for the given amount of time. It supports simulated clocks provided by ROS clock servers.

type NodeConf

type NodeConf struct {
	// (optional) hostname (or ip) and port of the master node.
	// It defaults to 127.0.0.1:11311
	MasterAddress string

	// (optional) namespace of this node.
	// It defaults to '/' (global namespace).
	Namespace string

	// name of this node.
	Name string

	// (optional) hostname or ip of this node, needed by other nodes
	// in order to communicate with it.
	// if not provided, it will be set automatically.
	Host string

	// (optional) port of the Slave API server of this node.
	// if not provided, it will be chosen automatically.
	ApislavePort int

	// (optional) port of the TCPROS server of this node.
	// if not provided, it will be chosen automatically.
	TcprosPort int

	// (optional) port of the UDPROS server of this node.
	// if not provided, it will be chosen automatically.
	UdprosPort int
}

NodeConf is the configuration of a Node.

type NodeRate

type NodeRate struct {
	// contains filtered or unexported fields
}

NodeRate allows to sleep with a given period.

func (*NodeRate) Sleep

func (nr *NodeRate) Sleep()

Sleep sleeps with a given period. It supports simulated clocks provided by ROS clock servers.

type Protocol

type Protocol int

Protocol is a ROS stream protocol.

const (
	// TCP is the TCPROS protocol.
	TCP Protocol = iota

	// UDP is the UDPROS protocol.
	UDP
)

type Publisher

type Publisher struct {
	// contains filtered or unexported fields
}

Publisher is a ROS publisher, an entity that can publish messages in a named channel.

func NewPublisher

func NewPublisher(conf PublisherConf) (*Publisher, error)

NewPublisher allocates a Publisher. See PublisherConf for the options.

func (*Publisher) Close

func (p *Publisher) Close() error

Close closes a Publisher and shuts down all its operations.

func (*Publisher) Write

func (p *Publisher) Write(msg interface{})

Write writes a message into the publisher.

type PublisherConf

type PublisherConf struct {
	// parent node.
	Node *Node

	// name of the topic in which messages will be written
	Topic string

	// an instance of the message that will be published
	Msg interface{}

	// (optional) whether to enable latching, that consists in saving the last
	// published message and send it to any new subscriber that connects to
	// this publisher
	Latch bool
	// contains filtered or unexported fields
}

PublisherConf is the configuration of a Publisher.

type ServiceClient

type ServiceClient struct {
	// contains filtered or unexported fields
}

ServiceClient is a ROS service client, an entity that can send requests to service providers and receive responses.

func NewServiceClient

func NewServiceClient(conf ServiceClientConf) (*ServiceClient, error)

NewServiceClient allocates a ServiceClient. See ServiceClientConf for the options.

func (*ServiceClient) Call

func (sc *ServiceClient) Call(req interface{}, res interface{}) error

Call sends a request to a service provider and reads a response.

func (*ServiceClient) Close

func (sc *ServiceClient) Close() error

Close closes a ServiceClient and shuts down all its operations.

type ServiceClientConf

type ServiceClientConf struct {
	// parent node.
	Node *Node

	// name of the service from which providers will be obtained.
	Name string

	// an instance of the service type.
	Srv interface{}

	// (optional) enable keep-alive packets, that are
	// useful when there's a firewall between nodes.
	EnableKeepAlive bool
}

ServiceClientConf is the configuration of a ServiceClient.

type ServiceProvider

type ServiceProvider struct {
	// contains filtered or unexported fields
}

ServiceProvider is a ROS service provider, an entity that can receive requests and send back responses.

func NewServiceProvider

func NewServiceProvider(conf ServiceProviderConf) (*ServiceProvider, error)

NewServiceProvider allocates a ServiceProvider. See ServiceProviderConf for the options.

func (*ServiceProvider) Close

func (sp *ServiceProvider) Close() error

Close closes a ServiceProvider and shuts down all its operations.

type ServiceProviderConf

type ServiceProviderConf struct {
	// parent node.
	Node *Node

	// name of the service.
	Name string

	// an instance of the service type.
	Srv interface{}

	// function in the form func(*NameOfRequest) *NameOfReply{}  that will be called
	// whenever a request arrives.
	Callback interface{}
}

ServiceProviderConf is the configuration of a ServiceProvider.

type SimpleActionClient

type SimpleActionClient struct {
	// contains filtered or unexported fields
}

SimpleActionClient is a ROS simple action client, an entity that can call simple actions.

func NewSimpleActionClient

func NewSimpleActionClient(conf SimpleActionClientConf) (*SimpleActionClient, error)

NewSimpleActionClient allocates a SimpleActionClient.

func (*SimpleActionClient) CancelAllGoals

func (sac *SimpleActionClient) CancelAllGoals()

CancelAllGoals cancels all goals running on the server.

func (*SimpleActionClient) CancelGoal

func (sac *SimpleActionClient) CancelGoal()

CancelGoal cancels the current goal.

func (*SimpleActionClient) Close

func (sac *SimpleActionClient) Close() error

Close closes a SimpleActionClient.

func (*SimpleActionClient) SendGoal

SendGoal sends a goal.

func (*SimpleActionClient) WaitForServer

func (sac *SimpleActionClient) WaitForServer()

WaitForServer waits for the action server to start.

type SimpleActionClientConf

type SimpleActionClientConf struct {
	// parent node.
	Node *Node

	// name of the action.
	Name string

	// an instance of the action type.
	Action interface{}
}

SimpleActionClientConf is the configuration of a SimpleActionClient.

type SimpleActionClientGoalConf

type SimpleActionClientGoalConf struct {
	// the goal to send.
	Goal interface{}

	// (optional) function in the form func(*ActionResult) that will be called
	// when the goal is done.
	OnDone interface{}

	// (optional) function that will be called when the goal becomes active.
	OnActive func()

	// (optional) function in the form func(*ActionFeedbacK) that will be
	// called when a feedback arrives.
	OnFeedback interface{}
}

SimpleActionClientGoalConf is the configuration of SendGoal().

type SimpleActionClientGoalState

type SimpleActionClientGoalState int

SimpleActionClientGoalState is the state of a goal of a simple action client.

const (
	SimpleActionClientGoalStatePending SimpleActionClientGoalState = iota
	SimpleActionClientGoalStateActive
	SimpleActionClientGoalStateRecalled
	SimpleActionClientGoalStateRejected
	SimpleActionClientGoalStatePreempted
	SimpleActionClientGoalStateAborted
	SimpleActionClientGoalStateSucceeded
	SimpleActionClientGoalStateLost
)

standard goal states.

type SimpleActionServer

type SimpleActionServer struct {
	// contains filtered or unexported fields
}

SimpleActionServer is a ROS simple action server, an entity that can provide actions.

func NewSimpleActionServer

func NewSimpleActionServer(conf SimpleActionServerConf) (*SimpleActionServer, error)

NewSimpleActionServer allocates a SimpleActionServer.

func (*SimpleActionServer) Close

func (sas *SimpleActionServer) Close() error

Close closes a SimpleActionServer.

func (*SimpleActionServer) IsPreemptRequested

func (sas *SimpleActionServer) IsPreemptRequested() bool

IsPreemptRequested checks whether the goal has been canceled.

func (*SimpleActionServer) PublishFeedback

func (sas *SimpleActionServer) PublishFeedback(fb interface{})

PublishFeedback publishes a feedback about the current goal. This can be called only from an OnExecute callback.

func (*SimpleActionServer) SetAborted

func (sas *SimpleActionServer) SetAborted(res interface{})

SetAborted sets the current goal as aborted. This can be called only from an OnExecute callback.

func (*SimpleActionServer) SetSucceeded

func (sas *SimpleActionServer) SetSucceeded(res interface{})

SetSucceeded sets the current goal as succeeded. This can be called only from an OnExecute callback.

type SimpleActionServerConf

type SimpleActionServerConf struct {
	// parent node.
	Node *Node

	// name of the action.
	Name string

	// an instance of the action type.
	Action interface{}

	// (optional) function in the form func(*ActionGoal) that will be
	// called when a goal arrives.
	OnExecute interface{}
}

SimpleActionServerConf is the configuration of a SimpleActionServer.

type Subscriber

type Subscriber struct {
	// contains filtered or unexported fields
}

Subscriber is a ROS subscriber, an entity that can receive messages from a named channel.

func NewSubscriber

func NewSubscriber(conf SubscriberConf) (*Subscriber, error)

NewSubscriber allocates a Subscriber. See SubscriberConf for the options.

func (*Subscriber) Close

func (s *Subscriber) Close() error

Close closes a Subscriber and shuts down all its operations.

type SubscriberConf

type SubscriberConf struct {
	// parent node.
	Node *Node

	// name of the topic from which messages will be read.
	Topic string

	// function in the form func(msg *NameOfMessage) that will be called
	// whenever a message arrives.
	Callback interface{}

	// (optional) protocol that will be used to receive messages
	// it defaults to TCP.
	Protocol Protocol

	// (optional) queue size. If the Callback is too slow, the queue fills up,
	// and newer messages are discarded.
	// It defaults to zero (wait the Callback synchronously).
	QueueSize uint

	// (optional) enable keep-alive packets, that are
	// useful when there's a firewall between nodes.
	EnableKeepAlive bool

	// (optional) if protocol is TCP, disables the TCP_NODELAY flag, which
	// is enabled by default.
	// It defaults to false.
	DisableNoDelay bool
	// contains filtered or unexported fields
}

SubscriberConf is the configuration of a Subscriber.

Directories

Path Synopsis
cmd
examples
pkg
actionproc
Package actionproc contains functions to process actions.
Package actionproc contains functions to process actions.
apimaster
Package apimaster implements the Master API.
Package apimaster implements the Master API.
apiparam
Package apiparam implements the Parameter API.
Package apiparam implements the Parameter API.
apislave
Package apislave implements the Slave API.
Package apislave implements the Slave API.
msg
Package msg contains elements that are used to define messages.
Package msg contains elements that are used to define messages.
msgconv
Package msgconv contains functions to convert messages from ROS definitions to Golang.
Package msgconv contains functions to convert messages from ROS definitions to Golang.
msgproc
Package msgproc contains functions to process messages.
Package msgproc contains functions to process messages.
msgs
Package msgs contains the autogenerated standard messages.
Package msgs contains the autogenerated standard messages.
msgs/ackermann_msgs
Package ackermann_msgs contains message definitions (autogenerated).
Package ackermann_msgs contains message definitions (autogenerated).
msgs/actionlib
Package actionlib contains message definitions (autogenerated).
Package actionlib contains message definitions (autogenerated).
msgs/actionlib_msgs
Package actionlib_msgs contains message definitions (autogenerated).
Package actionlib_msgs contains message definitions (autogenerated).
msgs/audio_common_msgs
Package audio_common_msgs contains message definitions (autogenerated).
Package audio_common_msgs contains message definitions (autogenerated).
msgs/control_msgs
Package control_msgs contains message definitions (autogenerated).
Package control_msgs contains message definitions (autogenerated).
msgs/diagnostic_msgs
Package diagnostic_msgs contains message definitions (autogenerated).
Package diagnostic_msgs contains message definitions (autogenerated).
msgs/geographic_msgs
Package geographic_msgs contains message definitions (autogenerated).
Package geographic_msgs contains message definitions (autogenerated).
msgs/geometry_msgs
Package geometry_msgs contains message definitions (autogenerated).
Package geometry_msgs contains message definitions (autogenerated).
msgs/mavros_msgs
Package mavros_msgs contains message definitions (autogenerated).
Package mavros_msgs contains message definitions (autogenerated).
msgs/nav_msgs
Package nav_msgs contains message definitions (autogenerated).
Package nav_msgs contains message definitions (autogenerated).
msgs/rosgraph_msgs
Package rosgraph_msgs contains message definitions (autogenerated).
Package rosgraph_msgs contains message definitions (autogenerated).
msgs/sensor_msgs
Package sensor_msgs contains message definitions (autogenerated).
Package sensor_msgs contains message definitions (autogenerated).
msgs/shape_msgs
Package shape_msgs contains message definitions (autogenerated).
Package shape_msgs contains message definitions (autogenerated).
msgs/sound_play
Package sound_play contains message definitions (autogenerated).
Package sound_play contains message definitions (autogenerated).
msgs/std_msgs
Package std_msgs contains message definitions (autogenerated).
Package std_msgs contains message definitions (autogenerated).
msgs/std_srvs
Package std_srvs contains message definitions (autogenerated).
Package std_srvs contains message definitions (autogenerated).
msgs/stereo_msgs
Package stereo_msgs contains message definitions (autogenerated).
Package stereo_msgs contains message definitions (autogenerated).
msgs/tf
Package tf contains message definitions (autogenerated).
Package tf contains message definitions (autogenerated).
msgs/tf2_msgs
Package tf2_msgs contains message definitions (autogenerated).
Package tf2_msgs contains message definitions (autogenerated).
msgs/trajectory_msgs
Package trajectory_msgs contains message definitions (autogenerated).
Package trajectory_msgs contains message definitions (autogenerated).
msgs/uuid_msgs
Package uuid_msgs contains message definitions (autogenerated).
Package uuid_msgs contains message definitions (autogenerated).
msgs/velodyne_msgs
Package velodyne_msgs contains message definitions (autogenerated).
Package velodyne_msgs contains message definitions (autogenerated).
msgs/vision_msgs
Package vision_msgs contains message definitions (autogenerated).
Package vision_msgs contains message definitions (autogenerated).
msgs/visualization_msgs
Package visualization_msgs contains message definitions (autogenerated).
Package visualization_msgs contains message definitions (autogenerated).
protocommon
Package protocommon contains functions and definitions for both TCPROS and UDPROS.
Package protocommon contains functions and definitions for both TCPROS and UDPROS.
prototcp
Package prototcp implements the TCPROS protocol.
Package prototcp implements the TCPROS protocol.
protoudp
Package protoudp implements the UDPROS protocol.
Package protoudp implements the UDPROS protocol.
serviceproc
Package serviceproc contains functions to process services.
Package serviceproc contains functions to process services.
xmlrpc
Package xmlrpc implements the XML-RPC protocol, in a variant fit for ROS.
Package xmlrpc implements the XML-RPC protocol, in a variant fit for ROS.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL