lcm

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2023 License: LGPL-2.1 Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LCM

type LCM struct {
	Errors chan error // Errors when handling incoming LCM messages
	// contains filtered or unexported fields
}

LCM is a wrapper type for all things LCM.

func New

func New() (LCM, error)

New returns a new LCM instance using the default provider as defined in the C interface. In case of a failure, an error is returned.

func NewProvider added in v1.5.0

func NewProvider(provider string) (LCM, error)

NewProvider returns a new LCM instance using the specified provider. In case of a failure, an error is returned.

func (*LCM) Destroy

func (lcm *LCM) Destroy() error

Destroy destroys an LCM object, so that it can be picked up by the garbage collector. This method also unsubscribes to all channels that lcm previously subscribed to.

func (LCM) Publisher

func (lcm LCM) Publisher(channel string) (chan<- []byte, <-chan error)

Publisher returns a channel that the caller can send data to, which is sent out to the channel passed as the argument. Furthermoe, an error channel is returned that allows the caller to listen for and handle any errors.

func (LCM) Subscribe

func (lcm LCM) Subscribe(channel string, size int) (Subscription, error)

Subscribe subscribes to an LCM channel with the given buffer size. Whenever an incoming message is handled by LCM the encoded data is sent in the form of a []byte down the ReceiveChan member of the returned Subscription.

func (LCM) Unsubscribe

func (lcm LCM) Unsubscribe(subscription Subscription) error

Unsubscribe removes an Subscription from an LCM object.

func (LCM) UnsubscribeAll

func (lcm LCM) UnsubscribeAll() error

UnsubscribeAll removes all Subscriptions from an LCM object.

type Subscription

type Subscription struct {
	ReceiveChan chan []byte // Channel on which messages to the subscribed channel are forwarded
	Drops       int         // The number of dropped packages so far
	// contains filtered or unexported fields
}

Subscription is a wrapper type for a subscription to an LCM channel.

func (Subscription) Channel

func (subscription Subscription) Channel() string

Channel returns the LCM channel name of the subscription.

Jump to

Keyboard shortcuts

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