actionlib

package
v0.0.0-...-bcec6a9 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

README

actionlib [WIP]

Package Summary

A pure go implementation for ROS action library built on top of ROSGO. This package is unstable and the API can change in future.

Prerequisites

This library uses messages GoalID, GoalStatus and GoalStatusArray from actionlib_msgs package. Please generate Go code for the messages in actionlib_msgs package and place them in your $GOPATH/src.

Use the following commands after install gengo.

gengo -out=$GOPATH/src msg actionlib_msgs/GoalID
gengo -out=$GOPATH/src msg actionlib_msgs/GoalStatus
gengo -out=$GOPATH/src msg actionlib_msgs/GoalStatusArray

Status

This package implements all the features of actionlib library but is still very unstable and is still a work in progress to fix known issues and make this packge more robust. Following are the features that are implemented and what's to be added in the future.

Implemented
  • Action Client
  • Action Server
  • Simple Action Client
  • Simple Action Server
  • Client Goal Handler
  • Server Goal Handler
  • Go code generation from action definitons
To Be Added
  • Tests
  • Documentation
  • Fix for golint issues
  • Go mod

How To Use

Examples of client and server usage can be found in rosgo/test folder.

Documentation

Index

Constants

View Source
const (
	SimpleStatePending uint8 = 0
	SimpleStateActive  uint8 = 1
	SimpleStateDone    uint8 = 2
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action interface {
	GetActionGoal() ActionGoal
	GetActionFeedback() ActionFeedback
	GetActionResult() ActionResult
}

type ActionClient

type ActionClient interface {
	WaitForServer(timeout ros.Duration) bool
	SendGoal(goal ros.Message, transitionCallback interface{}, feedbackCallback interface{}) ClientGoalHandler
	CancelAllGoals()
	CancelAllGoalsBeforeTime(stamp ros.Time)
}

func NewActionClient

func NewActionClient(node ros.Node, action string, actionType ActionType) ActionClient

type ActionFeedback

type ActionFeedback interface {
	ros.Message
	GetHeader() std_msgs.Header
	GetStatus() actionlib_msgs.GoalStatus
	GetFeedback() ros.Message
	SetHeader(std_msgs.Header)
	SetStatus(actionlib_msgs.GoalStatus)
	SetFeedback(ros.Message)
}

type ActionGoal

type ActionGoal interface {
	ros.Message
	GetHeader() std_msgs.Header
	GetGoalId() actionlib_msgs.GoalID
	GetGoal() ros.Message
	SetHeader(std_msgs.Header)
	SetGoalId(actionlib_msgs.GoalID)
	SetGoal(ros.Message)
}

type ActionResult

type ActionResult interface {
	ros.Message
	GetHeader() std_msgs.Header
	GetStatus() actionlib_msgs.GoalStatus
	GetResult() ros.Message
	SetHeader(std_msgs.Header)
	SetStatus(actionlib_msgs.GoalStatus)
	SetResult(ros.Message)
}

type ActionServer

type ActionServer interface {
	Start()
	Shutdown()
	PublishResult(status actionlib_msgs.GoalStatus, result ros.Message)
	PublishFeedback(status actionlib_msgs.GoalStatus, feedback ros.Message)
	PublishStatus()
	RegisterGoalCallback(interface{})
	RegisterCancelCallback(interface{})
}

func NewActionServer

func NewActionServer(node ros.Node, action string, actionType ActionType, goalCb, cancelCb interface{}, autoStart bool) ActionServer

type ActionType

type ActionType interface {
	MD5Sum() string
	Name() string
	GoalType() ros.MessageType
	FeedbackType() ros.MessageType
	ResultType() ros.MessageType
	NewAction() Action
}

type ClientGoalHandler

type ClientGoalHandler interface {
	IsExpired() bool
	GetCommState() (CommState, error)
	GetGoalStatus() (uint8, error)
	GetGoalStatusText() (string, error)
	GetTerminalState() (uint8, error)
	GetResult() (ros.Message, error)
	Resend() error
	Cancel() error
}

type CommState

type CommState uint8
const (
	WaitingForGoalAck CommState = iota
	Pending
	Active
	WaitingForResult
	WaitingForCancelAck
	Recalling
	Preempting
	Done
	Lost
)

func (CommState) String

func (cs CommState) String() string

type Event

type Event uint8
const (
	CancelRequest Event = iota + 1
	Cancel
	Reject
	Accept
	Succeed
	Abort
)

func (Event) String

func (e Event) String() string

type ServerGoalHandler

type ServerGoalHandler interface {
	SetAccepted(string) error
	SetCancelled(ros.Message, string) error
	SetRejected(ros.Message, string) error
	SetAborted(ros.Message, string) error
	SetSucceeded(ros.Message, string) error
	SetCancelRequested() bool
	PublishFeedback(ros.Message)
	GetGoal() ros.Message
	GetGoalId() actionlib_msgs.GoalID
	GetGoalStatus() actionlib_msgs.GoalStatus
	Equal(ServerGoalHandler) bool
	NotEqual(ServerGoalHandler) bool
	Hash() uint32
	GetHandlerDestructionTime() ros.Time
	SetHandlerDestructionTime(ros.Time)
}

func NewServerGoalHandlerWithGoal

func NewServerGoalHandlerWithGoal(as ActionServer, goal ActionGoal) ServerGoalHandler

func NewServerGoalHandlerWithGoalId

func NewServerGoalHandlerWithGoalId(as ActionServer, goalID *actionlib_msgs.GoalID) ServerGoalHandler

type SimpleActionClient

type SimpleActionClient interface {
	SendGoal(goal ros.Message, doneCb, activeCb, feedbackCb interface{})
	SendGoalAndWait(goal ros.Message, executeTimeout, preeptTimeout ros.Duration) (uint8, error)
	WaitForServer(timeout ros.Duration) bool
	WaitForResult(timeout ros.Duration) bool
	GetResult() (ros.Message, error)
	GetState() (uint8, error)
	GetGoalStatusText() (string, error)
	CancelAllGoals()
	CancelAllGoalsBeforeTime(stamp ros.Time)
	CancelGoal() error
	StopTrackingGoal()
}

func NewSimpleActionClient

func NewSimpleActionClient(node ros.Node, action string, actionType ActionType) SimpleActionClient

type SimpleActionServer

type SimpleActionServer interface {
	Start()
	IsNewGoalAvailable() bool
	IsPreemptRequested() bool
	IsActive() bool
	SetSucceeded(result ros.Message, text string) error
	SetAborted(result ros.Message, text string) error
	SetPreempted(result ros.Message, text string) error
	AcceptNewGoal() (ros.Message, error)
	PublishFeedback(feedback ros.Message)
	GetDefaultResult() ros.Message
	RegisterGoalCallback(callback interface{}) error
	RegisterPreemptCallback(callback interface{})
}

func NewSimpleActionServer

func NewSimpleActionServer(node ros.Node, action string, actionType ActionType, executeCb interface{}, autoStart bool) SimpleActionServer

Jump to

Keyboard shortcuts

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