ros

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2023 License: MIT Imports: 22 Imported by: 0

Documentation

Overview

Connection header

Index

Constants

View Source
const (
	Sep       = "/"
	GlobalNS  = "/"
	PrivateNS = "~"
)
View Source
const (
	APIStatusError   = -1
	APIStatusFailure = 0
	APIStatusSuccess = 1
	Remap            = ":="
)
View Source
const BufferSize = 1024

Variables

This section is empty.

Functions

This section is empty.

Types

type Duration

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

func NewDuration

func NewDuration(sec uint32, nsec uint32) Duration

func (*Duration) Add

func (d *Duration) Add(other Duration) Duration

func (*Duration) Cmp

func (d *Duration) Cmp(other Duration) int

func (*Duration) FromNSec

func (t *Duration) FromNSec(nsec uint64)

func (*Duration) FromSec

func (t *Duration) FromSec(sec float64)

func (*Duration) IsZero

func (t *Duration) IsZero() bool

func (*Duration) Normalize

func (t *Duration) Normalize()

func (*Duration) Sleep

func (d *Duration) Sleep() error

func (*Duration) Sub

func (d *Duration) Sub(other Duration) Duration

func (*Duration) ToNSec

func (t *Duration) ToNSec() uint64

func (*Duration) ToSec

func (t *Duration) ToSec() float64

type Message

type Message interface {
	GetType() MessageType
	Serialize(buf *bytes.Buffer) error
	Deserialize(buf *Reader) error
}

type MessageEvent

type MessageEvent struct {
	PublisherName    string
	ReceiptTime      time.Time
	ConnectionHeader map[string]string
}

MessageEvent is an optional second argument to a Subscriber callback.

type MessageType

type MessageType interface {
	Text() string
	MD5Sum() string
	Name() string
	NewMessage() Message
}

type NameMap

type NameMap map[string]string

type NameResolver

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

type Node

type Node interface {

	// NewPublisher creates a publisher for specified topic and message type.
	// @queueSize 队列长队,暂未实现
	// @latch 订阅后是否接收最后一帧数据
	NewPublisher(topic string, msgType MessageType, queueSize int, latch bool) Publisher

	// NewPublisherWithCallbacks creates a publisher which gives you callbacks when subscribers
	// connect and disconnect.  The callbacks are called in their own
	// goroutines, so they don't need to return immediately to let the
	// connection proceed.
	NewPublisherWithCallbacks(topic string, msgType MessageType, connectCallback, disconnectCallback func(SingleSubscriberPublisher), latch bool) Publisher

	// NewSubscriber creates a subscriber to specified topic, where
	// the messages are of a given type. callback should be a function
	// which takes 0, 1, or 2 arguments.If it takes 0 arguments, it will
	// simply be called without the message.  1-argument functions are
	// the normal case, and the argument should be of the generated message type.
	// If the function takes 2 arguments, the first argument should be of the
	// generated message type and the second argument should be of type MessageEvent.
	NewSubscriber(topic string, queueSize int, msgType MessageType, callback interface{}) Subscriber
	NewServiceClient(service string, srvType ServiceType, options ...ServiceClientOption) ServiceClient
	NewServiceServer(service string, srvType ServiceType, callback interface{}, options ...ServiceServerOption) ServiceServer

	TopicList(subgraph string) []Topic

	OK() bool
	SpinOnce()
	Spin()
	Shutdown()

	GetParam(name string) (interface{}, error)
	SetParam(name string, value interface{}) error
	HasParam(name string) (bool, error)
	SearchParam(name string) (string, error)
	DeleteParam(name string) error

	NonRosArgs() []string
	Name() string
}

Node defines interface for a ros node

func NewNode

func NewNode(name string, args []string, opts ...NodeOption) (Node, error)

type NodeOption

type NodeOption func(n *defaultNode)

NodeOption allows to customize created nodes.

func NodeServiceClientOptions

func NodeServiceClientOptions(opts ...ServiceClientOption) NodeOption

NodeServiceClientOptions specifies default options applied to the service clients created in this node.

func NodeServiceServerOptions

func NodeServiceServerOptions(opts ...ServiceServerOption) NodeOption

NodeServiceServerOptions specifies default options applied to the service servers created in this node.

type Publisher

