Documentation ¶
Overview ¶
Deliberate trial and error have been conducted in finding the best way of interfacing with rcl or rclc.
rclc was initially considered, but: Executor subscription callback doesn't include the subscription, only the ros2 message. Thus we cannot intelligently and dynamically dispatch the ros2 message to the correct subscription callback on the golang layer. rcl wait_set has much more granular way of defining how the received messages are handled and allows for a more Golang-way of handling dynamic callbacks
Index ¶
- func PublisherBundle(rclContext *Context, wg *sync.WaitGroup, ...) (*Context, *Publisher, error)
- func SubscriberBundleReturnWaitSet(ctx context.Context, rclContext *Context, wg *sync.WaitGroup, ...) (*Context, *WaitSet, error)
- type AlreadyInit
- type AlreadyShutdown
- type BadAlloc
- type Client
- type ClientInvalid
- type ClientOptions
- type ClientTakeFailed
- type Clock
- type ClockType
- type Context
- func NewContext(wg *sync.WaitGroup, clockType ClockType, rclArgs *RCLArgs) (ctx *Context, err error)
- func PublisherBundleTimer(ctx context.Context, rclContext *Context, wg *sync.WaitGroup, ...) (*Context, error)
- func SubscriberBundle(ctx context.Context, rclContext *Context, wg *sync.WaitGroup, ...) (*Context, error)
- func (c *Context) Close() error
- func (c *Context) NewClock(clockType ClockType) (clock *Clock, err error)
- func (c *Context) NewNode(node_name, namespace string) (node *Node, err error)
- func (c *Context) NewTimer(timeout time.Duration, timer_callback func(*Timer)) (timer *Timer, err error)
- func (c *Context) NewWaitSet(timeout time.Duration) (ws *WaitSet, err error)
- type Error
- type EventInvalid
- type EventTakeFailed
- type InvalidArgument
- type InvalidLogLevelRule
- type InvalidParamRule
- type InvalidRemapRule
- type InvalidRosArgs
- type LifecycleStateNotRegistered
- type LifecycleStateRegistered
- type LogSeverity
- type MismatchedRmwId
- type Node
- func (self *Node) Close() error
- func (r *Node) GetID() uint64
- func (n *Node) NewClient(serviceName string, typeSupport types.ServiceTypeSupport, ...) (c *Client, err error)
- func (self *Node) NewPublisher(topicName string, ros2msg types.MessageTypeSupport, options *PublisherOptions) (pub *Publisher, err error)
- func (n *Node) NewService(name string, typeSupport types.ServiceTypeSupport, options *ServiceOptions, ...) (s *Service, err error)
- func (self *Node) NewSubscription(topic_name string, ros2msg types.MessageTypeSupport, ...) (sub *Subscription, err error)
- func (r *Node) SetID(x uint64)
- type NodeInvalid
- type NodeInvalidName
- type NodeInvalidNamespace
- type NodeNameNonExistent
- type NotInit
- type Ok
- type Publisher
- type PublisherInvalid
- type PublisherOptions
- type RCLArgs
- type RmwBadAlloc
- type RmwError
- type RmwIncorrectRmwImplementation
- type RmwInvalidArgument
- type RmwMessageInfo
- type RmwNodeNameNonExistent
- type RmwOk
- type RmwQosDurabilityPolicy
- type RmwQosHistoryPolicy
- type RmwQosLivelinessPolicy
- type RmwQosProfile
- type RmwQosReliabilityPolicy
- type RmwRequestID
- type RmwServiceInfo
- type RmwTimeout
- type RmwUnsupported
- type Service
- type ServiceInvalid
- type ServiceNameInvalid
- type ServiceOptions
- type ServiceRequestHandler
- type ServiceResponseSender
- type ServiceTakeFailed
- type Subscription
- type SubscriptionCallback
- type SubscriptionInvalid
- type SubscriptionTakeFailed
- type Timeout
- type Timer
- type TimerCanceled
- type TimerInvalid
- type TopicNameInvalid
- type UnknownReturnCode
- type UnknownSubstitution
- type Unsupported
- type WaitSet
- func (w *WaitSet) AddClients(clients ...*Client)
- func (w *WaitSet) AddServices(services ...*Service)
- func (w *WaitSet) AddSubscriptions(subs ...*Subscription)
- func (w *WaitSet) AddTimers(timers ...*Timer)
- func (self *WaitSet) Close() error
- func (r *WaitSet) GetID() uint64
- func (w *WaitSet) Ready() bool
- func (self *WaitSet) Run(ctx context.Context) error
- func (self *WaitSet) RunGoroutine(ctx context.Context)
- func (r *WaitSet) SetID(x uint64)
- func (self *WaitSet) WaitForReady(timeout, interval time.Duration) error
- type WaitSetEmpty
- type WaitSetFull
- type WaitSetInvalid
- type WrongLexeme
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PublisherBundle ¶
Types ¶
type AlreadyInit ¶
type AlreadyInit struct {
// contains filtered or unexported fields
}
AlreadyInit rcl specific ret codes start at 100rcl_init() already called return code.
type AlreadyShutdown ¶
type AlreadyShutdown struct {
// contains filtered or unexported fields
}
AlreadyShutdown rcl_shutdown() already called return code.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is used to send requests to and receive responses from a service.
Calling Send is thread-safe. Creating and closing clients is not thread-safe.
type ClientInvalid ¶
type ClientInvalid struct {
// contains filtered or unexported fields
}
ClientInvalid rcl service client specific ret codes in 5XXInvalid rcl_client_t given return code.
type ClientOptions ¶
type ClientOptions struct {
Qos RmwQosProfile
}
func NewDefaultClientOptions ¶
func NewDefaultClientOptions() *ClientOptions
type ClientTakeFailed ¶
type ClientTakeFailed struct {
// contains filtered or unexported fields
}
ClientTakeFailed Failed to take a response from the client return code.
type Context ¶
Context manages resources for a set of RCL entities.
func NewContext ¶
func NewContext(wg *sync.WaitGroup, clockType ClockType, rclArgs *RCLArgs) (ctx *Context, err error)
NewRCLContext initializes a new RCL context.
parent can be nil, a new context.Background is created clockType can be nil, then no clock is initialized, you can later initialize it with NewClock() rclArgs can be nil
func PublisherBundleTimer ¶
func SubscriberBundle ¶
func SubscriberBundle(ctx context.Context, rclContext *Context, wg *sync.WaitGroup, namespace, nodeName, topicName, msgTypeName string, rosArgs *RCLArgs, subscriberCallback SubscriptionCallback) (*Context, error)
Creates a ROS2 RCL context with a single subscriber subscribing to the given topic and waiting for termination via the given/returned context. All parameters except the first one are optional.
type EventInvalid ¶
type EventInvalid struct {
// contains filtered or unexported fields
}
EventInvalid rcl event specific ret codes in 20XXInvalid rcl_event_t given return code.
type EventTakeFailed ¶
type EventTakeFailed struct {
// contains filtered or unexported fields
}
EventTakeFailed Failed to take an event from the event handle
type InvalidArgument ¶
type InvalidArgument = RmwInvalidArgument
InvalidArgument Invalid argument return code.
type InvalidLogLevelRule ¶
type InvalidLogLevelRule struct {
// contains filtered or unexported fields
}
InvalidLogLevelRule Argument is not a valid log level rule
type InvalidParamRule ¶
type InvalidParamRule struct {
// contains filtered or unexported fields
}
InvalidParamRule Argument is not a valid parameter rule
type InvalidRemapRule ¶
type InvalidRemapRule struct {
// contains filtered or unexported fields
}
InvalidRemapRule rcl argument parsing specific ret codes in 1XXXArgument is not a valid remap rule
type InvalidRosArgs ¶
type InvalidRosArgs struct {
// contains filtered or unexported fields
}
InvalidRosArgs Found invalid ros argument while parsing
type LifecycleStateNotRegistered ¶
type LifecycleStateNotRegistered struct {
// contains filtered or unexported fields
}
LifecycleStateNotRegistered rcl_lifecycle state not registered
type LifecycleStateRegistered ¶
type LifecycleStateRegistered struct {
// contains filtered or unexported fields
}
LifecycleStateRegistered rcl_lifecycle state register ret codes in 30XXrcl_lifecycle state registered
type LogSeverity ¶
type LogSeverity uint32
/ The severity levels of log messages / loggers. // Copypaste from /opt/ros/galactic/include/rcutils/logging.h
const ( LogSeverityUnset LogSeverity = 0 ///< The unset log level LogSeverityDebug LogSeverity = 10 ///< The debug log level LogSeverityInfo LogSeverity = 20 ///< The info log level LogSeverityWarn LogSeverity = 30 ///< The warn log level LogSeverityError LogSeverity = 40 ///< The error log level LogSeverityFatal LogSeverity = 50 ///< The fatal log level )
type MismatchedRmwId ¶
type MismatchedRmwId struct {
// contains filtered or unexported fields
}
MismatchedRmwId Mismatched rmw identifier return code.
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
func (*Node) NewClient ¶
func (n *Node) NewClient( serviceName string, typeSupport types.ServiceTypeSupport, options *ClientOptions, ) (c *Client, err error)
NewClient creates a new client.
options must not be modified after passing it to this function. If options is nil, default options are used.
func (*Node) NewPublisher ¶
func (self *Node) NewPublisher( topicName string, ros2msg types.MessageTypeSupport, options *PublisherOptions, ) (pub *Publisher, err error)
NewPublisher creates a new publisher.
options must not be modified after passing it to this function. If options is nil, default options are used.
func (*Node) NewService ¶
func (n *Node) NewService( name string, typeSupport types.ServiceTypeSupport, options *ServiceOptions, handler ServiceRequestHandler, ) (s *Service, err error)
NewService creates a new service.
options must not be modified after passing it to this function. If options is nil, default options are used.
func (*Node) NewSubscription ¶
func (self *Node) NewSubscription(topic_name string, ros2msg types.MessageTypeSupport, subscriptionCallback SubscriptionCallback) (sub *Subscription, err error)
type NodeInvalid ¶
type NodeInvalid struct {
// contains filtered or unexported fields
}
NodeInvalid rcl node specific ret codes in 2XXInvalid rcl_node_t given return code.
type NodeInvalidName ¶
type NodeInvalidName struct {
// contains filtered or unexported fields
}
NodeInvalidName Invalid node name return code.
type NodeInvalidNamespace ¶
type NodeInvalidNamespace struct {
// contains filtered or unexported fields
}
NodeInvalidNamespace Invalid node namespace return code.
type NodeNameNonExistent ¶
type NodeNameNonExistent struct {
// contains filtered or unexported fields
}
NodeNameNonExistent Failed to find node name
type NotInit ¶
type NotInit struct {
// contains filtered or unexported fields
}
NotInit rcl_init() not yet called return code.
type Publisher ¶
type Publisher struct { TopicName string // contains filtered or unexported fields }
type PublisherInvalid ¶
type PublisherInvalid struct {
// contains filtered or unexported fields
}
PublisherInvalid rcl publisher specific ret codes in 3XXInvalid rcl_publisher_t given return code.
type PublisherOptions ¶
type PublisherOptions struct {
Qos RmwQosProfile
}
func NewDefaultPublisherOptions ¶
func NewDefaultPublisherOptions() *PublisherOptions
type RCLArgs ¶
ROS2 RCL is configured via CLI arguments, so merge them from different sources. See. http://design.ros2.org/articles/ros_command_line_arguments.html
func NewRCLArgs ¶
NewRCLArgs parses ROS2 RCL commandline arguments from the given rclArgs or from os.Args. If rclArgs is nil returns a string containing the prepared parameters in the form the RCL can understand them.
C memory is freed when the RCLArgs-object is GC'd.
Example
oldOSArgs := os.Args defer func() { os.Args = oldOSArgs }() os.Args = []string{"--extra0", "args0", "--ros-args", "--log-level", "DEBUG", "--", "--extra1", "args1"} rosArgs, err := NewRCLArgs("") if err != nil { panic(err) } fmt.Printf("rosArgs: %+v\n", rosArgs.GoArgs) // -> [--extra0 args0 --ros-args --log-level DEBUG -- --extra1 args1] rosArgs, err = NewRCLArgs("--log-level INFO") if err != nil { panic(err) } fmt.Printf("rosArgs: %+v\n", rosArgs.GoArgs) // -> [--ros-args --log-level INFO] os.Args = []string{"--extra0", "args0", "--extra1", "args1"} rosArgs, err = NewRCLArgs("") if err != nil { panic(err) } fmt.Printf("rosArgs: %+v\n", rosArgs.GoArgs) // -> [] // Output: rosArgs: [--extra0 args0 --ros-args --log-level DEBUG -- --extra1 args1] // rosArgs: [--ros-args --log-level INFO] // rosArgs: []
func NewRCLArgsMust ¶
NewRCLArgsMust behaves the same as NewRCLArgs except on error it panic()s!
type RmwBadAlloc ¶
type RmwBadAlloc struct {
// contains filtered or unexported fields
}
RmwBadAlloc Failed to allocate memory
type RmwError ¶
type RmwError struct {
// contains filtered or unexported fields
}
RmwError Generic error to indicate operation could not complete successfully
type RmwIncorrectRmwImplementation ¶
type RmwIncorrectRmwImplementation struct {
// contains filtered or unexported fields
}
RmwIncorrectRmwImplementation Incorrect rmw implementation.
type RmwInvalidArgument ¶
type RmwInvalidArgument struct {
// contains filtered or unexported fields
}
RmwInvalidArgument Argument to function was invalid
type RmwMessageInfo ¶
type RmwNodeNameNonExistent ¶
type RmwNodeNameNonExistent struct {
// contains filtered or unexported fields
}
RmwNodeNameNonExistent rmw node specific ret codes in 2XXFailed to find node nameUsing same return code than in rcl
type RmwOk ¶
type RmwOk struct {
// contains filtered or unexported fields
}
RmwOk Return code for rmw functionsThe operation ran as expected
type RmwQosDurabilityPolicy ¶
type RmwQosDurabilityPolicy int
const ( RmwQosDurabilityPolicySystemDefault RmwQosDurabilityPolicy = iota RmwQosDurabilityPolicyTransientLocal RmwQosDurabilityPolicyVolatile RmwQosDurabilityPolicyUnknown )
type RmwQosHistoryPolicy ¶
type RmwQosHistoryPolicy int
const ( RmwQosHistoryPolicySystemDefault RmwQosHistoryPolicy = iota RmwQosHistoryPolicyKeepLast RmwQosHistoryPolicyKeepAll RmwQosHistoryPolicyUnknown )
type RmwQosLivelinessPolicy ¶
type RmwQosLivelinessPolicy int
const ( RmwQosLivelinessPolicySystemDefault RmwQosLivelinessPolicy = iota RmwQosLivelinessPolicyAutomatic RmwQosLivelinessPolicyManualByTopic RmwQosLivelinessPolicyUnknown )
type RmwQosProfile ¶
type RmwQosProfile struct { History RmwQosHistoryPolicy Depth int Reliability RmwQosReliabilityPolicy Durability RmwQosDurabilityPolicy Deadline time.Duration Lifespan time.Duration Liveliness RmwQosLivelinessPolicy LivelinessLeaseDuration time.Duration AvoidRosNamespaceConventions bool }
func NewRmwQosProfileDefault ¶
func NewRmwQosProfileDefault() RmwQosProfile
func NewRmwQosProfileServicesDefault ¶
func NewRmwQosProfileServicesDefault() RmwQosProfile
type RmwQosReliabilityPolicy ¶
type RmwQosReliabilityPolicy int
const ( RmwQosReliabilityPolicySystemDefault RmwQosReliabilityPolicy = iota RmwQosReliabilityPolicyReliable RmwQosReliabilityPolicyBestEffort RmwQosReliabilityPolicyUnknown )
type RmwRequestID ¶
type RmwServiceInfo ¶
type RmwServiceInfo struct { SourceTimestamp time.Time ReceivedTimestamp time.Time RequestID RmwRequestID }
type RmwTimeout ¶
type RmwTimeout struct {
// contains filtered or unexported fields
}
RmwTimeout The operation was halted early because it exceeded its timeout critera
type RmwUnsupported ¶
type RmwUnsupported struct {
// contains filtered or unexported fields
}
RmwUnsupported The operation or event handling is not supported.
type ServiceInvalid ¶
type ServiceInvalid struct {
// contains filtered or unexported fields
}
ServiceInvalid rcl service server specific ret codes in 6XXInvalid rcl_service_t given return code.
type ServiceNameInvalid ¶
type ServiceNameInvalid struct {
// contains filtered or unexported fields
}
ServiceNameInvalid Service name (same as topic name) does not pass validation.
type ServiceOptions ¶
type ServiceOptions struct {
Qos RmwQosProfile
}
func NewDefaultServiceOptions ¶
func NewDefaultServiceOptions() *ServiceOptions
type ServiceRequestHandler ¶
type ServiceRequestHandler func(*RmwServiceInfo, types.Message, ServiceResponseSender)
type ServiceResponseSender ¶
type ServiceTakeFailed ¶
type ServiceTakeFailed struct {
// contains filtered or unexported fields
}
ServiceTakeFailed Failed to take a request from the service return code.
type Subscription ¶
type Subscription struct { TopicName string Ros2MsgType types.MessageTypeSupport Callback SubscriptionCallback // contains filtered or unexported fields }
func (*Subscription) Close ¶
func (self *Subscription) Close() error
Close frees the allocated memory
func (*Subscription) TakeMessage ¶
func (s *Subscription) TakeMessage(out types.Message) (*RmwMessageInfo, error)
type SubscriptionCallback ¶
type SubscriptionCallback func(*Subscription)
type SubscriptionInvalid ¶
type SubscriptionInvalid struct {
// contains filtered or unexported fields
}
SubscriptionInvalid rcl subscription specific ret codes in 4XXInvalid rcl_subscription_t given return code.
type SubscriptionTakeFailed ¶
type SubscriptionTakeFailed struct {
// contains filtered or unexported fields
}
SubscriptionTakeFailed Failed to take a message from the subscription return code.
type Timer ¶
type Timer struct { Callback func(*Timer) // contains filtered or unexported fields }
func (*Timer) GetTimeUntilNextCall ¶
type TimerCanceled ¶
type TimerCanceled struct {
// contains filtered or unexported fields
}
TimerCanceled Given timer was canceled return code.
type TimerInvalid ¶
type TimerInvalid struct {
// contains filtered or unexported fields
}
TimerInvalid rcl timer specific ret codes in 8XXInvalid rcl_timer_t given return code.
type TopicNameInvalid ¶
type TopicNameInvalid struct {
// contains filtered or unexported fields
}
TopicNameInvalid Topic name does not pass validation.
type UnknownReturnCode ¶
type UnknownReturnCode struct {
// contains filtered or unexported fields
}
type UnknownSubstitution ¶
type UnknownSubstitution struct {
// contains filtered or unexported fields
}
UnknownSubstitution Topic name substitution is unknown.
type WaitSet ¶
type WaitSet struct { Timeout time.Duration Subscriptions []*Subscription Timers []*Timer // contains filtered or unexported fields }
func (*WaitSet) AddClients ¶
func (*WaitSet) AddServices ¶
func (*WaitSet) AddSubscriptions ¶
func (w *WaitSet) AddSubscriptions(subs ...*Subscription)
func (*WaitSet) Run ¶
Run causes the current goroutine to block on this given WaitSet. WaitSet executes the given timers and subscriptions and calls their callbacks on new events.
func (*WaitSet) RunGoroutine ¶
type WaitSetEmpty ¶
type WaitSetEmpty struct {
// contains filtered or unexported fields
}
WaitSetEmpty Given rcl_wait_set_t is empty return code.
type WaitSetFull ¶
type WaitSetFull struct {
// contains filtered or unexported fields
}
WaitSetFull Given rcl_wait_set_t is full return code.
type WaitSetInvalid ¶
type WaitSetInvalid struct {
// contains filtered or unexported fields
}
WaitSetInvalid rcl wait and wait set specific ret codes in 9XXInvalid rcl_wait_set_t given return code.
type WrongLexeme ¶
type WrongLexeme struct {
// contains filtered or unexported fields
}
WrongLexeme Expected one type of lexeme but got another
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
These types implement the rosidl_runtime_c primitive types handling semantics.
|
These types implement the rosidl_runtime_c primitive types handling semantics. |