gogen

package
v0.0.0-...-7321826 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Generates Golang types from ROS2 message definitions

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = Config{
	RclgoImportPath:     "github.com/TIERS/rclgo",
	MessageModulePrefix: "github.com/TIERS/rclgo-msgs",
}

Functions

func GenerateGolangMessageTypes

func GenerateGolangMessageTypes(c *Config, rootPath string, destPath string) error

func GeneratePrimitives

func GeneratePrimitives(c *Config, destFilePath string) error

func GenerateROS2AllMessagesImporter

func GenerateROS2AllMessagesImporter(c *Config, destPathPkgRoot string) error

func GenerateROS2ErrorTypes

func GenerateROS2ErrorTypes(rootPath, destFilePath string) error

func RclgoRepoRootPath

func RclgoRepoRootPath() string

RclgoRepoRootPath returns the path to the root of the rclgo repository. Panics if the path can't be determined.

Types

type Config

type Config struct {
	RclgoImportPath     string
	MessageModulePrefix string
}

type Metadata

type Metadata struct {
	Name, Package, Type string
}

func (*Metadata) GoPackage

func (m *Metadata) GoPackage() string

func (*Metadata) ImportPath

func (m *Metadata) ImportPath() string

type ROS2Constant

type ROS2Constant struct {
	RosType    string
	GoType     string
	RosName    string
	Value      string
	Comment    string
	PkgName    string
	PkgIsLocal bool
}

ROS2Constant is a message definition.

func ParseROS2MessageConstant

func ParseROS2MessageConstant(capture map[string]string, ros2msg *ROS2Message) (*ROS2Constant, error)

func (*ROS2Constant) GoPkgReference

func (t *ROS2Constant) GoPkgReference() string

type ROS2ErrorType

type ROS2ErrorType struct {
	Name      string
	Rcl_ret_t string // The function call return value the error is mapped to
	Reference string // This is a reference to another type, so we just redefine the same type with another name
	Comment   string // Any found comments before or over the #definition
}

ROS2ErrorType must have fields exported otherwise they cannot be used by the test/template -package

type ROS2Field

type ROS2Field struct {
	TypeArray    string
	ArrayBounded string
	ArraySize    int
	DefaultValue string
	PkgName      string
	GoPkgName    string
	PkgIsLocal   bool
	RosType      string
	CType        string
	GoType       string
	RosName      string
	CName        string
	GoName       string
	Comment      string
}

Field is a message field.

func (*ROS2Field) GoPkgReference

func (t *ROS2Field) GoPkgReference() string

func (*ROS2Field) IsSingleComplex

func (t *ROS2Field) IsSingleComplex() bool

type ROS2Message

type ROS2Message struct {
	*Metadata
	Fields    []*ROS2Field
	Constants []*ROS2Constant
	GoImports map[string]string
	CImports  map[string]bool
}

ROS2Message is a message definition. https://design.ros2.org/articles/legacy_interface_definition.html Use ROS2MessageNew() to initialize the struct

func ROS2MessageNew

func ROS2MessageNew(pkg, name string) *ROS2Message

type ROS2Service

type ROS2Service struct {
	*Metadata
	Request  *ROS2Message
	Response *ROS2Message
}

func NewROS2Service

func NewROS2Service(pkg, name string) *ROS2Service

Jump to

Keyboard shortcuts

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