type Publisher interface {
	Publish(msg Message)
	GetMessageType() MessageType
	GetNumSubscribers() int
	Shutdown()
}

type Rate

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

Impelement Rate interface

func NewRate

func NewRate(frequency float64) Rate

func (*Rate) Reset

func (r *Rate) Reset()

func (*Rate) Sleep

func (r *Rate) Sleep() error

type Reader

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

Reader implements io.Reader interface and provides a no-copy way to read N bytes via Next() method. Reader is used by generated message to de-serialize byte arrays ([]uint8) without/ copying underlying data.

func NewReader

func NewReader(s []byte) *Reader

NewReader creates new Reader and adopts the byte slice. The caller must not modify the slice after this call.

func (*Reader) Len

func (r *Reader) Len() int

Let implements the length remaining in the buffer

func (*Reader) Next

func (r *Reader) Next(n int) []byte

Next returns a slice containing the next n bytes from the buffer, advancing the buffer as if the bytes had been returned by Read. The resulting slice is a sub-slice of the original slice.

Asking for more bytes than available would returns only the remaining bytes. Calling Next on an empty buffer, or after the buffer has been exhausted, returns an empty slice.

func (*Reader) Read

func (r *Reader) Read(b []byte) (n int, err error)

Read implements the io.Reader interface. Like the other reader implementations, this implementation copies data from the original slice into "b".

type Service

type Service interface {
	ReqMessage() Message
	ResMessage() Message
}

type ServiceClient

type ServiceClient interface {
	Call(srv Service) error
	Shutdown()
}

type ServiceClientOption

type ServiceClientOption func(c *defaultServiceClient)

ServiceClientOption customizes service client instances.

func ServiceClientTCPTimeout

func ServiceClientTCPTimeout(t time.Duration) ServiceClientOption

ServiceClientTCPTimeout changes default timeout of 10ms to the specified timeout. This timeout is applied to each TCP operation (such as writing header to the connection, reading response header, etc), rather than TCP connection as a whole. Total timeout is dependent on the number of operations.

type ServiceFactory

type ServiceFactory interface {
	Name() string
	MD5Sum() string
}

type ServiceHandler

type ServiceHandler interface{}

type ServiceServer

type ServiceServer interface {
	Shutdown()
}

type ServiceServerOption

type ServiceServerOption func(c *defaultServiceServer)

ServiceServerOption customizes service server instances.

func ServiceServerTCPTimeout

func ServiceServerTCPTimeout(t time.Duration) ServiceServerOption

ServiceServerTCPTimeout changes default timeout of 10ms to the specified timeout. This timeout is applied to each TCP operation (such as writing header to the connection, reading response header, etc), rather than TCP connection as a whole. Total timeout is dependent on the number of operations.

type ServiceType

type ServiceType interface {
	MD5Sum() string
	Name() string
	RequestType() MessageType
	ResponseType() MessageType
	NewService() Service
}

type SingleSubscriberPublisher

type SingleSubscriberPublisher interface {
	Publish(msg Message)
	GetSubscriberName() string
	GetTopic() string
}

SingleSubscriberPublisher is a publisher which only sends to one specific subscriber. This is sent as an argument to the connect and disconnect callback functions passed to Node.NewPublisherWithCallbacks().

type Subscriber

type Subscriber interface {
	GetNumPublishers() int
	Shutdown()
}

type Time

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

func NewTime

func NewTime(sec uint32, nsec uint32) Time

func Now

func Now() Time

func (*Time) Add

func (t *Time) Add(d Duration) Time

func (*Time) Cmp

func (t *Time) Cmp(other Time) int

func (*Time) Diff

func (t *Time) Diff(from Time) Duration

func (*Time) FromNSec

func (t *Time) FromNSec(nsec uint64)

func (*Time) FromSec

func (t *Time) FromSec(sec float64)

func (*Time) IsZero

func (t *Time) IsZero() bool

func (*Time) Normalize

func (t *Time) Normalize()

func (*Time) Sub

func (t *Time) Sub(d Duration) Time

func (*Time) ToNSec

func (t *Time) ToNSec() uint64

func (*Time) ToSec

func (t *Time) ToSec() float64

type Topic

type Topic struct {
	Name     string
	TypeName string
}

Jump to

Keyboard shortcuts

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