roslibgo

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2021 License: MIT Imports: 5 Imported by: 1

README

test

roslibgo: ROS bridge client library with Go

roslibgo is the client library to connect rosbridge with Go-language.

Feature

  • Topic publishing
  • Topic subscribing
  • Service call (client)
  • Service advertisement (server)
  • reconnecting to ROS Bridge when connection is closed.
  • support concurrent programming

Installation

To install roslibgo go get github.com/otamajakusi/roslibgo

Example

See example/main.go

Documentation

Index

Constants

View Source
const AdvertiseOp = "advertise"

https://github.com/biobotus/rosbridge_suite/blob/master/ROSBRIDGE_PROTOCOL.md#341-advertise--advertise-

View Source
const PublishOp = "publish"

https://github.com/biobotus/rosbridge_suite/blob/master/ROSBRIDGE_PROTOCOL.md#343-publish--publish-

View Source
const ServiceAdvertiseOp = "advertise_service"

https://github.com/biobotus/rosbridge_suite/blob/master/ROSBRIDGE_PROTOCOL.md#347-advertise-service

View Source
const ServiceCallOp = "call_service"

https://github.com/biobotus/rosbridge_suite/blob/master/ROSBRIDGE_PROTOCOL.md#346-call-service

View Source
const ServiceResponseOp = "service_response"

https://github.com/biobotus/rosbridge_suite/blob/master/ROSBRIDGE_PROTOCOL.md#349-service-response

View Source
const ServiceUnadvertiseOp = "unadvertise_service"

https://github.com/biobotus/rosbridge_suite/blob/master/ROSBRIDGE_PROTOCOL.md#348-unadvertise-service

View Source
const SubscribeOp = "subscribe"

https://github.com/biobotus/rosbridge_suite/blob/master/ROSBRIDGE_PROTOCOL.md#344-subscribe

View Source
const UnadvertiseOp = "unadvertise"

https://github.com/biobotus/rosbridge_suite/blob/master/ROSBRIDGE_PROTOCOL.md#342-unadvertise--unadvertise-

View Source
const UnsubscribeOp = "unsubscribe"

https://github.com/biobotus/rosbridge_suite/blob/master/ROSBRIDGE_PROTOCOL.md#345-unsubscribe

Variables

View Source
var ErrNotConnected = recws.ErrNotConnected

Functions

This section is empty.

Types

type AdvertiseMessage

type AdvertiseMessage struct {
	Op    string `json:"op"`
	Id    string `json:"id,omitempty"`
	Topic string `json:"topic"`
	Type  string `json:"type"`
}

type Base

type Base struct {
	Op string `json:"op"`
	Id string `json:"id"`
}

type PublishMessage

type PublishMessage struct {
	Op    string          `json:"op"`
	Id    string          `json:"id,omitempty"`
	Topic string          `json:"topic"`
	Msg   json.RawMessage `json:"msg,omitempty"`
}

type Ros

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

func NewRos

func NewRos(url string) (*Ros, error)

func (*Ros) Run

func (ros *Ros) Run()

func (*Ros) RunForever

func (ros *Ros) RunForever()

type RosMessage

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

type RosWs

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

type Service

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

func NewService

func NewService(ros *Ros, name string, serviceType string) *Service

func (*Service) Advertise

func (service *Service) Advertise(callback ServiceCallback) error

func (*Service) Call

func (service *Service) Call(request json.RawMessage) (json.RawMessage, error)

func (*Service) Unadvertise

func (service *Service) Unadvertise() error

type ServiceAdvertise

type ServiceAdvertise struct {
	Op      string `json:"op"`
	Type    string `json:"type"`
	Service string `json:"service"`
}

type ServiceCall

type ServiceCall struct {
	Op           string          `json:"op"`
	Id           string          `json:"id,omitempty"`
	Service      string          `json:"service"`
	Args         json.RawMessage `json:"args,omitempty"`
	FragmentSize int             `json:"fragment_size,omitempty"` // not supported
	Compression  string          `json:"compression,omitempty"`   // not supported
}

type ServiceCallback

type ServiceCallback func(json.RawMessage) (bool, json.RawMessage)

type ServiceResponse

type ServiceResponse struct {
	Op      string          `json:"op"`
	Id      string          `json:"id,omitempty"`
	Service string          `json:"service"`
	Values  json.RawMessage `json:"values,omitempty"`
	Result  bool            `json:"result"`
}

type ServiceUnadvertise

type ServiceUnadvertise struct {
	Op      string `json:"op"`
	Service string `json:"service"`
}

type SubscribeMessage

type SubscribeMessage struct {
	Op           string `json:"op"`
	Id           string `json:"id,omitempty"`
	Topic        string `json:"topic"`
	Type         string `json:"type,omitempty"`
	ThrottleRate int    `json:"throttle_rate,omitempty"` //In msec
	QueueLength  int    `json:"queue_length,omitempty"`  //Default: 1
	FragmentSize int    `json:"fragment_size,omitempty"`
	Compression  string `json:"compression,omitempty"`
}

type Topic

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

func NewTopic

func NewTopic(ros *Ros, name string, messageType string) *Topic

func (*Topic) Advertise

func (topic *Topic) Advertise() error

func (*Topic) Publish

func (topic *Topic) Publish(data json.RawMessage) error

func (*Topic) Subscribe

func (topic *Topic) Subscribe(callback TopicCallback) error

func (*Topic) Unadvertise

func (topic *Topic) Unadvertise() error

func (*Topic) Unsubscribe

func (topic *Topic) Unsubscribe() error

type TopicCallback

type TopicCallback func(json.RawMessage)

type UnadvertiseMessage

type UnadvertiseMessage struct {
	Op    string `json:"op"`
	Id    string `json:"id,omitempty"`
	Topic string `json:"topic"`
}

type UnsubscribeMessage

type UnsubscribeMessage struct {
	Op    string `json:"op"`
	Id    string `json:"id,omitempty"`
	Topic string `json:"topic"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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