├── .gitignore ├── .npmignore ├── LICENSE ├── MANIFEST.in ├── Makefile ├── README.md ├── dist ├── README.md ├── machinetalk-protobuf.js ├── machinetalk-protobuf.min.js ├── machinetalk-protobuf.min.js.gz └── machinetalk-protobuf.min.map.json ├── js ├── examples │ ├── decoding_message_container.js │ └── encoding_message_container.js ├── index.js └── scripts │ ├── bundle.js │ └── install.js ├── package.json ├── python └── examples │ ├── decode_message_container.py │ └── encode_message_container.py ├── scripts ├── README.md ├── asciidoc.mustache ├── distribute-python ├── ios-replace.sh ├── markdown.mustache └── protoc-gen-depends ├── setup.cfg ├── setup.py └── src ├── README.msgid └── machinetalk └── protobuf ├── canon.proto ├── config.proto ├── emcclass.proto ├── firmware.proto ├── jplan.proto ├── log.proto ├── message.proto ├── motcmds.proto ├── nanopb.proto ├── object.proto ├── preview.proto ├── ros.proto ├── rtapi_message.proto ├── rtapicommand.proto ├── sample.proto ├── status.proto ├── task.proto ├── test.proto ├── types.proto └── value.proto /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | /node_modules 3 | /objects 4 | /generated 5 | /machinetalk 6 | /doc_base 7 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | * 2 | !js 3 | !build/js/** 4 | !package.json 5 | !README* 6 | !LICENSE* 7 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Michael Haberler 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include LICENSE 2 | include README.md 3 | recursive-include src/machinetalk/protobuf *.proto 4 | recursive-include python/examples * 5 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Protobuf support for machinekit 3 | # 4 | # generate Python modules, and C++ bindings from .proto files 5 | 6 | # see http://www.cmcrossroads.com/ask-mr-make/6535-tracing-rule-execution-in-gnu-make 7 | # to trace make execution of make in more detail: 8 | # make VV=1 9 | ifeq ("$(origin VV)", "command line") 10 | OLD_SHELL := $(SHELL) 11 | SHELL = $(warning Building $@$(if $<, (from $<))$(if $?, ($? newer)))$(OLD_SHELL) 12 | endif 13 | 14 | ifeq ("$(origin V)", "command line") 15 | BUILD_VERBOSE = $(V) 16 | endif 17 | ifndef BUILD_VERBOSE 18 | BUILD_VERBOSE = 0 19 | endif 20 | ifeq ($(BUILD_VERBOSE),1) 21 | Q = 22 | else 23 | Q = @ 24 | endif 25 | ECHO := @echo 26 | 27 | DESTDIR := /usr/local 28 | # all protobuf definitions live here 29 | PROJECT := machinetalk 30 | NAMESPACEDIR := $(PROJECT)/protobuf 31 | SRCDIR := src 32 | SRCDIRINV := $(shell realpath --relative-to=$(SRCDIR) .) 33 | PROTODIR := $(SRCDIR)/$(NAMESPACEDIR) 34 | 35 | BUILDDIR := build 36 | 37 | # generated C++ headers + source files 38 | CXXGEN := $(BUILDDIR)/cpp 39 | 40 | # generated Python files 41 | PYGEN := $(BUILDDIR)/python 42 | 43 | # generated Java files 44 | JAVAGEN := $(BUILDDIR)/java 45 | 46 | # generated Documentation files 47 | # default to asciidoc template 48 | # for mk-docs formatting, pass in TEMPLATE pointing to the mk-docs template 49 | DOCFORMAT := asciidoc 50 | DOCEXT := asciidoc 51 | #DOCFORMAT := markdown 52 | #DOCEXT := md 53 | DOCTEMPLATE := $(SRCDIRINV)/scripts/$(DOCFORMAT).mustache 54 | 55 | DOCGEN := $(BUILDDIR)/doc 56 | 57 | # pkg-config 58 | PKG_CONFIG := $(shell which pkg-config) 59 | 60 | # the set of all proto specs generated files depend on 61 | PROTO_SPECS := $(wildcard $(PROTODIR)/*.proto) 62 | 63 | # the protobuf compiler 64 | PROTOC := $(shell which protoc) 65 | 66 | # the directory where descriptor.proto lives: 67 | GPBINCLUDE := $(shell $(PKG_CONFIG) --variable=includedir protobuf) 68 | DESCDIR := $(GPBINCLUDE)/google/protobuf 69 | 70 | # object files generated during dependency resolving 71 | OBJDIR := $(BUILDDIR)/objects 72 | 73 | # search path for .proto files 74 | # see note on PBDEP_OPT below 75 | vpath %.proto $(PROTODIR):$(GPBINCLUDE):$(DESCDIR)/compiler 76 | 77 | # $(PROJECT)/proto/*.proto derived Python bindings 78 | PROTO_PY_TARGETS := ${PROTO_SPECS:$(SRCDIR)/%.proto=$(PYGEN)/%_pb2.py} 79 | PROTO_PY_EXTRAS := $(PYGEN)/$(PROJECT)/__init__.py $(PYGEN)/$(PROJECT)/protobuf/__init__.py 80 | 81 | # generated C++ includes 82 | PROTO_CXX_INCS := ${PROTO_SPECS:$(SRCDIR)/%.proto=$(CXXGEN)/%.pb.h} 83 | 84 | # generated C++ sources 85 | PROTO_CXX_SRCS := ${PROTO_SPECS:$(SRCDIR)/%.proto=$(CXXGEN)/%.pb.cc} 86 | 87 | # generated Java sources 88 | uppercase_file = $(shell echo "$(1)" | sed 's/\(.*\/\)\(.*\)/\1\u\2/') 89 | PROTO_JAVA_TARGETS := $(foreach JAVA,${PROTO_SPECS:$(SRCDIR)/%.proto=$(JAVAGEN)/%.java},$(call uppercase_file,$(JAVA))) 90 | 91 | # generated doc file 92 | DOC_TARGET := $(DOCGEN)/$(PROJECT)-protobuf.$(DOCEXT) 93 | 94 | # ---- generate dependcy files for .proto files 95 | # 96 | # the list of .d dep files for .proto files: 97 | PROTO_DEPS := ${PROTO_SPECS:$(SRCDIR)/%.proto=$(OBJDIR)/%.d} 98 | 99 | # 100 | # options to the dependency generator protoc plugin 101 | PBDEP_OPT := 102 | #PBDEP_OPT += --debug 103 | PBDEP_OPT += --cgen=$(CXXGEN) 104 | PBDEP_OPT += --pygen=$(PYGEN) 105 | # this path must match the vpath arrangement exactly or the deps will be wrong 106 | # unfortunately there is no way to extract the proto path in the code 107 | # generator plugin 108 | PBDEP_OPT += --vpath=$(SRCDIR) 109 | PBDEP_OPT += --vpath=$(GPBINCLUDE) 110 | PBDEP_OPT += --vpath=$(DESCDIR)/compiler 111 | 112 | 113 | GENERATED += \ 114 | $(PROTO_CXX_SRCS)\ 115 | $(PROTO_CXX_INCS) \ 116 | $(PROTO_PY_TARGETS) \ 117 | $(PROTO_PY_EXTRAS) \ 118 | $(PROTO_JAVA_TARGETS) 119 | 120 | all: $(PROTO_DEPS) $(GENERATED) 121 | 122 | # include dependecy files 123 | -include $(PROTO_DEPS) 124 | 125 | ios_replace: 126 | sh scripts/ios-replace.sh $(CXXGEN) 127 | 128 | docs: $(DOC_TARGET) 129 | 130 | .PHONY: clean 131 | clean: 132 | rm -rf build 133 | 134 | install_proto: $(PROTO_SPECS) 135 | mkdir -p $(DESTDIR)/include/$(NAMESPACEDIR) 136 | for proto in $(PROTO_SPECS); do \ 137 | install -m 0644 $$proto $(DESTDIR)/include/$(NAMESPACEDIR); \ 138 | done 139 | 140 | install_cpp: $(PROTO_CXX_INCS) 141 | mkdir -p $(DESTDIR)/include/$(NAMESPACEDIR) 142 | for headerfile in $(PROTO_CXX_INCS); do \ 143 | install -m 0644 $$headerfile $(DESTDIR)/include/$(NAMESPACEDIR); \ 144 | done 145 | 146 | install: install_proto install_cpp 147 | 148 | $(OBJDIR)/%.d: $(SRCDIR)/%.proto 149 | $(ECHO) "protoc create dependencies for $<" 150 | @mkdir -p $(OBJDIR)/ 151 | $(Q)$(PROTOC) \ 152 | --plugin=protoc-gen-depends=scripts/protoc-gen-depends \ 153 | --proto_path=$(SRCDIR)/ \ 154 | --proto_path=$(GPBINCLUDE)/ \ 155 | --depends_out="$(PBDEP_OPT)":$(OBJDIR)/ \ 156 | $< 157 | 158 | #---------- C++ rules ----------- 159 | # 160 | # generate .cc/.h from proto files 161 | # for command.proto, generated files are: command.pb.cc command.pb.h 162 | $(CXXGEN)/%.pb.cc $(CXXGEN)/%.pb.h: $(SRCDIR)/%.proto 163 | $(ECHO) "protoc create $@ from $<" 164 | @mkdir -p $(CXXGEN) 165 | $(Q)$(PROTOC) $(PROTOCXX_FLAGS) \ 166 | --proto_path=$(SRCDIR)/ \ 167 | --proto_path=$(GPBINCLUDE)/ \ 168 | --cpp_out=$(CXXGEN) \ 169 | $< 170 | 171 | # ------------- Python rules ------------ 172 | # 173 | # this is for the stock protobuf Python bindings - 174 | # adapt here if using one of the accelerated methods 175 | # 176 | # generate Python modules from proto files 177 | $(PYGEN)/%_pb2.py: $(SRCDIR)/%.proto 178 | $(ECHO) "protoc create $@ from $<" 179 | @mkdir -p $(PYGEN) 180 | $(Q)$(PROTOC) $(PROTOC_FLAGS) \ 181 | --proto_path=$(SRCDIR)/ \ 182 | --proto_path=$(GPBINCLUDE)/ \ 183 | --python_out=$(PYGEN)/ \ 184 | $< 185 | 186 | $(PYGEN)/%/__init__.py: 187 | $(ECHO) "creating __init__ file $@" 188 | @touch "$@" 189 | 190 | # ------------- Java rules ------------ 191 | # 192 | # generate Java packages from proto files 193 | define java_from_proto 194 | $(call uppercase_file,$(1:$(SRCDIR)/%.proto=$(JAVAGEN)/%.java)): $1 195 | $(ECHO) "protoc create $$@ from $$<" 196 | @mkdir -p $(JAVAGEN) 197 | $(Q)$(PROTOC) $(PROTOC_FLAGS) \ 198 | --proto_path=$(SRCDIR)/ \ 199 | --proto_path=$(GPBINCLUDE)/ \ 200 | --java_out=$(JAVAGEN)/ \ 201 | $$< 202 | endef 203 | $(foreach PROTO,$(PROTO_SPECS),$(eval $(call java_from_proto,$(PROTO)))) 204 | 205 | 206 | # ------------- protoc-gen-doc rules ------------ 207 | # 208 | # see https://github.com/estan/protoc-gen-doc 209 | # 210 | # generate $(DOCFORMAT) files from proto files 211 | $(DOC_TARGET): $(wildcard $(SRCDIR)/*.proto) 212 | #doc_base: 213 | $(ECHO) "protoc create $@ from *.proto" 214 | @mkdir -p $(DOCGEN) 215 | $(Q)cd $(SRCDIR); \ 216 | $(PROTOC) $(PROTOC_FLAGS) \ 217 | --proto_path=./ \ 218 | --proto_path=$(GPBINCLUDE)/ \ 219 | --doc_out=$(DOCTEMPLATE),$(SRCDIRINV)/$@:./ \ 220 | $(NAMESPACEDIR)/*.proto 221 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | machinetalk-protobuf 2 | ==================== 3 | 4 | Protobuf declarations for machinekit messages 5 | 6 | This repo is integrated into github.com/machinekit/machinekit as a git subtree. 7 | 8 | To change/add to message definitions: 9 | 10 | * send a PR against this repo 11 | * add a new remote in your machinekit repo referring to here 12 | * update the subtree in your machinekit repo like so 13 | 14 | ``` 15 | git remote add machinetalk-protobuf git://github.com/machinekit/machinetalk-protobuf.git 16 | git fetch machinetalk-protobuf 17 | git subtree merge --prefix=src/machinetalk/proto machinetalk-protobuf/master --squash 18 | ``` 19 | 20 | Now create a PR against the machinekit repo. 21 | 22 | ## Python 23 | 24 | ### Installation via PyPi 25 | To use the Machinetalk protobuf Python modules in your projects, use: 26 | 27 | ```sh 28 | pip install machinetalk-protobuf 29 | ``` 30 | 31 | ### Installation from source 32 | Alternatively you can install the Python modules directly from the source code. 33 | 34 | ```sh 35 | make 36 | python setup.py build 37 | sudo python setup.py install 38 | ``` 39 | 40 | ### Usage 41 | See [examples](python/examples). 42 | 43 | ## JavaScript (NPM/NodeJS) 44 | 45 | ### Installation 46 | 47 | To use machinetalk protobuf definitions in your npm-based projects, use: 48 | 49 | ```sh 50 | npm install --save machinetalk-protobuf 51 | ``` 52 | 53 | ### Usage 54 | 55 | See [examples](js/examples). If you want to try these examples, be sure to first run `npm install` in this repository. 56 | 57 | #### Encoding 58 | 59 | ```js 60 | var machinetalkProtobuf = require('machinetalk-protobuf'); 61 | var messageContainer = { 62 | type: machinetalkProtobuf.message.ContainerType.MT_PING 63 | }; 64 | var encodedMessageContainer = machinetalkProtobuf.message.Container.encode(messageContainer); 65 | ``` 66 | This results in a buffer that starts with `0x08 0xd2 0x01`. 67 | 68 | #### Decoding 69 | 70 | ```js 71 | var machinetalkProtobuf = require('machinetalk-protobuf'); 72 | var encodedBuffer = new Buffer([0x08, 0xd2, 0x01]); 73 | var decodedMessageContainer = machinetalkProtobuf.message.Container.decode(encodedBuffer); 74 | ``` 75 | This results in a messageContainer like the one defined in [Encoding](#Encoding). 76 | 77 | ## JavaScript (Browser) 78 | 79 | ### CDN usage 80 | ```html 81 | 82 | ``` 83 | With `VERSION` replaced by [a valid tag](https://github.com/machinekit/machinetalk-protobuf/releases) or just `master` for testing 84 | the latest master build. 85 | 86 | ### Encoding 87 | 88 | ```js 89 | var messageContainer = { 90 | type: machinetalk.protobuf.message.ContainerType.MT_PING 91 | }; 92 | var encodedMessageContainer = machinetalk.protobuf.message.Container.encode(messageContainer); 93 | ``` 94 | This results in a buffer that starts with `0x08 0xd2 0x01`. 95 | 96 | #### Decoding 97 | 98 | ```js 99 | var encodedBuffer = new ArrayBuffer([0x08, 0xd2, 0x01]); 100 | var decodedMessageContainer = machinetalk.protobuf.message.Container.decode(encodedBuffer); 101 | ``` 102 | This results in a messageContainer like the one defined in [Encoding](#Encoding). 103 | -------------------------------------------------------------------------------- /dist/README.md: -------------------------------------------------------------------------------- 1 | Distributions 2 | ============= 3 | 4 | machinetalk-protobuf.js is available either only with ProtoBuf.js included. 5 | 6 | ### Full build including ProtoBuf.js 7 | 8 | * **[machinetalk-protobuf.js](https://raw.githubusercontent.com/machinekit/machinetalk-protobuf/master/dist/machinetalk-protobuf.js)** 9 | contains the commented source code. 10 | 11 | * **[machinetalk-protobuf.min.js](https://raw.githubusercontent.com/machinekit/machinetalk-protobuf/master/dist/machinetalk-protobuf.min.js)** 12 | has been compiled with Closure Compiler. 13 | 14 | * **[machinetalk-protobuf.min.js.gz](https://raw.githubusercontent.com/machinekit/machinetalk-protobuf/master/dist/machinetalk-protobuf.min.js.gz)** 15 | has also been gzipped using `-9`. 16 | 17 | * **[machinetalk-protobuf.min.map](https://raw.githubusercontent.com/machinekit/machinetalk-protobuf/master/dist/machinetalk-protobuf.min.map)** 18 | is the source map generated by Closure Compiler. 19 | 20 | ### Updates and Pull Requests 21 | When sending pull requests, please note that these files have been automatically generated from the sources located in 22 | [src/](https://github.com/machinekit/machinetalk-protobuf/tree/master/src). 23 | 24 | You can regenerate the bundle with the following commands in the root directory of the repository: 25 | ```bash 26 | npm install 27 | npm run bundle 28 | ``` 29 | -------------------------------------------------------------------------------- /dist/machinetalk-protobuf.min.js.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/machinekit/machinetalk-protobuf/eeceeb19eb3775e879caec6472d70203126d5434/dist/machinetalk-protobuf.min.js.gz -------------------------------------------------------------------------------- /js/examples/decoding_message_container.js: -------------------------------------------------------------------------------- 1 | var machinetalkProtobuf = require('../index.js'); 2 | 3 | var encodedBuffer = new Buffer([0x08, 0xd2, 0x01]); 4 | 5 | // Decode the message. 6 | var decodedMessageContainer = machinetalkProtobuf.message.Container.decode(encodedBuffer); 7 | 8 | // decodedMessageContainer.type === machinetalkProtobuf.message.ContainerType.MT_PING 9 | console.log(decodedMessageContainer); 10 | -------------------------------------------------------------------------------- /js/examples/encoding_message_container.js: -------------------------------------------------------------------------------- 1 | var machinetalkProtobuf = require('../index.js'); 2 | 3 | // Define the message we want to encode. 4 | var messageContainer = { 5 | type: machinetalkProtobuf.message.ContainerType.MT_PING 6 | }; 7 | 8 | // Encode the message. 9 | var encodedMessageContainer = machinetalkProtobuf.message.Container.encode(messageContainer); 10 | 11 | // Strip off excess bytes from the resulting buffer. 12 | var encodedBuffer = encodedMessageContainer.buffer.slice(encodedMessageContainer.offset, encodedMessageContainer.limit); 13 | 14 | // Print the buffer. 15 | console.log(encodedBuffer); -------------------------------------------------------------------------------- /js/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('../build/js/protoexport.js'); 2 | -------------------------------------------------------------------------------- /js/scripts/bundle.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | var path = require('path'); 3 | var fs = require('fs'); 4 | var mkdirp = require('mkdirp'); 5 | var browserify = require('browserify') 6 | var exec = require('child_process').exec; 7 | var destinationPath = path.join(__dirname, '../../dist'); 8 | var inputFile = path.join(__dirname, '../../build/js/protoexport.js'); 9 | 10 | function makeBundle() { 11 | var bundler = new browserify({standalone: 'machinetalk.protobuf'}); 12 | bundler.add(inputFile); 13 | 14 | bundler.bundle(function (err, src, map) { 15 | if (err) { 16 | console.log('Error:', err); 17 | } 18 | 19 | mkdirp.sync(destinationPath); 20 | fs.writeFileSync(path.join(destinationPath, 'machinetalk-protobuf.js'), src); 21 | 22 | console.log('bundle created'); 23 | }); 24 | } 25 | 26 | function makeMinBundle() { 27 | // As of browserify 5, you must enable debug mode in the constructor to use minifyify 28 | var bundler = new browserify({debug: true, standalone: 'machinetalk.protobuf'}); 29 | bundler.add(inputFile); 30 | bundler.plugin('minifyify', {map: 'machinetalk-protobuf.min.map.json'}); 31 | 32 | bundler.bundle(function (err, src, map) { 33 | if (err) { 34 | console.log('Error:', err); 35 | } 36 | 37 | mkdirp.sync(destinationPath); 38 | fs.writeFileSync(path.join(destinationPath, 'machinetalk-protobuf.min.js'), src); 39 | fs.writeFileSync(path.join(destinationPath, 'machinetalk-protobuf.min.map.json'), map); 40 | 41 | console.log('minified bundle created'); 42 | 43 | makeMinGzBundle(path.join(destinationPath, 'machinetalk-protobuf.min.js')); 44 | }); 45 | } 46 | 47 | function makeMinGzBundle(file) { 48 | var cmd = 'gzip -k -f -9 ' + file; 49 | 50 | exec(cmd, function(err, stdout, stderr) { 51 | if (err) { 52 | console.log('Error:', err); 53 | } 54 | 55 | console.log('Gzipped bundle created'); 56 | }); 57 | } 58 | 59 | makeBundle(); 60 | makeMinBundle(); 61 | -------------------------------------------------------------------------------- /js/scripts/install.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | var path = require('path'); 3 | var fs = require('fs'); 4 | var mkdirp = require('mkdirp'); 5 | var child_process = require('child_process'); 6 | var sourcePath = path.join(__dirname, '/../../src'); 7 | var destinationPath = path.join(__dirname, '/../../build/js'); 8 | 9 | var namespace = 'machinetalk/protobuf'; 10 | 11 | // Create list of information for protobuf files. 12 | var protos = fs.readdirSync(path.join(sourcePath, namespace)) 13 | .filter(function(filename) { 14 | // Only handle .proto files. 15 | return /\.proto$/.test(filename); 16 | }) 17 | .map(function(filename) { 18 | var name = path.basename(filename, '.proto'); 19 | var fullname = path.join(namespace, name); 20 | return { 21 | filename: filename, 22 | name: name, 23 | fullname: fullname, 24 | protopath: path.join(sourcePath, namespace, filename), 25 | jspath: path.join(destinationPath, namespace, name + '.js') 26 | }; 27 | }); 28 | 29 | // Generate js file for each proto file 30 | protos.forEach(function(protos) { 31 | mkdirp.sync(path.dirname(protos.jspath)); 32 | child_process.execFileSync('pbjs', ['--target', 'commonjs', '--out', protos.jspath, '--path', sourcePath, protos.protopath]); 33 | }); 34 | 35 | 36 | // Generate json file to direct index.js to the generated js files. 37 | var protosjson = protos.map(function(proto) { 38 | return { 39 | name: proto.name, 40 | fullname: proto.fullname 41 | }; 42 | }); 43 | 44 | mkdirp.sync(destinationPath); 45 | var text = ''; 46 | protosjson.forEach(function(proto) { 47 | text += 'module.exports[\'' + proto.name + '\'] = require(\'./' + proto.fullname + '.js\').pb;\n'; 48 | }); 49 | fs.writeFileSync(path.join(destinationPath, 'protoexport.js'), text); 50 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "machinetalk-protobuf", 3 | "version": "1.1.01", 4 | "description": "Protobuf definitions to communicate with Machinetalk", 5 | "main": "js/index.js", 6 | "scripts": { 7 | "prepublish": "js/scripts/install.js", 8 | "bundle": "js/scripts/bundle.js" 9 | }, 10 | "repository": { 11 | "type": "git", 12 | "url": "git+https://github.com/machinekit/machinetalk-protobuf.git" 13 | }, 14 | "author": "Bob van der Linden ", 15 | "keywords": [ 16 | "machinetalk", 17 | "machinekit", 18 | "protobuf" 19 | ], 20 | "license": "MIT", 21 | "bugs": { 22 | "url": "https://github.com/machinekit/machinetalk-protobuf/issues" 23 | }, 24 | "homepage": "https://github.com/machinekit/machinetalk-protobuf#readme", 25 | "dependencies": { 26 | "mkdirp": "0.5.1", 27 | "protobufjs": "5.0.3" 28 | }, 29 | "devDependencies": { 30 | "browserify": "^13.0.0", 31 | "minifyify": "^7.1.0" 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /python/examples/decode_message_container.py: -------------------------------------------------------------------------------- 1 | from machinetalk.protobuf.message_pb2 import Container 2 | from machinetalk.protobuf.types_pb2 import * 3 | 4 | encodedBuffer = ''.join(chr(x) for x in [0x08, 0xd2, 0x01]) 5 | 6 | # create the message container, reuse is more efficient 7 | rx = Container() 8 | 9 | # parse the encoded message 10 | rx.ParseFromString(encodedBuffer) 11 | 12 | # print the decoded message 13 | print(rx) 14 | -------------------------------------------------------------------------------- /python/examples/encode_message_container.py: -------------------------------------------------------------------------------- 1 | from machinetalk.protobuf.message_pb2 import Container 2 | from machinetalk.protobuf.types_pb2 import * 3 | 4 | # create the message container, reuse is more efficient 5 | tx = Container() 6 | 7 | # define the message 8 | tx.Clear() 9 | tx.type = MT_PING 10 | 11 | # encode the message 12 | encodedBuffer = tx.SerializeToString() 13 | 14 | # print the buffer 15 | print(encodedBuffer) 16 | -------------------------------------------------------------------------------- /scripts/README.md: -------------------------------------------------------------------------------- 1 | # Helper Scripts 2 | 3 | ## distribute-python 4 | 5 | This script must be run whenever the protobuf files are changed. To 6 | prevent problems when protoc is not installed on a system it makes 7 | sense to dristribute the generated Python files. 8 | 9 | Run this script from the root directory. 10 | 11 | ```bash 12 | ./script/distribute-python 13 | ``` 14 | -------------------------------------------------------------------------------- /scripts/asciidoc.mustache: -------------------------------------------------------------------------------- 1 | --- 2 | layout: docs 3 | --- 4 | 5 | = Machinetalk Protobuf Documentation 6 | :toc: 7 | 8 | {{#files}} 9 | 10 | == {{file_name}} 11 | 12 | {{#file_description}}{{file_description}}{{/file_description}} 13 | 14 | {{#file_messages}} 15 | 16 | === {{message_long_name}} 17 | {{message_description}} 18 | 19 | |=========================================== 20 | |*Field* |*Type* |*Label* |*Description* 21 | {{#message_fields}} 22 | |{{field_name}} | <<{{field_long_type}},{{field_long_type}}>> |{{field_label}} |{{#nobr}}{{field_description}}{{/nobr}} 23 | {{/message_fields}} 24 | |=========================================== 25 | {{/file_messages}} 26 | 27 | {{#file_enums}} 28 | 29 | [[{{enum_long_name}}]] 30 | === {{enum_long_name}} 31 | {{enum_description}} 32 | 33 | |===================================== 34 | |*Name* |*Number* |*Description* 35 | {{#enum_values}} 36 | |{{value_name}} |{{value_number}} |{{#nobr}}{{value_description}}{{/nobr}} 37 | {{/enum_values}} 38 | |===================================== 39 | {{/file_enums}} 40 | {{/files}} 41 | 42 | == Scalar Value Types 43 | 44 | |============================================================== 45 | |*.proto Type* |*Notes* |*C++ Type* |*Java Type* |*Python Type* 46 | {{#scalar_value_types}} 47 | |[[{{scalar_value_proto_type}}]] ((({{scalar_value_proto_type}}))) {{scalar_value_proto_type}} |{{scalar_value_notes}} |{{scalar_value_cpp_type}} |{{scalar_value_java_type}} |{{scalar_value_python_type}} 48 | {{/scalar_value_types}} 49 | |============================================================== 50 | -------------------------------------------------------------------------------- /scripts/distribute-python: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | make 3 | cp -rv ./build/python/machinetalk python 4 | -------------------------------------------------------------------------------- /scripts/ios-replace.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Replace "namespace google" with "namespace google_public" 3 | # in all source/header files. This is to address a 4 | # namespace collision issue when building for recent 5 | # versions of iOS. Apple is using the protobuf library 6 | # internally, and embeds it as a private framework. 7 | ############################################################### 8 | 9 | ( 10 | echo "------------------ Fixup namespace --------------------" 11 | cd $1 12 | sed -i '' -e 's/namespace\ google /namespace\ google_public /g' $(find . -name \*.h -type f) 13 | sed -i '' -e 's/namespace\ google /namespace\ google_public /g' $(find . -name \*.cc -type f) 14 | sed -i '' -e 's/namespace\ google /namespace\ google_public /g' $(find . -name \*.proto -type f) 15 | sed -i '' -e 's/google::protobuf/google_public::protobuf/g' $(find . -name \*.h -type f) 16 | sed -i '' -e 's/google::protobuf/google_public::protobuf/g' $(find . -name \*.cc -type f) 17 | sed -i '' -e 's/google::protobuf/google_public::protobuf/g' $(find . -name \*.proto -type f) 18 | ) 19 | 20 | exit 0 21 | -------------------------------------------------------------------------------- /scripts/markdown.mustache: -------------------------------------------------------------------------------- 1 | # Protocol Documentation 2 | 3 | 4 | ## Table of Contents 5 | {{#files}} 6 | * [{{file_name}}](#{{file_name}}) 7 | {{#file_messages}} 8 | * [{{message_long_name}}](#{{message_full_name}}) 9 | {{/file_messages}} 10 | {{#file_enums}} 11 | * [{{enum_long_name}}](#{{enum_full_name}}) 12 | {{/file_enums}} 13 | {{/files}} 14 | * [Scalar Value Types](#scalar-value-types) 15 | 16 | {{#files}} 17 | 18 |

Top

19 | 20 | ## {{file_name}} 21 | 22 | {{#file_messages}} 23 | 24 | ### {{message_long_name}} 25 | {{message_description}} 26 | 27 | | Field | Type | Label | Description | 28 | | ----- | ---- | ----- | ----------- | 29 | {{#message_fields}} 30 | | {{field_name}} | [{{field_long_type}}](#{{field_full_type}}) | {{field_label}} | {{#nobr}}{{field_description}}{{/nobr}} | 31 | {{/message_fields}} 32 | 33 | {{/file_messages}} 34 | 35 | {{#file_enums}} 36 | 37 | ### {{enum_long_name}} 38 | {{enum_description}} 39 | 40 | | Name | Number | Description | 41 | | ---- | ------ | ----------- | 42 | {{#enum_values}} 43 | | {{value_name}} | {{value_number}} | {{#nobr}}{{value_description}}{{/nobr}} | 44 | {{/enum_values}} 45 | 46 | {{/file_enums}} 47 | {{/files}} 48 | 49 | 50 | ## Scalar Value Types 51 | 52 | | .proto Type | Notes | C++ Type | Java Type | Python Type | 53 | | ----------- | ----- | -------- | --------- | ----------- | 54 | {{#scalar_value_types}} 55 | | {{scalar_value_proto_type}} | {{scalar_value_notes}} | {{scalar_value_cpp_type}} | {{scalar_value_java_type}} | {{scalar_value_python_type}} | 56 | {{/scalar_value_types}} 57 | -------------------------------------------------------------------------------- /scripts/protoc-gen-depends: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # protoc plugin to generate dependeny files 3 | # 4 | # the .d file format is rather project specific 5 | # 6 | # call example: 7 | # 8 | # /usr/bin/protoc --proto_path=/usr/include \ 9 | # --proto_path=/home/mah/linuxcnc/src/machinetalk/nanopb/generator/proto \ 10 | # --proto_path=/home/mah/linuxcnc/src/machinetalk/proto \ 11 | # --plugin=protoc-gen-depends=./protoc-gen-depends \ 12 | # --depends_out="--debug --cgen=/home/mah/linuxcnc/src/machinetalk/generated --vpath=/home/mah/linuxcnc/src/machinetalk/proto --vpath=/usr/include --vpath=/home/mah/linuxcnc/src/machinetalk/nanopb/generator/proto --pygen=/home/mah/linuxcnc/lib/python":objects \ 13 | # /home/mah/linuxcnc/src/machinetalk/proto/canon.proto 14 | # 15 | # option example: --depends-out="--debug --vpath=foo --vpath=bar --cgen=baz --pygen=barf":/outputpath" 16 | 17 | from google.protobuf.compiler.plugin_pb2 import CodeGeneratorRequest,CodeGeneratorResponse 18 | from sys import stdin,stdout 19 | import shlex 20 | from optparse import OptionParser 21 | import sys 22 | import os, string 23 | 24 | if sys.version_info >= (3, 0): 25 | # Python 3 does handle encoding differently 26 | # Read all bytes (without text-encoding) from stdin to input_str 27 | input_str = sys.stdin.buffer.raw.readall() 28 | else: 29 | input_str = sys.stdin.read() 30 | 31 | req = CodeGeneratorRequest() 32 | req.MergeFromString(input_str) 33 | 34 | optparser = OptionParser() 35 | optparser.add_option("-v","--vpath", dest="vpath", metavar="DIR", action="append", default=[], help="list of directories to search for proto files.") 36 | optparser.add_option("-d", "--debug", dest="debug", action="store_true", default=False, 37 | help="log actions to stderr") 38 | optparser.add_option("-c", "--cgen", dest="cgen", 39 | metavar="DIR", default='.', 40 | help="directory for generated C files.") 41 | optparser.add_option("-p", "--pygen", dest="pygen", 42 | metavar="DIR", default='.', 43 | help="directory for generated Python files.") 44 | optparser.add_option("-j", "--jsgen", dest="jsgen", 45 | metavar="DIR", default='.', 46 | help="directory for generated Javascript files.") 47 | 48 | args = shlex.split(req.parameter) 49 | options, dummy = optparser.parse_args(args) 50 | 51 | if options.debug: 52 | print >> sys.stderr, "vpath=", options.vpath 53 | print >> sys.stderr, "cgen=", options.cgen 54 | print >> sys.stderr, "pygen=", options.pygen 55 | print >> sys.stderr, "jsgen=", options.jsgen 56 | 57 | def dir_of(filename, vpath, pathsep=os.pathsep): 58 | for path in vpath: 59 | candidate = os.path.join(path, filename) 60 | if os.path.exists(candidate): return path 61 | return None 62 | 63 | res = CodeGeneratorResponse() 64 | 65 | def add_depends(fd): 66 | # if options.debug: print >> sys.stderr, "fd=%s" % (str(fd)) 67 | 68 | ap = dir_of(fd.name, options.vpath) 69 | if options.debug: print >> sys.stderr, "dirof(%s)=%s" % (fd.name, ap) 70 | 71 | prefix = fd.name[0:-6] 72 | depend_file = CodeGeneratorResponse.File() 73 | depend_file.name = prefix + '.d' 74 | 75 | deplist = ap + "/" + fd.name + " " 76 | for f in fd.dependency: 77 | deplist += dir_of(f,options.vpath) + "/" + f + " " 78 | 79 | if options.debug: 80 | print >> sys.stderr, "deps(%s)=%s" % (fd.name, deplist) 81 | depend_file.content = '{0}/{1}.pb.cc {0}/{1}.pb.h: {2}\n'.format(options.cgen,prefix,deplist) 82 | depend_file.content += '{0}/{1}.pb-c.c {0}/{1}.pb-c.h: {2}\n'.format(options.cgen,prefix,deplist) 83 | depend_file.content += '{0}/{1}.npb.c {0}/{1}.npb.h: {2}\n'.format(options.cgen,prefix,deplist) 84 | depend_file.content += '{0}/{1}_pb2.py: {2}\n'.format(options.pygen,prefix,deplist) 85 | depend_file.content += '{0}/{1}.js: {2}\n'.format(options.jsgen,prefix,deplist) 86 | 87 | return depend_file 88 | 89 | res.file.extend([add_depends(fileDescriptor) for fileDescriptor in req.proto_file]) 90 | 91 | if sys.version_info >= (3, 0): 92 | # With Python 3 we write to buffer 93 | stdout.buffer.write(res.SerializeToString()) 94 | else: 95 | stdout.write(res.SerializeToString()) 96 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [metadata] 2 | description-file = README.md 3 | 4 | [bdist-wheel] 5 | # This flag says that the code is written to work on both Python 2 and Python 6 | # 3. If at all possible, it is good practice to do this. If you cannot, you 7 | # will need to generate wheels for each Python version that you support. 8 | universal=1 9 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | """A setuptools based setup module. 2 | See: 3 | https://packaging.python.org/en/latest/distributing.html 4 | https://github.com/pypa/sampleproject 5 | """ 6 | 7 | from os import path 8 | 9 | # Always prefer setuptools over distutils 10 | from setuptools import setup, find_packages 11 | 12 | # To use a consistent encoding 13 | from codecs import open 14 | 15 | PROJECT = "machinetalk" 16 | PROJECT_NAME = "%s-protobuf" % PROJECT 17 | DESCRIPTION = "Protobuf Python modules for %s" % PROJECT 18 | VERSION = "1.2.1" 19 | AUTHOR = "Alexander Roessler" 20 | AUTHOR_EMAIL = "alex@machinekoder.com" 21 | PROJECT_URL = "https://github.com/machinekit/%s" % PROJECT_NAME 22 | DOWNLOAD_URL = "https://github.com/machinekit/%s/archive/%s.tar.gz" % ( 23 | PROJECT_NAME, 24 | VERSION, 25 | ) 26 | KEYWORDS = "protobuf machinekit motion-control hal" 27 | 28 | here = path.abspath(path.dirname(__file__)) 29 | 30 | # Get the long description from the README file 31 | with open(path.join(here, "README.md"), encoding="utf-8") as f: 32 | long_description = f.read() 33 | 34 | setup( 35 | name=PROJECT_NAME, 36 | # Versions should comply with PEP440. For a discussion on single-sourcing 37 | # the version across setup.py and the project code, see 38 | # https://packaging.python.org/en/latest/single_source_version.html 39 | version=VERSION, 40 | description=DESCRIPTION, 41 | long_description=long_description, 42 | long_description_content_type="text/markdown", 43 | # The project's main homepage. 44 | url=PROJECT_URL, 45 | download_url=DOWNLOAD_URL, 46 | # Author details 47 | author=AUTHOR, 48 | author_email=AUTHOR_EMAIL, 49 | # Choose your license 50 | license="MIT", 51 | # See https://pypi.python.org/pypi?%3Aaction=list_classifiers 52 | classifiers=[ 53 | # How mature is this project? Common values are 54 | # 3 - Alpha 55 | # 4 - Beta 56 | # 5 - Production/Stable 57 | "Development Status :: 5 - Production/Stable", 58 | # Indicate who your project is intended for 59 | "Intended Audience :: Developers", 60 | "Topic :: Software Development :: Object Brokering", 61 | # Pick your license as you wish (should match "license" above) 62 | "License :: OSI Approved :: MIT License", 63 | # Specify the Python versions you support here. In particular, ensure 64 | # that you indicate whether you support Python 2, Python 3 or both. 65 | "Programming Language :: Python :: 2", 66 | "Programming Language :: Python :: 2.7", 67 | "Programming Language :: Python :: 3", 68 | "Programming Language :: Python :: 3.3", 69 | "Programming Language :: Python :: 3.4", 70 | "Programming Language :: Python :: 3.5", 71 | "Programming Language :: Python :: 3.6", 72 | "Programming Language :: Python :: 3.7", 73 | ], 74 | # What does your project relate to? 75 | keywords=KEYWORDS, 76 | # You can just specify the packages manually here if your project is 77 | # simple. Or you can use find_packages(). 78 | packages=find_packages(where="build/python", exclude=["contrib", "docs", "tests"]), 79 | # Our packages live under src but src is not a package itself 80 | package_dir={"": "build/python"}, 81 | # Alternatively, if you want to distribute just a my_module.py, uncomment 82 | # this: 83 | # py_modules=["corenlp_protobuf"], 84 | # List run-time dependencies here. These will be installed by pip when 85 | # your project is installed. For an analysis of "install_requires" vs pip's 86 | # requirements files see: 87 | # https://packaging.python.org/en/latest/requirements.html 88 | install_requires=["protobuf"], 89 | # List additional groups of dependencies here (e.g. development 90 | # dependencies). You can install these using the following syntax, 91 | # for example: 92 | # $ pip install -e .[dev,test] 93 | extras_require={"dev": ["check-manifest"], "test": ["coverage"]}, 94 | # If there are data files included in your packages that need to be 95 | # installed, specify them here. If using Python 2.6 or less, then these 96 | # have to be included in MANIFEST.in as well. 97 | package_data={}, 98 | # Although 'package_data' is the preferred approach, in some case you may 99 | # need to place data files outside of your packages. See: 100 | # http://docs.python.org/3.4/distutils/setupscript.html#installing-additional-files # noqa 101 | # In this case, 'data_file' will be installed into '/my_data' 102 | data_files=[], 103 | # To provide executable scripts, use entry points in preference to the 104 | # "scripts" keyword. Entry points provide cross-platform support and allow 105 | # pip to create the appropriate form of executable for the target platform. 106 | entry_points={}, 107 | ) 108 | -------------------------------------------------------------------------------- /src/README.msgid: -------------------------------------------------------------------------------- 1 | about message type id's: 2 | ------------------------ 3 | 4 | nanopb upstream (https://code.google.com/p/nanopb/source/list) as of 5 | commit 62a7e4ff2b34 has introduced a key feature: it is now possible 6 | to associate a msgid option with each message, and have those id's 7 | emitted by the nanopb generator such that a descriptor mapping 8 | descriptors, msgid's, names, and other paramters can be automatically 9 | constructed. 10 | 11 | Thus we can associate an integer ID with each message, which is useful 12 | for runtime type checking of messages. There is no runtime overhead for 13 | this option. 14 | 15 | A typical usage scenario would be with multiframe ringbuffers, when 16 | using different protobuf messages: the multiframe flags field holds 17 | the type id, which is used to determine how to actually process the 18 | frame's content. 19 | 20 | msgid's have to be unique across all messages and all proto files. This must be maintained manually. 21 | 22 | The absolute value of the msgid option is irrelevant as it is only used as a key; uniqueness counts. msgid's need not be sequential. 23 | 24 | Any msgid value must be between 1 and msgidType.MSGID_MAX. This is 25 | checked at startup time in libmkproto and will result in an assert if 26 | violated. Values above MSGID_MAX to 4095 are reserved message ID 27 | values, see enum msgidType in types.proto .The reason is the 28 | limited-size field (12 bits) in the multiframe ring flag (see 29 | mfields_t). 30 | 31 | Convention for adding msgid's: 32 | ------------------------------ 33 | 34 | Since no proto file is expected to reasonable have more than 100 message definitions, each proto file gets a base message id, recorded in a comment on the top of the file: 35 | 36 | e.g. canon.proto: 37 | // msgid base: 100 38 | 39 | config.proto: 40 | // msgid base: 200 41 | 42 | and so forth. 43 | 44 | To tag a message with a msgid, proceed like so (using canon.proto as example): 45 | 46 | // make sure nanopb.proto is imported as this defines the option 47 | 48 | import "nanopb.proto"; 49 | // msgid base: 100 50 | 51 | // for each message, add the option like so: 52 | message Emc_Traj_Set_G5x { 53 | 54 | option (nanopb_msgopt).msgid = 101; // assign sequentially for all messages 55 | 56 | required EmcPose origin = 10; 57 | required OriginIndex g5x_index = 20; 58 | } 59 | 60 | Accessing the msgid if the message name is known: 61 | ------------------------------------------------- 62 | 63 | Google Protobuf, Python bindings: 64 | 65 | def msgid(m): 66 | return m.DESCRIPTOR.GetOptions().Extensions[nanopb_msgopt].msgid 67 | 68 | 69 | Google Protobuf, C++ bindings: 70 | 71 | uint32 msgid(const ::google::protobuf::Message &m) 72 | { 73 | const ::google::protobuf::MessageOptions& options = m.GetDescriptor()->options(); 74 | return options.GetExtension(nanopb_msgopt).msgid(); 75 | } 76 | 77 | Nanopb: 78 | 79 | use the _msgid symbol which defines an integer constant 80 | 81 | NB: due to the use of 'package machinetalk;', for example, the nanopb symbol for 82 | message 'Container' is 'pb_Container_msgid' 83 | -------------------------------------------------------------------------------- /src/machinetalk/protobuf/canon.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | import "machinetalk/protobuf/nanopb.proto"; 3 | 4 | // see README.msgid 5 | // msgid base: 100 6 | 7 | import "machinetalk/protobuf/types.proto"; 8 | import "machinetalk/protobuf/emcclass.proto"; 9 | import "machinetalk/protobuf/motcmds.proto"; 10 | 11 | package machinetalk; 12 | 13 | // communicated by message type only since no params: 14 | // Emc_Start_Change 15 | // Emc_Tool_Load 16 | // Emc_Tool_Unload 17 | // Emc_Spindle_Off 18 | // Emc_Flood_On 19 | // Emc_Flood_Off 20 | // Emc_Coolant_Mist_Off 21 | // Emc_Coolant_Mist_on 22 | // EMC_TRAJ_CLEAR_PROBE_TRIPPED_FLAG 23 | // EMC_TASK_PLAN_PAUSE 24 | // EMC_TASK_PLAN_OPTIONAL_STOP 25 | // EMC_TASK_PLAN_END 26 | 27 | message Emc_Traj_Set_G5x { 28 | 29 | option (nanopb_msgopt).msgid = 100; // see README.msgid 30 | 31 | required EmcPose origin = 10; 32 | required OriginIndex g5x_index = 20; 33 | } 34 | 35 | message Emc_Traj_Set_G92 { 36 | 37 | option (nanopb_msgopt).msgid = 101; 38 | 39 | required EmcPose origin = 10; 40 | } 41 | 42 | message Emc_Traj_Set_Rotation { 43 | 44 | option (nanopb_msgopt).msgid = 102; 45 | 46 | required double rotation = 10; 47 | } 48 | 49 | message Emc_Traj_Linear_Move { 50 | 51 | option (nanopb_msgopt).msgid = 103; 52 | 53 | required MotionType type = 10; 54 | required EmcPose end = 20; 55 | required double vel = 30; 56 | required double ini_maxvel = 40; 57 | required double acc = 50; 58 | required bool feed_mode = 60; 59 | required int32 indexrotary = 70; 60 | } 61 | 62 | message Emc_Traj_Probe { 63 | 64 | option (nanopb_msgopt).msgid = 104; 65 | 66 | required MotionType type = 10; 67 | required EmcPose pos = 20; 68 | required double vel = 30; 69 | required double ini_maxvel = 40; 70 | required double acc = 50; 71 | required uint32 probe_type = 60; 72 | } 73 | 74 | message Emc_Traj_Circular_Move { 75 | 76 | option (nanopb_msgopt).msgid = 105; 77 | 78 | required MotionType type = 10; // redundant - identified by message type 79 | required EmcPose end = 20; 80 | required PmCartesian center = 25; 81 | required PmCartesian normal = 27; 82 | required double vel = 30; 83 | required double ini_maxvel = 40; 84 | required double acc = 50; 85 | required bool feed_mode = 60; 86 | required int32 turn = 70; 87 | } 88 | 89 | message Emc_Traj_Rigid_Tap { 90 | 91 | option (nanopb_msgopt).msgid = 106; 92 | 93 | required EmcPose pos = 20; 94 | required double vel = 30; 95 | required double ini_maxvel = 40; 96 | required double acc = 50; 97 | } 98 | 99 | message Emc_Traj_Set_Term_Cond { 100 | 101 | option (nanopb_msgopt).msgid = 107; 102 | 103 | required TermConditionType cond = 10; 104 | required double tolerance = 20; 105 | } 106 | 107 | message Emc_Traj_Set_Spindlesync { 108 | 109 | option (nanopb_msgopt).msgid = 108; 110 | 111 | required double feed_per_revolution = 10; 112 | required bool velocity_mode = 20; 113 | } 114 | 115 | message Emc_Traj_Delay { 116 | 117 | option (nanopb_msgopt).msgid = 109; 118 | 119 | required double delay = 10; 120 | } 121 | 122 | message Emc_Spindle_On { 123 | 124 | option (nanopb_msgopt).msgid = 110; 125 | 126 | required double speed = 10 [ default = 0.0]; 127 | required double factor = 20 [ default = 0.0]; 128 | required double xoffset = 30 [ default = 0.0]; 129 | } 130 | 131 | message Emc_Spindle_Speed { 132 | 133 | option (nanopb_msgopt).msgid = 111; 134 | 135 | required double speed = 10; 136 | required double factor = 20; 137 | required double xoffset = 30; 138 | } 139 | 140 | message Emc_Spindle_Orient { 141 | 142 | option (nanopb_msgopt).msgid = 112; 143 | 144 | required double orientation = 10; 145 | required CanonDirection mode = 20; 146 | } 147 | 148 | message Emc_Spindle_Wait_Orient_Complete { 149 | 150 | option (nanopb_msgopt).msgid = 113; 151 | 152 | required double timeout = 10; 153 | } 154 | 155 | message Emc_Tool_Set_Offset { 156 | 157 | option (nanopb_msgopt).msgid = 114; 158 | 159 | required int32 pocket = 10; 160 | required int32 toolno = 15; 161 | required EmcPose offset = 20; 162 | required double diameter = 30; 163 | required double frontangle = 40; 164 | required double backangle = 50; 165 | required int32 orientation = 60; 166 | } 167 | 168 | message Emc_Traj_Set_Offset { 169 | 170 | option (nanopb_msgopt).msgid = 115; 171 | 172 | required EmcPose offset = 10; 173 | } 174 | 175 | message Emc_Tool_Prepare { 176 | 177 | option (nanopb_msgopt).msgid = 116; 178 | 179 | required int32 pocket = 10; 180 | required int32 tool = 20; 181 | } 182 | 183 | message Emc_Tool_Set_Number { 184 | 185 | option (nanopb_msgopt).msgid = 117; 186 | 187 | required int32 tool = 10; 188 | } 189 | 190 | message Emc_Traj_Set_Fo_Enable { 191 | 192 | option (nanopb_msgopt).msgid = 118; 193 | 194 | required bool mode = 10; 195 | } 196 | 197 | message Emc_Traj_Set_So_Enable { 198 | 199 | option (nanopb_msgopt).msgid = 119; 200 | 201 | required bool mode = 10; 202 | } 203 | 204 | message Emc_Traj_Set_Fh_Enable { 205 | 206 | option (nanopb_msgopt).msgid = 120; 207 | 208 | required bool mode = 10; 209 | } 210 | 211 | message Emc_Motion_Adaptive { 212 | 213 | option (nanopb_msgopt).msgid = 121; 214 | 215 | required bool status = 10; 216 | } 217 | 218 | message Emc_Operator_Display { 219 | 220 | option (nanopb_msgopt).msgid = 122; 221 | 222 | required int32 id = 10; 223 | required string display = 20; 224 | } 225 | 226 | message Emc_Operator_Text { 227 | 228 | option (nanopb_msgopt).msgid = 123; 229 | 230 | required int32 id = 10; 231 | required string text = 20; 232 | } 233 | 234 | message Emc_Operator_Error { 235 | 236 | option (nanopb_msgopt).msgid = 124; 237 | 238 | required int32 id = 10; 239 | required string error = 20; 240 | } 241 | 242 | message Emc_Motion_Set_Dout { 243 | 244 | option (nanopb_msgopt).msgid = 125; 245 | 246 | required uint32 index = 10; 247 | required bool start = 20; 248 | required bool end = 30; 249 | required bool now = 40; 250 | } 251 | 252 | message Emc_Motion_Set_Aout { 253 | 254 | option (nanopb_msgopt).msgid = 126; 255 | 256 | required uint32 index = 10; 257 | required double start = 20; 258 | required double end = 30; 259 | required bool now = 40; 260 | } 261 | 262 | message Emc_Aux_Input_Wait { 263 | 264 | option (nanopb_msgopt).msgid = 127; 265 | 266 | required uint32 index = 10; 267 | required InputType input_type = 20; 268 | required WaitType wait_type = 30; 269 | required double timeout = 40; 270 | } 271 | 272 | message Emc_Exec_Plugin_Ca1l { 273 | 274 | option (nanopb_msgopt).msgid = 128; 275 | 276 | required bytes call = 20; 277 | } 278 | 279 | message Emc_Io_Plugin_Call { 280 | 281 | option (nanopb_msgopt).msgid = 129; 282 | 283 | required bytes call = 20; 284 | } 285 | -------------------------------------------------------------------------------- /src/machinetalk/protobuf/config.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | import "machinetalk/protobuf/nanopb.proto"; 3 | 4 | // see README.msgid 5 | // msgid base: 200 6 | 7 | package machinetalk; 8 | 9 | enum ApplicationType { 10 | QT5_QML = 1; 11 | GLADEVCP = 2; 12 | JAVASCRIPT = 3; 13 | } 14 | 15 | enum FileContent { 16 | CLEARTEXT = 1; 17 | ZLIB = 2; 18 | }; 19 | 20 | message File { 21 | 22 | option (nanopb_msgopt).msgid = 200; // see README.msgid 23 | 24 | required string name = 1; // file name or path, flat for now 25 | optional FileContent encoding = 2 [default = CLEARTEXT]; // file encoding 26 | optional bytes blob = 3 [default = ""]; // file data 27 | optional uint32 size = 4 [default = 0]; // file size 28 | optional bool is_dir = 5 [default = false]; // indicates if file is actually a directo 29 | optional uint64 last_modified = 6 [default = 0]; // timestamp of last modification 30 | } 31 | 32 | message Application { 33 | 34 | option (nanopb_msgopt).msgid = 201; 35 | 36 | required string name = 1; // unique key 37 | optional string description = 2; // comment 38 | optional ApplicationType type = 3; 39 | optional string weburi = 4; // for type == JAVASCRIPT 40 | 41 | repeated File file = 5; 42 | // config params go here 43 | } 44 | 45 | message StdoutLine { 46 | 47 | option (nanopb_msgopt).msgid = 202; 48 | 49 | required int32 index = 1; 50 | optional string line = 2; 51 | } 52 | 53 | message MachineInfo { 54 | 55 | option (nanopb_msgopt).msgid = 203; 56 | 57 | optional string type = 1; // type of the machine, e.g. FDM, CNC, ... 58 | optional string manufacturer = 2; // manufacturer of the machine 59 | optional string model = 3; // machine model 60 | optional string variant = 4; // variant of the machine 61 | } 62 | 63 | // message for mklauncher 64 | message Launcher { 65 | 66 | option (nanopb_msgopt).msgid = 204; 67 | 68 | required int32 index = 1; // index is necessary to access repeated 69 | optional string name = 2; // visible name 70 | optional string description = 3; // description of the config 71 | optional File image = 4; // image representing the configuration 72 | optional MachineInfo info = 5; // information about the machine 73 | 74 | optional bool running = 6; // indicates whether the config is running or not 75 | optional bool terminating = 7; // indicates if a terminations signal was sent to the process 76 | optional string command = 8; // configuration start command 77 | optional bool shell = 9; // if the configuration command is executed in a shell 78 | repeated StdoutLine output = 10; // stdout output of the command 79 | optional int32 returncode = 11; // return code of the command 80 | optional string workdir = 12; // working dir of the command 81 | optional uint32 priority = 13; // priority for sorting, smaller means lower priority 82 | optional uint32 importance = 14; // importance set by the user, smaller means less important 83 | } 84 | 85 | // message for file service 86 | message FileServiceData { 87 | repeated File files = 1; // list of files 88 | } 89 | -------------------------------------------------------------------------------- /src/machinetalk/protobuf/emcclass.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | import "machinetalk/protobuf/nanopb.proto"; 3 | 4 | // see README.msgid 5 | // msgid base: 300 6 | 7 | package machinetalk; 8 | 9 | // this encoding method of encoding supports NULL values 10 | // using code needs to inspect the has_ property 11 | // to discern whether a value was explicitly set or defaulted 12 | 13 | message PmCartesian { 14 | 15 | option (nanopb_msgopt).msgid = 300; // see README.msgid 16 | 17 | optional double x = 10; 18 | optional double y = 20; 19 | optional double z = 30; 20 | }; 21 | 22 | message EmcPose { 23 | 24 | option (nanopb_msgopt).msgid = 301; 25 | 26 | required PmCartesian tran = 10; 27 | 28 | optional double a = 20; 29 | optional double b = 30; 30 | optional double c = 40; 31 | optional double u = 50; 32 | optional double v = 60; 33 | optional double w = 70; 34 | }; 35 | 36 | // this encoding method requires all fields to be set 37 | // or serialisation fails; NULL values not supported: 38 | 39 | // message PmCartesian { 40 | // required double x = 10; 41 | // required double y = 20; 42 | // required double z = 30; 43 | // }; 44 | 45 | // message EmcPose { 46 | // required PmCartesian tran = 10; 47 | 48 | // required double a = 20; 49 | // required double b = 30; 50 | // required double c = 40; 51 | // required double u = 50; 52 | // required double v = 60; 53 | // required double w = 70; 54 | // }; -------------------------------------------------------------------------------- /src/machinetalk/protobuf/firmware.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | /** firmware descriptor for hostmot2 3 | The message Firmware encodes the detail which used to be hardcoded in the low-level hostmot2 driver 4 | in the struct hm2_lowlevel_io_struct. 5 | It is placed in the firmware at a well-known location including a length field. 6 | The lowlevel driver decodes this message, and calls hm2_register() accordingly. 7 | */ 8 | 9 | // the nanopb import, plus the nanopb max_size/max_count options are not 10 | // strictly needed but together they result in a fixed-size C struct 11 | // representing the decoded message in nanopb 12 | // see the resulting typedefs _pb_Connector and _pb_Firmware in 13 | // src/machinetalk/generated/firmware.npb.h 14 | // this makes the struct easier to work with in RT (decoding without 15 | // callbacks and malloc()) 16 | 17 | import "machinetalk/protobuf/nanopb.proto"; 18 | 19 | // see README.msgid 20 | // msgid base: 380 21 | 22 | package machinetalk; 23 | 24 | /// describes a connector 25 | message Connector { 26 | /// @exclude 27 | option (nanopb_msgopt).msgid = 380; 28 | 29 | /// will appear in the HAL name 30 | optional string name = 1 [(nanopb).max_size = 20]; 31 | /// number of pins 32 | optional sfixed32 pins = 2; 33 | } 34 | 35 | message Firmware { 36 | /// @exclude 37 | option (nanopb_msgopt).msgid = 385; 38 | /// the machinekit/socfpga build SHA 39 | optional string build_sha = 1 [(nanopb).max_size = 40]; 40 | /// sets hm2_lowlevel_io_struct.fpga_part_number 41 | optional string fpga_part_number = 2 [(nanopb).max_size = 20]; 42 | /// sets hm2_lowlevel_io_struct.num_ioport_connectors, ioport_connector_name, pins_per_connector 43 | repeated Connector connector = 3 [(nanopb).max_count = 16]; 44 | /// sets hm2_lowlevel_io_struct.num_leds 45 | optional sfixed32 num_leds = 4; 46 | /// sets hm2_lowlevel_io_struct.num_leds 47 | optional string board_name = 5 [(nanopb).max_size = 30]; 48 | /// descriptive text, uninterpreted - use for log message if present 49 | optional string comment = 6 [(nanopb).max_size = 80]; 50 | } 51 | -------------------------------------------------------------------------------- /src/machinetalk/protobuf/jplan.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | package machinetalk; 3 | 4 | // see README.msgid 5 | // msgid base: 350 6 | 7 | import "machinetalk/protobuf/nanopb.proto"; 8 | 9 | 10 | message JplanJoint { 11 | option (nanopb_msgopt).msgid = 352; 12 | 13 | optional double pos_cmd = 1; 14 | optional double max_vel = 2; 15 | optional double max_acc = 3; 16 | optional bool enable = 4; // enable/disable this joint 17 | }; 18 | 19 | message JplanCommand { 20 | option (nanopb_msgopt).msgid = 354; 21 | 22 | repeated JplanJoint joint = 2 [(nanopb).max_count = 10]; 23 | }; 24 | -------------------------------------------------------------------------------- /src/machinetalk/protobuf/log.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | package machinetalk; 3 | // see README.msgid 4 | // msgid base: 400 5 | 6 | import "machinetalk/protobuf/nanopb.proto"; 7 | import "machinetalk/protobuf/types.proto"; 8 | 9 | message LogMessage { 10 | 11 | option (nanopb_msgopt).msgid = 400; // see README.msgid 12 | 13 | required MsgOrigin origin = 10; 14 | required int32 pid = 20; 15 | required MsgLevel level = 30; 16 | required string tag = 40; // [(nanopb).max_size = 20]; 17 | required string text = 50; // [(nanopb).max_size = 100]; 18 | } 19 | -------------------------------------------------------------------------------- /src/machinetalk/protobuf/message.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | // use a self-describing format as suggested in protobuf docs 3 | // and on the mailing list 4 | 5 | // see README.msgid 6 | // msgid base: 500 7 | 8 | package machinetalk; 9 | 10 | 11 | import "machinetalk/protobuf/nanopb.proto"; 12 | import "machinetalk/protobuf/types.proto"; 13 | import "machinetalk/protobuf/object.proto"; 14 | import "machinetalk/protobuf/log.proto"; 15 | import "machinetalk/protobuf/motcmds.proto"; 16 | //import "machinetalk/protobuf/test.proto"; 17 | import "machinetalk/protobuf/task.proto"; 18 | import "machinetalk/protobuf/canon.proto"; 19 | import "machinetalk/protobuf/value.proto"; 20 | import "machinetalk/protobuf/rtapicommand.proto"; 21 | import "machinetalk/protobuf/rtapi_message.proto"; 22 | import "machinetalk/protobuf/config.proto"; 23 | import "machinetalk/protobuf/preview.proto"; 24 | import "machinetalk/protobuf/status.proto"; 25 | 26 | message Container { 27 | 28 | option (nanopb_msgopt).msgid = 500; // see README.msgid 29 | 30 | // see https://developers.google.com/protocol-buffers/docs/techniques#union 31 | // for the principles behind this encoding 32 | 33 | required ContainerType type = 1; 34 | 35 | // 2, 3 reserved for repeated Pin, Signal - see below; those are high-frequency 36 | 37 | // protobuf-encoded submessages 38 | // tags with values in the range 1 through 15 take one byte to encode 39 | // so place the frequently used compound messages here 40 | optional sfixed64 tsc = 7; // rtapi_get_time 41 | 42 | // if Container.type == MT_RTMESSAGE, only the RTMessage array is filled in 43 | // individual messages are tagged again with RTMessage.type 44 | // this is an optimization which allows messagbus to deserialize/serialize 45 | // on behalf of RT components 46 | 47 | repeated Preview preview = 8 [(nanopb).type = FT_IGNORE]; 48 | 49 | optional MotionCommand motcmd = 9; 50 | optional MotionStatus motstat = 10; 51 | optional bytes legacy_motcmd = 11 [(nanopb).type = FT_IGNORE]; // emcmot_command_t wrapped in PB 52 | optional bytes legacy_motstat = 12 [(nanopb).type = FT_IGNORE]; // emcmot_status_t wrapped in PB 53 | 54 | optional RTAPI_Message rtapi_message = 13; 55 | optional TaskReply task_reply = 14 [(nanopb).type = FT_IGNORE]; 56 | optional TicketUpdate ticket_update = 15; 57 | 58 | // tags in the range 16 through 2047 take two bytes. 59 | // various blobs and less frequently used messages 60 | 61 | optional bytes syslog = 18 [(nanopb).type = FT_IGNORE]; // RFC5424 syslog(3) encoding 62 | optional bytes legacy_nml = 19 [(nanopb).type = FT_IGNORE]; // legacy NML container 63 | optional bytes legacy_motconfig = 20 [(nanopb).type = FT_IGNORE]; // emcmot_config_t wrapped in PB 64 | 65 | // timestamps: as per struct timespec 66 | // obtain with clock_gettime(CLOCK_REALTIME, &spec); 67 | optional int32 tv_sec = 21; // can be used with ctime(3) 68 | optional int32 tv_nsec = 22; 69 | 70 | 71 | 72 | // this is for messages going over pub/sub streams and wind up in JSON frames 73 | // duplicating the topic here allows us to drop the topic frame 74 | optional string topic = 23; 75 | 76 | optional bool reply_required = 24; // force a response even if OK 77 | 78 | // interpreter status updates, MT_INTERP_STAT 79 | optional InterpreterStateType interp_state = 25 [(nanopb).type = FT_IGNORE]; 80 | optional string interp_name = 26; 81 | 82 | // this is an or of bits in ReplyType: 83 | optional int32 rsvp = 30; // if/how to answer 84 | optional ContainerType in_reply_to = 33; 85 | 86 | optional RCS_STATUS rcs_status = 35; 87 | optional StatusType status = 40; 88 | 89 | optional int32 serial = 45; // legacy command serials 90 | optional int32 reply_serial = 50; // echoes the legacy command serial 91 | 92 | optional int32 ticket = 55; // command serials 93 | optional int32 reply_ticket = 60; // echoes the legacy command serial 94 | 95 | // Credit based flow control: http://hintjens.com/blog:15 96 | optional int32 sequence = 62; // running count used by producero 97 | optional int32 credit = 65; // updated by consumer 98 | 99 | // legacy line number as conveyed on interplist 100 | // to be replaced by source context 101 | optional int32 line_number = 66; 102 | 103 | // used with MT_MESSAGEBUS_NO_DESTINATION 104 | optional string name = 67 [(nanopb).type = FT_IGNORE]; // faulty messagebus destination 105 | repeated string note = 68; // easy tack-on for debugging 106 | optional int32 retcode = 69; // all purpose integer return code 107 | 108 | // generalized error descriptor 109 | // optional AnError error = 70 [(nanopb).type = FT_IGNORE]; 110 | 111 | // uuid helps distinguish server instances 112 | optional bytes uuid = 72 [(nanopb).type = FT_IGNORE]; 113 | 114 | optional bool trace = 75; // log from intermediaries 115 | 116 | optional int32 instance = 77; // RTAPI instance if nonzero 117 | 118 | // where is this coming from: 119 | // optional Originator origin = 80; 120 | 121 | // generalized polymorphic argument list 122 | repeated Value value = 85 [(nanopb).type = FT_IGNORE]; // [(nanopb).max_count = 20]; 123 | 124 | optional RTAPICommand rtapicmd = 86 [(nanopb).type = FT_IGNORE]; 125 | 126 | 127 | // a reply may carry several service announcements: 128 | repeated ServiceAnnouncement service_announcement = 88 [(nanopb).type = FT_IGNORE]; 129 | 130 | // // string argv-type vector; used in MT_RTAPI_APP_* and possibly others 131 | // repeated string argv = 86; // [(nanopb).max_count = 20]; 132 | 133 | // remote comp description for MT_HALCOMP_CREATE: [comp, pins*] 134 | repeated Component comp = 100 [(nanopb).type = FT_IGNORE]; 135 | repeated Pin pin = 2 [(nanopb).type = FT_IGNORE]; // high frequency - use single byte tag 136 | repeated Signal signal = 3 [(nanopb).type = FT_IGNORE]; // high frequency - use single byte tag 137 | repeated Param param = 103 [(nanopb).type = FT_IGNORE]; 138 | repeated Thread thread = 104 [(nanopb).type = FT_IGNORE]; 139 | repeated Ring ring = 105 [(nanopb).type = FT_IGNORE]; 140 | repeated Group group = 106 [(nanopb).type = FT_IGNORE]; 141 | repeated Member member = 107 [(nanopb).type = FT_IGNORE]; 142 | repeated Function function = 108 [(nanopb).type = FT_IGNORE]; 143 | optional ProtocolParameters pparams = 109 [(nanopb).type = FT_IGNORE]; 144 | repeated Vtable vtable = 110 [(nanopb).type = FT_IGNORE]; 145 | repeated Inst inst = 111 [(nanopb).type = FT_IGNORE]; 146 | 147 | // the app field is included as a reply to 148 | // a MT_LIST_APPLICATIONS and 149 | // MT_RETRIEVE_APPLICATION message 150 | repeated Application app = 120 [(nanopb).type = FT_IGNORE]; 151 | 152 | // the launcher field is reported by 153 | // a MT_LAUNCHER_FULL_UPDATE 154 | // or a MT_LAUNCHER_INCREMENTAL_UPDATE message 155 | repeated Launcher launcher = 130 [(nanopb).type = FT_IGNORE]; 156 | optional int32 index = 131 [(nanopb).type = FT_IGNORE]; 157 | 158 | // the file service data is used by file service related messages 159 | // MT_FILE_* 160 | optional FileServiceData file_service_data = 135 [(nanopb).type = FT_IGNORE]; 161 | 162 | 163 | // // miscellanous typed objects 164 | // optional string ascii = 140; 165 | // optional bytes unicode = 141; 166 | // optional string gcode = 142; 167 | // optional string python = 143; 168 | // optional bytes pickle = 144; 169 | // optional string tcl = 145; 170 | // optional string xml = 146; 171 | // optional string json = 147; 172 | // optional bytes jpeg = 148; 173 | // optional bytes png = 149; 174 | // optional bytes tiff = 150; 175 | // optional bytes postscript = 151; 176 | // optional bytes svg = 152; 177 | 178 | // infrequent compound messages 179 | //optional bytes wou = 160; // Arais Wishbone-over-USB 180 | optional LogMessage log_message = 87 [(nanopb).type = FT_IGNORE]; 181 | 182 | // taskplan (interpreter command) messages 183 | optional TaskPlanExecute tpexecute = 200 [(nanopb).type = FT_IGNORE]; 184 | optional TaskPlanBlockDelete tpblockdelete = 201 [(nanopb).type = FT_IGNORE]; 185 | optional TaskPlanOptionalStop tpoptionalstop = 202 [(nanopb).type = FT_IGNORE]; 186 | optional TaskPlanOpen tpopen = 203 [(nanopb).type = FT_IGNORE]; 187 | 188 | // interpreter reply 189 | optional TaskPlanReply taskplan_reply = 210 [(nanopb).type = FT_IGNORE]; 190 | 191 | // canon messages 192 | optional Emc_Traj_Set_G5x traj_set_g5x = 300; 193 | optional Emc_Traj_Set_G92 traj_set_g92 = 310; 194 | optional Emc_Traj_Set_Rotation traj_set_rotation = 320; 195 | optional Emc_Traj_Linear_Move traj_linear_move = 330; 196 | optional Emc_Traj_Probe traj_probe = 340; 197 | optional Emc_Traj_Circular_Move traj_circular_move = 350; 198 | optional Emc_Traj_Rigid_Tap traj_rigid_tap = 360; 199 | optional Emc_Traj_Set_Term_Cond traj_set_term_cond = 370; 200 | optional Emc_Traj_Set_Spindlesync traj_set_spindlesync = 380; 201 | optional Emc_Traj_Delay traj_delay = 390; 202 | optional Emc_Spindle_On spindle_on = 400; 203 | optional Emc_Spindle_Speed spindle_speed = 410; 204 | optional Emc_Spindle_Orient spindle_orient = 420; 205 | optional Emc_Spindle_Wait_Orient_Complete spindle_wait_orient_complete = 430; 206 | optional Emc_Tool_Set_Offset tool_set_offet = 440; 207 | optional Emc_Traj_Set_Offset traj_set_offset = 450; 208 | optional Emc_Tool_Prepare tool_prepare = 460; 209 | optional Emc_Tool_Set_Number tool_set_number = 470; 210 | optional Emc_Traj_Set_Fo_Enable traj_set_fo_enable = 480; 211 | optional Emc_Traj_Set_So_Enable traj_set_so_enable = 490; 212 | optional Emc_Traj_Set_Fh_Enable traj_set_fh_enable = 500; 213 | optional Emc_Motion_Adaptive motion_adaptive = 510; 214 | optional Emc_Operator_Display operator_display = 520; 215 | optional Emc_Operator_Text operator_text = 530; 216 | optional Emc_Operator_Error operator_error = 540; 217 | optional Emc_Motion_Set_Dout motion_set_dout = 550; 218 | optional Emc_Motion_Set_Aout motion_set_aout = 560; 219 | optional Emc_Aux_Input_Wait aux_input_wait = 570; 220 | optional Emc_Exec_Plugin_Ca1l exec_plugin_call = 580; 221 | optional Emc_Io_Plugin_Call io_plugin_call = 590; 222 | 223 | optional EmcStatusConfig emc_status_config = 600 [(nanopb).type = FT_IGNORE]; 224 | optional EmcStatusMotion emc_status_motion = 601 [(nanopb).type = FT_IGNORE]; 225 | optional EmcStatusIo emc_status_io = 602 [(nanopb).type = FT_IGNORE]; 226 | optional EmcStatusTask emc_status_task = 603 [(nanopb).type = FT_IGNORE]; 227 | optional EmcStatusInterp emc_status_interp = 604 [(nanopb).type = FT_IGNORE]; 228 | optional EmcStatusUI emc_status_ui = 605 [(nanopb).type = FT_IGNORE]; 229 | 230 | optional EmcCommandParameters emc_command_params = 610 [(nanopb).type = FT_IGNORE]; 231 | 232 | // less commonly used types 233 | 234 | // // firmware types. Add as needed 235 | // optional bytes pru_firmware = 2048; 236 | 237 | // // Mesanet firmware types: 3000 - 4000 238 | // optional bytes mesa_5i20_firmware = 3000; 239 | 240 | // // test message range: 5000-5100 - never used by core code 241 | // optional Test1 test1 = 5001; 242 | // optional Test2 test2 = 5002; 243 | // optional Test3 test3 = 5003; 244 | 245 | 246 | // NB: do not use the numbers 19000 though 19999 247 | // they are reserved for the Protocol Buffers implementation 248 | // protoc will complain 249 | } 250 | -------------------------------------------------------------------------------- /src/machinetalk/protobuf/motcmds.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | package machinetalk; 3 | 4 | // see README.msgid 5 | // msgid base: 600 6 | 7 | import "machinetalk/protobuf/emcclass.proto"; 8 | import "machinetalk/protobuf/nanopb.proto"; 9 | 10 | // an uncleaned first transliteration 11 | 12 | // add _ to avoid collision with macros in emc/nml_intf/motion_typesh 13 | enum MotionType { 14 | _EMC_MOTION_TYPE_NONE = 0; // sometimes also 0 is reported 15 | _EMC_MOTION_TYPE_TRAVERSE = 1; 16 | _EMC_MOTION_TYPE_FEED = 2; 17 | _EMC_MOTION_TYPE_ARC = 3; 18 | _EMC_MOTION_TYPE_TOOLCHANGE = 4; 19 | _EMC_MOTION_TYPE_PROBING = 5; 20 | _EMC_MOTION_TYPE_INDEXROTARY = 6; 21 | }; 22 | 23 | enum cmd_code_t { 24 | // motion commands. enum cmd_code_t from src/emc/motion.h 25 | 26 | EMCMOT_ABORT = 4000; /* abort all motion */ 27 | EMCMOT_AXIS_ABORT = 4001; /* abort one axis */ //FIXME-AJ: replace command name to EMCMOT_JOINT_ABORT 28 | EMCMOT_ENABLE = 4002; /* enable servos for active joints */ 29 | EMCMOT_DISABLE = 4003; /* disable servos for active joints */ 30 | EMCMOT_ENABLE_AMPLIFIER = 4004; /* enable amp outputs */ 31 | EMCMOT_DISABLE_AMPLIFIER = 4005; /* disable amp outputs */ 32 | EMCMOT_ENABLE_WATCHDOG = 4006; /* enable watchdog sound = 4000; parport */ 33 | EMCMOT_DISABLE_WATCHDOG = 4007; /* enable watchdog sound = 4000; parport */ 34 | EMCMOT_ACTIVATE_JOINT = 4008; /* make joint active */ 35 | EMCMOT_DEACTIVATE_JOINT = 4009; /* make joint inactive */ 36 | 37 | EMCMOT_PAUSE = 4010; /* pause motion */ 38 | EMCMOT_RESUME = 4011; /* resume motion */ 39 | EMCMOT_STEP = 4012; /* resume motion until id encountered */ 40 | EMCMOT_FREE = 4013; /* set mode to free (joint) motion */ 41 | EMCMOT_COORD = 4014; /* set mode to coordinated motion */ 42 | EMCMOT_TELEOP = 4015; /* set mode to teleop */ 43 | 44 | EMCMOT_SPINDLE_SCALE = 4016; /* set scale factor for spindle speed */ 45 | EMCMOT_SS_ENABLE = 4017; /* enable/disable scaling the spindle speed */ 46 | EMCMOT_FEED_SCALE = 4018; /* set scale factor for feedrate */ 47 | EMCMOT_FS_ENABLE = 4019; /* enable/disable scaling feedrate */ 48 | EMCMOT_FH_ENABLE = 4020; /* enable/disable feed_hold */ 49 | EMCMOT_AF_ENABLE = 4021; /* enable/disable adaptive feedrate */ 50 | EMCMOT_OVERRIDE_LIMITS = 4022; /* temporarily ignore limits until jog done */ 51 | 52 | EMCMOT_HOME = 4023; /* home a joint or all joints */ 53 | EMCMOT_UNHOME = 4024; /* unhome a joint or all joints*/ 54 | EMCMOT_JOG_CONT = 4025; /* continuous jog */ 55 | EMCMOT_JOG_INCR = 4026; /* incremental jog */ 56 | EMCMOT_JOG_ABS = 4027; /* absolute jog */ 57 | EMCMOT_SET_LINE = 4028; /* queue up a linear move */ 58 | EMCMOT_SET_CIRCLE = 4029; /* queue up a circular move */ 59 | EMCMOT_SET_TELEOP_VECTOR = 4030; /* Move at a given velocity but in 60 | world cartesian coordinates = 4000; not 61 | in joint space like EMCMOT_JOG_* */ 62 | 63 | EMCMOT_CLEAR_PROBE_FLAGS = 4031; /* clears probeTripped flag */ 64 | EMCMOT_PROBE = 4032; /* go to pos = 4000; stop if probe trips = 4000; record 65 | trip pos */ 66 | EMCMOT_RIGID_TAP = 4033; /* go to pos = 4000; with sync to spindle speed = 4000; 67 | then return to initial pos */ 68 | 69 | EMCMOT_SET_POSITION_LIMITS = 4034; /* set the joint position +/- limits */ 70 | EMCMOT_SET_BACKLASH = 4035; /* set the joint backlash */ 71 | EMCMOT_SET_MIN_FERROR = 4036; /* minimum following error = 4000; input units */ 72 | EMCMOT_SET_MAX_FERROR = 4037; /* maximum following error = 4000; input units */ 73 | EMCMOT_SET_VEL = 4038; /* set the velocity for subsequent moves */ 74 | EMCMOT_SET_VEL_LIMIT = 4039; /* set the max vel for all moves (tooltip) */ 75 | EMCMOT_SET_JOINT_VEL_LIMIT = 4040; /* set the max joint vel */ 76 | EMCMOT_SET_JOINT_ACC_LIMIT = 4041; /* set the max joint accel */ 77 | EMCMOT_SET_ACC = 4042; /* set the max accel for moves (tooltip) */ 78 | EMCMOT_SET_TERM_COND = 4043; /* set termination condition (stop = 4000; blend) */ 79 | EMCMOT_SET_NUM_AXES = 4044; /* set the number of joints */ //FIXME-AJ: function needs to get renamed 80 | EMCMOT_SET_WORLD_HOME = 4045; /* set pose for world home */ 81 | EMCMOT_SET_HOMING_PARAMS = 4046; /* sets joint homing parameters */ 82 | EMCMOT_SET_DEBUG = 4047; /* sets the debug level */ 83 | EMCMOT_SET_DOUT = 4048; /* sets or unsets a DIO = 4000; this can be imediate or synched with motion */ 84 | EMCMOT_SET_AOUT = 4049; /* sets or unsets a AIO = 4000; this can be imediate or synched with motion */ 85 | EMCMOT_SET_SPINDLESYNC = 4050; /* syncronize motion to spindle encoder */ 86 | 87 | EMCMOT_SPINDLE_ON = 4051; /* start the spindle */ 88 | EMCMOT_SPINDLE_OFF = 4052; /* stop the spindle */ 89 | EMCMOT_SPINDLE_INCREASE = 4053; /* spindle faster */ 90 | EMCMOT_SPINDLE_DECREASE = 4054; /* spindle slower */ 91 | EMCMOT_SPINDLE_BRAKE_ENGAGE = 4055; /* engage the spindle brake */ 92 | EMCMOT_SPINDLE_BRAKE_RELEASE = 4056;/* release the spindle brake */ 93 | EMCMOT_SET_MOTOR_OFFSET = 4057; /* set the offset between joint and motor */ 94 | EMCMOT_SET_JOINT_COMP = 4058; /* set a compensation triplet for a joint (nominal, forw., rev.) */ 95 | EMCMOT_SET_OFFSET = 4059; /* set tool offsets */ 96 | }; 97 | 98 | enum cmd_status_t { 99 | EMCMOT_COMMAND_OK = 0; /* cmd honored */ 100 | EMCMOT_COMMAND_UNKNOWN_COMMAND = 1; /* cmd not understood */ 101 | EMCMOT_COMMAND_INVALID_COMMAND = 2; /* cmd can't be handled now */ 102 | EMCMOT_COMMAND_INVALID_PARAMS = 3; /* bad cmd params */ 103 | EMCMOT_COMMAND_BAD_EXEC = 4; /* error trying to initiate */ 104 | }; 105 | 106 | 107 | message MotionCommand { 108 | 109 | option (nanopb_msgopt).msgid = 600; // see README.msgid 110 | 111 | required cmd_code_t command = 10; 112 | required fixed32 commandNum = 20; /* increment this for new command */ 113 | optional double motor_offset = 30; /* offset from joint to motor position */ 114 | optional double maxLimit = 40; /* pos value for position limit, output */ 115 | optional double minLimit = 50; /* neg value for position limit, output */ 116 | optional EmcPose pos = 60; /* line/circle endpt, or teleop vector */ 117 | optional PmCartesian center = 70; /* center for circle */ 118 | optional PmCartesian normal = 80; /* normal vec for circle */ 119 | optional fixed32 turn = 90; /* turns for circle or which rotary to unlock for a line */ 120 | optional double vel = 100; /* max velocity */ 121 | optional double ini_maxvel = 110; // max velocity allowed by machine 122 | // optional constraints (the ini file) 123 | optional MotionType motion_type = 120; // this move is because of traverse, feed, arc, or toolchange 124 | optional double spindlesync = 130; /* user units per spindle revolution, 0 = no sync */ 125 | optional double acc = 140; /* max acceleration */ 126 | optional double backlash = 150; /* amount of backlash */ 127 | optional fixed32 id = 160; /* id for motion */ 128 | optional fixed32 termCond = 170; /* termination condition */ 129 | optional double tolerance = 180; /* tolerance for path deviation in CONTINUOUS mode */ 130 | optional fixed32 axis = 190; /* which index to use for below */ //FIXME-AJ: replace with joint 131 | optional double scale = 200; /* velocity scale or spindle_speed scale arg */ 132 | optional double offset = 210; /* input, output, or home offset arg */ 133 | optional double home = 220; /* joint home position */ 134 | optional double home_final_vel = 230; /* joint velocity for moving from OFFSET to HOME */ 135 | optional double search_vel = 240; /* home search velocity */ 136 | optional double latch_vel = 250; /* home latch velocity */ 137 | optional fixed32 flags = 260; /* homing config flags, other boolean args */ 138 | optional fixed32 home_sequence = 270; /* order in homing sequence */ 139 | optional fixed32 volatile_home = 280; // joint should get unhomed when we get unhome -2 140 | // optional (generated by task upon estop, etc) 141 | optional double minFerror = 290; /* min following error */ 142 | optional double maxFerror = 300; /* max following error */ 143 | optional fixed32 wdWait = 310; /* cycle to wait before toggling wd */ 144 | optional fixed32 debug = 320; /* debug level, from DEBUG in .ini file */ 145 | optional int32 now = 330; 146 | optional int32 out = 340; 147 | optional int32 start = 350; 148 | optional int32 end = 360; // these are related to synched AOUT/DOUT 149 | // now=wether now or synched, out = which gets set, 150 | // start=start value, end=end value 151 | optional int32 mode = 370; /* used for turning overrides etc. on/off */ 152 | optional double comp_nominal = 380; /* compensation triplet, nominal, forward, reverse */ 153 | optional double comp_forward = 390; /* compensation triplet, nominal, forward, reverse */ 154 | optional double comp_reverse = 400; /* compensation triplet, nominal, forward, reverse */ 155 | optional int32 probe_type = 410; /* ~1 = error if probe operation is unsuccessful (ngc default) 156 | |1 = suppress error, report in # instead 157 | ~2 = move until probe trips (ngc default) 158 | |2 = move until probe clears */ 159 | optional EmcPose tool_offset = 420; /* TLO */ 160 | }; 161 | 162 | 163 | message MotionStatus { 164 | 165 | option (nanopb_msgopt).msgid = 601; 166 | 167 | required cmd_code_t commandEcho = 10; /* echo of input command */ 168 | required fixed32 commandNumEcho = 20; /* increment this for new command */ 169 | required cmd_status_t commandStatus = 30; /* result of most recent command */ 170 | optional EmcPose carte_pos_fb = 40; /* actual Cartesian position */ 171 | }; 172 | -------------------------------------------------------------------------------- /src/machinetalk/protobuf/nanopb.proto: -------------------------------------------------------------------------------- 1 | // Custom options for defining: 2 | // - Maximum size of string/bytes 3 | // - Maximum number of elements in array 4 | // 5 | // These are used by nanopb to generate statically allocable structures 6 | // for memory-limited environments. 7 | 8 | syntax = "proto2"; 9 | import "google/protobuf/descriptor.proto"; 10 | 11 | option java_package = "fi.kapsi.koti.jpa.nanopb"; 12 | 13 | enum FieldType { 14 | FT_DEFAULT = 0; // Automatically decide field type, generate static field if possible. 15 | FT_CALLBACK = 1; // Always generate a callback field. 16 | FT_POINTER = 4; // Always generate a dynamically allocated field. 17 | FT_STATIC = 2; // Generate a static field or raise an exception if not possible. 18 | FT_IGNORE = 3; // Ignore the field completely. 19 | } 20 | 21 | enum IntSize { 22 | IS_DEFAULT = 0; // Default, 32/64bit based on type in .proto 23 | IS_8 = 8; 24 | IS_16 = 16; 25 | IS_32 = 32; 26 | IS_64 = 64; 27 | } 28 | 29 | // This is the inner options message, which basically defines options for 30 | // a field. When it is used in message or file scope, it applies to all 31 | // fields. 32 | message NanoPBOptions { 33 | // Allocated size for 'bytes' and 'string' fields. 34 | optional int32 max_size = 1; 35 | 36 | // Allocated number of entries in arrays ('repeated' fields) 37 | optional int32 max_count = 2; 38 | 39 | // Size of integer fields. Can save some memory if you don't need 40 | // full 32 bits for the value. 41 | optional IntSize int_size = 7 [default = IS_DEFAULT]; 42 | 43 | // Force type of field (callback or static allocation) 44 | optional FieldType type = 3 [default = FT_DEFAULT]; 45 | 46 | // Use long names for enums, i.e. EnumName_EnumValue. 47 | optional bool long_names = 4 [default = true]; 48 | 49 | // Add 'packed' attribute to generated structs. 50 | // Note: this cannot be used on CPUs that break on unaligned 51 | // accesses to variables. 52 | optional bool packed_struct = 5 [default = false]; 53 | 54 | // Skip this message 55 | optional bool skip_message = 6 [default = false]; 56 | 57 | // Generate oneof fields as normal optional fields instead of union. 58 | optional bool no_unions = 8 [default = false]; 59 | 60 | // integer type tag for a message 61 | optional uint32 msgid = 9; 62 | } 63 | 64 | // Extensions to protoc 'Descriptor' type in order to define options 65 | // inside a .proto file. 66 | // 67 | // Protocol Buffers extension number registry 68 | // -------------------------------- 69 | // Project: Nanopb 70 | // Contact: Petteri Aimonen 71 | // Web site: http://kapsi.fi/~jpa/nanopb 72 | // Extensions: 1010 (all types) 73 | // -------------------------------- 74 | 75 | extend google.protobuf.FileOptions { 76 | optional NanoPBOptions nanopb_fileopt = 1010; 77 | } 78 | 79 | extend google.protobuf.MessageOptions { 80 | optional NanoPBOptions nanopb_msgopt = 1010; 81 | } 82 | 83 | extend google.protobuf.EnumOptions { 84 | optional NanoPBOptions nanopb_enumopt = 1010; 85 | } 86 | 87 | extend google.protobuf.FieldOptions { 88 | optional NanoPBOptions nanopb = 1010; 89 | } 90 | 91 | 92 | -------------------------------------------------------------------------------- /src/machinetalk/protobuf/object.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | // everything we know about objects, including HAL objects 3 | 4 | // see README.msgid 5 | // msgid base: 700 6 | 7 | 8 | import "machinetalk/protobuf/nanopb.proto"; 9 | import "machinetalk/protobuf/types.proto"; 10 | 11 | package machinetalk; 12 | 13 | // describes a RTAPI/HAL/LinuxCNC instance 14 | message Instance { 15 | 16 | option (nanopb_msgopt).msgid = 700; // see README.msgid 17 | 18 | optional string name = 1; // [(nanopb).max_size = 41]; 19 | optional sfixed32 id = 2; 20 | } 21 | 22 | // a service, for announcement/response to ServiceRequest via zbeacon(7) 23 | message ServiceAnnouncement { 24 | 25 | option (nanopb_msgopt).msgid = 701; 26 | 27 | required ServiceType stype = 1; 28 | required fixed32 version = 2 [default = 0]; 29 | required fixed32 instance = 3 [default = 0]; // RTAPI instance id 30 | required ServiceAPI api = 8; 31 | required string uri = 6; 32 | optional string description = 7; 33 | 34 | } 35 | 36 | // describes an entity which may cause a message: 37 | // a process, a component, a thread, a group, 38 | // a remote component 39 | // also used as a optional error detail 40 | message Originator { 41 | 42 | option (nanopb_msgopt).msgid = 702; 43 | 44 | optional OriginType origin = 1; 45 | optional OriginDetail detail = 2; 46 | optional string name = 3; // [(nanopb).max_size = 41]; 47 | optional sfixed32 id = 4; 48 | optional Instance instance = 5; 49 | } 50 | 51 | message AnError { 52 | 53 | option (nanopb_msgopt).msgid = 703; 54 | 55 | required sfixed32 error_code = 1; 56 | optional Severity severity = 2; 57 | optional string error_text = 3; 58 | optional Originator origin = 4; 59 | } 60 | 61 | 62 | 63 | 64 | message Pin { 65 | 66 | option (nanopb_msgopt).msgid = 704; 67 | 68 | optional ValueType type = 1; 69 | optional string name = 2; // [(nanopb).max_size = 41]; 70 | optional fixed32 handle = 3; 71 | optional HalPinDirection dir = 4; 72 | 73 | // One of the following must be filled in, 74 | // depending on type. 75 | optional bool halbit = 5; 76 | optional double halfloat = 6; 77 | optional sfixed32 hals32 = 7; 78 | optional fixed32 halu32 = 8; 79 | 80 | optional sfixed32 owner = 9; 81 | optional bool linked = 10; 82 | optional string oldname = 11; // [(nanopb).max_size = 41]; 83 | 84 | optional double epsilon = 12; 85 | optional fixed32 flags = 13; 86 | } 87 | 88 | message Signal { 89 | 90 | option (nanopb_msgopt).msgid = 705; 91 | 92 | optional ValueType type = 1; 93 | optional string name = 2; // [(nanopb).max_size = 41]; 94 | optional fixed32 handle = 3; 95 | 96 | optional bool halbit = 5; 97 | optional double halfloat = 6; 98 | optional sfixed32 hals32 = 7; 99 | optional fixed32 halu32 = 8; 100 | optional string strval = 9; 101 | optional bytes blob = 10; 102 | 103 | optional fixed32 readers = 11; 104 | optional fixed32 writers = 12; 105 | optional fixed32 bidirs = 13; 106 | } 107 | 108 | message Param { 109 | 110 | option (nanopb_msgopt).msgid = 706; 111 | 112 | optional ValueType type = 1; 113 | optional string name = 2; // [(nanopb).max_size = 41]; 114 | optional fixed32 handle = 3; 115 | 116 | optional bool halbit = 5; 117 | optional double halfloat = 6; 118 | optional sfixed32 hals32 = 7; 119 | optional fixed32 halu32 = 8; 120 | optional string strval = 9; 121 | optional bytes blob = 10; 122 | 123 | optional HalParamDirection dir = 11; 124 | optional string oldname = 12; // [(nanopb).max_size = 41]; 125 | optional sfixed32 owner = 13; 126 | optional sfixed32 runtime = 14; 127 | optional sfixed32 maytime = 15; 128 | } 129 | 130 | message Function { 131 | 132 | option (nanopb_msgopt).msgid = 707; 133 | 134 | optional string name = 1; // [(nanopb).max_size = 41]; 135 | optional fixed32 handle = 2; 136 | optional fixed32 owner_id = 3; 137 | optional fixed32 users = 4; 138 | optional fixed32 runtime = 5; 139 | optional fixed32 maxtime = 6; 140 | optional bool reentrant = 7; 141 | optional HalFunctType type = 8; 142 | optional bool maxtime_increased = 9; 143 | } 144 | 145 | message Thread { 146 | 147 | option (nanopb_msgopt).msgid = 708; 148 | 149 | optional string name = 1; // [(nanopb).max_size = 41]; 150 | optional fixed32 handle = 2; 151 | optional bool uses_fp = 3; 152 | optional fixed32 period = 4; 153 | optional sfixed32 priority = 5; 154 | optional fixed32 task_id = 6; 155 | optional fixed32 cpu_id = 7; 156 | repeated string function = 8; // [(nanopb).max_count = 100]; 157 | } 158 | 159 | message Component { 160 | 161 | option (nanopb_msgopt).msgid = 709; 162 | 163 | optional string name = 1; // [(nanopb).max_size = 41]; 164 | optional fixed32 ninst = 2; 165 | optional sfixed32 comp_id = 4; 166 | optional fixed32 type = 5; 167 | optional fixed32 state = 6; 168 | optional fixed32 last_update = 7; 169 | optional fixed32 last_bound = 8; 170 | optional fixed32 last_unbound = 9; 171 | optional fixed32 pid = 10; 172 | optional string args = 11; // [(nanopb).max_count = 20, 173 | // (nanopb).max_size = 41]; 174 | optional sfixed32 timer = 12; // using layer information; not in HAL 175 | optional sfixed32 userarg1 = 14; 176 | optional sfixed32 userarg2 = 15; 177 | 178 | repeated Pin pin = 16; 179 | repeated Param param = 17; 180 | repeated Function funct = 19; 181 | 182 | // do not create the component on MT_HALRCOMP_BIND if the component does not exist 183 | optional bool no_create = 18; 184 | } 185 | 186 | message Ring { 187 | 188 | option (nanopb_msgopt).msgid = 710; 189 | 190 | optional string name = 1; // [(nanopb).max_size = 41]; 191 | optional fixed32 handle = 2; 192 | optional sfixed32 owner = 3; 193 | optional bool stream = 4; 194 | optional bool wmutex = 5; 195 | optional bool rmutex = 6; 196 | optional bool rtapi_shm = 7; 197 | optional sfixed32 reader = 8; 198 | optional sfixed32 writer = 9; 199 | optional sfixed32 total_size = 10; 200 | optional sfixed32 scratchpad = 11; 201 | optional sfixed32 ring_shmkey = 12; 202 | optional fixed32 encodings = 13; 203 | // optional socketType haltalk_zeromq_stype = 14; 204 | // optional bool haltalk_adopt = 15; 205 | // optional bool haltalk_announce = 16; 206 | // optional bool haltalk_writes = 17; 207 | // optional fixed32 paired_handle = 18; 208 | } 209 | message Member { 210 | 211 | option (nanopb_msgopt).msgid = 711; 212 | 213 | optional ObjectType mtype = 1; 214 | optional sfixed32 userarg1 = 2; 215 | optional double epsilon = 3; 216 | 217 | // if mtype == HAL_MEMBER_SIGNAL 218 | optional Signal signal = 4; 219 | 220 | // if mtype == HAL_MEMBER_GROUP 221 | optional string groupname = 5; // [(nanopb).max_size = 41]; 222 | optional fixed32 handle = 6; 223 | 224 | // if mtype == HAL_MEMBER_PIN 225 | optional Pin pin = 7; 226 | 227 | // if mtype == HAL_MEMBER_PARAM 228 | optional Param param = 8; 229 | } 230 | 231 | message Group { 232 | 233 | option (nanopb_msgopt).msgid = 712; 234 | 235 | optional string name = 1; // [(nanopb).max_size = 41]; 236 | optional fixed32 handle = 2; 237 | optional sfixed32 userarg1 = 4; 238 | optional sfixed32 userarg2 = 5; 239 | optional sfixed32 refcount = 6; 240 | repeated Member member = 7; // list of signals or group names 241 | } 242 | 243 | 244 | // ProtocolParameters tells a peer entity about key 245 | // constants pertaining to the protocol, for instance 246 | // scan timer, keepalive timer etc 247 | 248 | message ProtocolParameters { 249 | 250 | option (nanopb_msgopt).msgid = 713; 251 | 252 | optional sfixed32 keepalive_timer = 1; // group and rcomp ping interval sent by haltalk 253 | optional sfixed32 group_timer = 2; // group default scan timer 254 | optional sfixed32 rcomp_timer = 3; // rcomp default scan timer 255 | } 256 | 257 | message Vtable { 258 | 259 | option (nanopb_msgopt).msgid = 714; 260 | 261 | optional string name = 1; // [(nanopb).max_size = 41]; 262 | optional fixed32 handle = 2; 263 | optional sfixed32 owner_id = 3; 264 | 265 | optional fixed32 context = 5; 266 | optional sfixed32 refcount = 6; 267 | optional sfixed32 version = 7; 268 | optional fixed64 vtable = 8; 269 | } 270 | 271 | message Inst { 272 | 273 | option (nanopb_msgopt).msgid = 715; 274 | 275 | optional string name = 1; // [(nanopb).max_size = 41]; 276 | optional sfixed32 comp_id = 2; 277 | optional fixed32 inst_id = 3; 278 | optional fixed32 inst_size = 4; 279 | optional fixed64 vtable = 5; 280 | 281 | repeated Pin pin = 16; 282 | repeated Param param = 17; 283 | repeated Function funct = 19; 284 | } 285 | 286 | -------------------------------------------------------------------------------- /src/machinetalk/protobuf/preview.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | package machinetalk; 3 | 4 | // see README.msgid 5 | // msgid base: 800 6 | import "machinetalk/protobuf/nanopb.proto"; 7 | 8 | /** 9 | * Experimental axis/joint representation. 10 | */ 11 | enum KinematicsType { 12 | KT_JOINT = 1; /// Joint kinematics. 13 | KT_TRIVKINS = 2; /// Trivial kinematics. 14 | KT_DELTA = 3; /// Delta kinematics. 15 | // and so forth 16 | } 17 | 18 | /** 19 | * Preview position. 20 | */ 21 | message Position { 22 | 23 | option (nanopb_msgopt).msgid = 800; // see README.msgid 24 | 25 | optional double x = 3; 26 | optional double y = 4; 27 | optional double z = 5; 28 | optional double a = 6; 29 | optional double b = 7; 30 | optional double c = 8; 31 | optional double u = 9; 32 | optional double v = 10; 33 | optional double w = 11; 34 | } 35 | 36 | /** 37 | * Type for preview operations. 38 | */ 39 | enum PreviewOpType { 40 | PV_STRAIGHT_PROBE = 1; /// Straight probe. 41 | PV_RIGID_TAP = 2; /// Rigid tap. 42 | PV_STRAIGHT_FEED = 3; /// Straight feed move. 43 | PV_ARC_FEED = 4; /// Arc feed move. 44 | PV_STRAIGHT_TRAVERSE = 5; /// Straight traverse move. 45 | PV_SET_G5X_OFFSET = 6; /// Set G5x offset. 46 | PV_SET_G92_OFFSET = 7; /// Set G92 offset. 47 | PV_SET_XY_ROTATION = 8; /// Set XY rotation. 48 | PV_SELECT_PLANE = 9; /// Select plane. 49 | PV_SET_TRAVERSE_RATE = 10; /// Set feedrate for traverse moves. 50 | PV_SET_FEED_RATE = 11; /// Set feedrate for normal moves. 51 | PV_CHANGE_TOOL = 12; /// Change tool. 52 | PV_CHANGE_TOOL_NUMBER = 13; /// Change tool number. 53 | PV_DWELL = 14; /// Dwell. 54 | PV_MESSAGE = 15; /// Print message. 55 | PV_COMMENT = 16; /// GCode comment. 56 | PV_USE_TOOL_OFFSET = 17; /// Use tool offset. 57 | PV_SET_PARAMS = 18; /// kins, axismask, angle_units, length_units 58 | PV_SET_FEED_MODE = 19; /// Set the feed mode. 59 | PV_SOURCE_CONTEXT = 20; /// Change the source context. 60 | PV_PREVIEW_START = 21; /// Start of preview 61 | PV_PREVIEW_END = 22; /// End of preview 62 | } 63 | 64 | /** 65 | * Preview source types.. 66 | */ 67 | enum SourceType { 68 | ST_NGC_FILE = 1; /// An NGC file. 69 | ST_NGC_STRING = 2; /// A MDI string. 70 | ST_PYTHON_METHOD = 3; /// A Python method. 71 | }; 72 | 73 | /** 74 | * The preview data structure. 75 | */ 76 | message Preview { 77 | 78 | option (nanopb_msgopt).msgid = 801; 79 | 80 | required PreviewOpType type = 1; /// Type of the preview operation. 81 | optional int32 line_number = 2; /// The line number this preview command corresponds to. 82 | 83 | /** move dest pos/offset for PV_STRAIGHT_*, PV_RIGID_TAP, PV_SET_* _OFFSET 84 | * _position for PV_ARC_FEED, PV_USE_TOOL_OFFSET 85 | */ 86 | optional Position pos = 3; 87 | 88 | // for PV_ARC_FEED only: 89 | optional double first_end = 4; /// First point for PV_ARC_FEED. 90 | optional double second_end = 5; /// Second point for PV_ARC_FEED. 91 | optional double first_axis = 6; /// First axis for PV_ARC_FEED. 92 | optional double second_axis = 7; /// Second axis for PV_ARC_FEED. 93 | optional int32 rotation = 8; /// Rotation for PV_ARC_FEED. 94 | optional double axis_end_point = 9; /// Axis endpoint for PV_ARC_FEED. 95 | 96 | // for PV_SET_XY_ROTATION: 97 | optional double xy_rotation = 10; /// XY rotation for PV_SET_XY_ROTATION. 98 | 99 | // for PV_SELECT_PLANE: 100 | optional int32 plane = 11; /// Plane for PV_SET_XY_ROTATION. 101 | 102 | // for PV_SET_TRAVERSE_RATE, PV_SET_FEED_RATE 103 | optional double rate = 12; /// feedrate for PV_SET_TRAVERSE_RATE and PV_SET_FEED_RATE. 104 | 105 | // PV_SET_FEED_MODE 106 | optional int32 feed_mode = 13; /// Mode for PV_SET_FEED_MODE. 107 | 108 | // PV_DWELL 109 | optional double time = 14; /// Time for PV_DWELL. 110 | 111 | // PV_COMMENT, PV_MESSAGE 112 | optional string text = 15; /// Text for PV_COMMENT and PV_MESSAGE. 113 | 114 | // rarely used: 115 | optional double angular_units = 101; /// Angular units: rarely used. 116 | optional double length_units = 102; /// Length units: rarely used. 117 | optional int32 probetype = 103; /// Probe type: rarely used. 118 | optional KinematicsType kins = 104 [ default = KT_JOINT ]; /// Kinematics type: rarely used. 119 | optional int32 axismask = 105; /// Axis mask: rarely used. 120 | optional int32 g5_index = 106; /// g5_index: rarely used. 121 | 122 | // PV_CHANGE_TOOL, PV_CHANGE_TOOL_NUMBER 123 | optional int32 pocket = 107; /// Pocket for PV_CHANGE_TOOL and PV_CHANGE_TOOL_NUMBER. 124 | 125 | // PV_SOURCE_CONTEXT 126 | optional SourceType stype = 110; /// Source type for PV_SOURCE_CONTEXT. 127 | optional string filename = 111; /// File name if source type is a NGC file. 128 | optional string cmdstring = 112; /// Command string if source type is a MDI command. 129 | optional int32 call_level = 113; /// Call stack depth. 130 | } 131 | -------------------------------------------------------------------------------- /src/machinetalk/protobuf/ros.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | package machinetalk; // this should probably better be ros or pb:ros; 3 | 4 | // see README.msgid 5 | // msgid base: 370 6 | 7 | import "machinetalk/protobuf/nanopb.proto"; 8 | 9 | // http://docs.ros.org/jade/api/std_msgs/html/msg/Header.html 10 | message Time { 11 | option (nanopb_msgopt).msgid = 371; 12 | 13 | optional uint32 secs = 1; 14 | optional uint32 nsecs = 2; 15 | }; 16 | 17 | message Header { 18 | option (nanopb_msgopt).msgid = 372; 19 | 20 | optional uint32 seq = 1; 21 | optional Time stamp = 2; 22 | optional string frame_id = 3 [(nanopb).max_size = 20]; 23 | } 24 | 25 | // http://docs.ros.org/indigo/api/trajectory_msgs/html/msg/JointTrajectoryPoint.html 26 | message JointTrajectoryPoint { 27 | option (nanopb_msgopt).msgid = 373; 28 | 29 | repeated double positions = 1 [(nanopb).max_count = 10]; 30 | repeated double velocities = 2 [(nanopb).max_count = 10]; 31 | repeated double accelerations = 3 [(nanopb).max_count = 10]; 32 | repeated double effort = 4 [(nanopb).max_count = 10]; 33 | optional double time_from_start = 5; 34 | 35 | optional double duration = 7; // of this segment, secs 36 | optional uint32 serial = 8; // segment being worked on 37 | }; 38 | 39 | // http://docs.ros.org/jade/api/trajectory_msgs/html/msg/JointTrajectory.html 40 | message JointTrajectory { 41 | option (nanopb_msgopt).msgid = 374; 42 | 43 | optional Header header = 1; 44 | repeated string joint_names = 2; 45 | repeated JointTrajectoryPoint points = 3; 46 | }; 47 | -------------------------------------------------------------------------------- /src/machinetalk/protobuf/rtapi_message.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | import "machinetalk/protobuf/nanopb.proto"; 3 | import "machinetalk/protobuf/value.proto"; 4 | 5 | // see README.msgid 6 | // msgid base: 1000 7 | 8 | package machinetalk; 9 | 10 | message RTAPI_Message { 11 | 12 | option (nanopb_msgopt).msgid = 1000; // see README.msgid 13 | 14 | 15 | required int32 msglevel = 10; // [default = RTAPI_MSG_DBG]; 16 | 17 | required string format = 20 [default = "*** uninitialized ***", 18 | (nanopb).max_size = 100]; 19 | 20 | // if this list of scalars is non-empty, 21 | // this implies sprintf(text, ) should be applied 22 | // before display 23 | repeated Value arg = 30 [(nanopb).max_count = 10]; 24 | } 25 | -------------------------------------------------------------------------------- /src/machinetalk/protobuf/rtapicommand.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | import "machinetalk/protobuf/nanopb.proto"; 3 | // see README.msgid 4 | // msgid base: 900 5 | 6 | package machinetalk; 7 | 8 | message RTAPICommand { 9 | 10 | option (nanopb_msgopt).msgid = 900; // see README.msgid 11 | 12 | 13 | required int32 instance = 1; 14 | optional string modname = 2; 15 | optional int32 rt_msglevel = 3; 16 | optional int32 user_msglevel = 4; 17 | 18 | // string argv-type vector; used in MT_RTAPI_APP_* and possibly others 19 | repeated string argv = 5; 20 | 21 | optional string threadname = 6; 22 | optional int32 threadperiod = 7; 23 | optional bool use_fp = 8; 24 | optional int32 cpu = 9; 25 | 26 | optional string comp = 10; 27 | optional string func = 11; 28 | optional string instname = 12; 29 | optional int32 flags = 13; 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/machinetalk/protobuf/sample.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | package machinetalk; 3 | 4 | // This message contains a Sample. 5 | // A sample is a value of a type. 6 | // A sample can contain a timestamp 7 | 8 | // see README.msgid 9 | // msgid base: 360 10 | 11 | import "machinetalk/protobuf/nanopb.proto"; 12 | 13 | 14 | message Sample { 15 | option (nanopb_msgopt).msgid = 361; 16 | 17 | optional fixed64 timestamp = 1; 18 | optional bytes v_bytes = 2; 19 | optional sfixed32 v_int32 = 3; 20 | optional sfixed64 v_int64 = 4; 21 | optional fixed32 v_uint32 = 5; 22 | optional fixed64 v_uint64 = 6; 23 | optional double v_double = 7; 24 | optional string v_string = 8 [(nanopb).max_size = 41]; 25 | optional bool v_bool = 9; 26 | } 27 | -------------------------------------------------------------------------------- /src/machinetalk/protobuf/status.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | import "machinetalk/protobuf/nanopb.proto"; 3 | import "machinetalk/protobuf/types.proto"; 4 | import "machinetalk/protobuf/preview.proto"; 5 | import "machinetalk/protobuf/emcclass.proto"; 6 | import "machinetalk/protobuf/motcmds.proto"; 7 | 8 | // see README.msgid 9 | // msgid base: 1100 10 | 11 | package machinetalk; 12 | 13 | /** 14 | * Types for EMC task execution state. 15 | */ 16 | enum EmcTaskExecStateType { 17 | EMC_TASK_EXEC_ERROR = 1; /// Error during task execution. 18 | EMC_TASK_EXEC_DONE = 2; /// Task execution has bee completed. 19 | EMC_TASK_EXEC_WAITING_FOR_MOTION = 3; /// Task execution is waiting for Motion. 20 | EMC_TASK_EXEC_WAITING_FOR_MOTION_QUEUE = 4; /// Task execution is waiting for Motion queue. 21 | EMC_TASK_EXEC_WAITING_FOR_IO = 5; /// Task execution is waiting for IO. 22 | EMC_TASK_EXEC_WAITING_FOR_MOTION_AND_IO = 7; /// Task execution is waiting for Motion and IO. 23 | EMC_TASK_EXEC_WAITING_FOR_DELAY = 8; /// Task execution is waiting for a delay. 24 | EMC_TASK_EXEC_WAITING_FOR_SYSTEM_CMD = 9; /// Task execution is waiting for a system command. 25 | EMC_TASK_EXEC_WAITING_FOR_SPINDLE_ORIENTED = 10; /// Task execution is waiting for spindle orientation to complete. 26 | } 27 | 28 | /** 29 | * Types for EMC task interpreter state. 30 | */ 31 | enum EmcInterpStateType { 32 | EMC_TASK_INTERP_IDLE = 1; /// Task interpreter is idling. 33 | EMC_TASK_INTERP_READING = 2; /// Task interpreter is reading. 34 | EMC_TASK_INTERP_PAUSED = 3; /// Task interpreter is paused. 35 | EMC_TASK_INTERP_WAITING = 4; /// Task interpreter is waiting. 36 | EMC_TASK_INTERP_SEEKING = 5; /// Task interpreter is seeking. 37 | } 38 | 39 | /** 40 | * Types for EMC interpreter exit codes. 41 | */ 42 | enum EmcInterpExitCodeType { 43 | EMC_INTERP_EXIT_OK = 0; /// Interpreter exited successfully. 44 | EMC_INTERP_EXIT_EXIT = 1; /// Interpreter exited with no status information. 45 | EMC_INTERP_EXIT_EXECUTE_FINISH = 2; /// Interpreter execution finished. 46 | EMC_INTERP_EXIT_ENDFILE = 3; /// Interpreter has reached end of file. 47 | EMC_INTERP_EXIT_FILE_NOT_OPEN = 4; /// Interpreter could not open the file. 48 | EMC_INTERP_EXIT_ERROR = 5; /// Interpreter exited with an error. 49 | } 50 | 51 | /** 52 | * EMC kinematics type. 53 | */ 54 | enum EmcKinematicsType { 55 | KINEMATICS_IDENTITY = 1; /// Identity kinematics. 56 | KINEMATICS_FORWARD_ONLY = 2; /// Forward only kinematics. 57 | KINEMATICS_INVERSE_ONLY = 3; /// Inverse only kinematics. 58 | KINEMATICS_BOTH = 4; /// Forward and inverse kinematics. 59 | } 60 | 61 | 62 | /** 63 | * Types for trajectory motion control. 64 | */ 65 | enum EmcTrajectoryModeType { 66 | EMC_TRAJ_MODE_FREE = 1; /// Independent axis motion. 67 | EMC_TRAJ_MODE_COORD = 2; /// Coordinated axis motion. 68 | EMC_TRAJ_MODE_TELEOP = 3; /// Velocity based world coordinates motion. 69 | } 70 | 71 | /** 72 | * Types for EMC Canon units. 73 | */ 74 | enum EmcCanonUnitsType { 75 | CANON_UNITS_INCH = 1; /// Inches. 76 | CANON_UNITS_MM = 2; /// Millimeters. 77 | CANON_UNITS_CM = 3; /// Centimeters. 78 | } 79 | 80 | /** 81 | * Types for EMC linear units. 82 | */ 83 | enum EmcLinearUnitsType { 84 | LINEAR_UNITS_INCH = 1; /// Inches. 85 | LINEAR_UNITS_MM = 2; /// Millimeters. 86 | LINEAR_UNITS_CM = 3; /// Centimeters. 87 | } 88 | 89 | /** 90 | * Types for EMC angular units. 91 | */ 92 | enum EmcAngularUnitsType { 93 | ANGULAR_UNITS_DEGREES = 1; /// Degrees. 94 | ANGULAR_UNITS_RADIAN = 2; /// Radian. 95 | ANGULAR_UNITS_GRAD = 3; /// Grad. 96 | } 97 | 98 | /** 99 | * Types for EMC time units. 100 | */ 101 | enum EmcTimeUnitsType { 102 | TIME_UNITS_MINUTE = 1; /// Minutes. 103 | TIME_UNITS_SECOND = 2; /// Seconds. 104 | } 105 | 106 | /** 107 | * Types for EMC task modes. 108 | */ 109 | enum EmcTaskModeType { 110 | EMC_TASK_MODE_MANUAL = 1; /// Manual task mode. For example jogging. 111 | EMC_TASK_MODE_AUTO = 2; /// Automatic task mode. For example program execution. 112 | EMC_TASK_MODE_MDI = 3; /// MDI task mode. MDI commands only. 113 | } 114 | 115 | /** 116 | * Types for EMC task state. 117 | */ 118 | enum EmcTaskStateType { 119 | EMC_TASK_STATE_ESTOP = 1; /// Task is in ESTOP. 120 | EMC_TASK_STATE_ESTOP_RESET = 2; /// Task is trying to reset an ESTOP. 121 | EMC_TASK_STATE_OFF = 3; /// Task is turned off (no ESTOP) 122 | EMC_TASK_STATE_ON = 4; /// Task is turned on. 123 | } 124 | 125 | /** 126 | * Axis types. 127 | */ 128 | enum EmcAxisType { 129 | EMC_AXIS_LINEAR = 1; /// Axis is using linear units. 130 | EMC_AXIS_ANGULAR = 2; /// Axis is using angular units. 131 | } 132 | 133 | /** 134 | * Joint types. 135 | */ 136 | enum EmcJointType { 137 | EMC_JOINT_LINEAR = 1; /// Joint is using linear units. 138 | EMC_JOINT_ANGULAR = 2; /// Joint is using angular units. 139 | } 140 | 141 | /** 142 | * Position offset types. 143 | */ 144 | enum EmcPositionOffsetType { 145 | EMC_CONFIG_RELATIVE_OFFSET = 1; /// Offset in relative coordinates. 146 | EMC_CONFIG_MACHINE_OFFSET = 2; /// Offset in machine coordinates. 147 | } 148 | 149 | /** 150 | * Position feedback types. 151 | */ 152 | enum EmcPositionFeedbackType { 153 | EMC_CONFIG_ACTUAL_FEEDBACK = 1; /// Feed back current position. 154 | EMC_CONFIG_COMMANDED_FEEDBACK = 2; /// Feed back commanded position. 155 | } 156 | 157 | /** 158 | * Tool table data. 159 | */ 160 | message EmcToolData { 161 | 162 | option (nanopb_msgopt).msgid = 1100; // see README.msgid 163 | 164 | 165 | required int32 index = 1; /// Tool table index (not tool id). 166 | optional int32 id = 2; /// ID/number of the tool. 167 | //optional double xOffset = 3; offsets replaced by Position message 168 | //optional double yOffset = 4; 169 | //optional double zOffset = 5; 170 | //optional double aOffset = 6; 171 | //optional double bOffset = 7; 172 | //optional double cOffset = 8; 173 | //optional double uOffset = 9; 174 | //optional double vOffset = 10; 175 | //optional double wOffset = 11; 176 | optional double diameter = 12; /// Diameter of the tool. 177 | optional double frontangle = 13; /// Front angle of the tool (only on lathe). 178 | optional double backangle = 14; /// Back angle of the tool (only on lathe). 179 | optional int32 orientation = 15; /// Orientation of the tool (lathe only, 0-9). 180 | optional Position offset = 16; /// Position offset of the tool. 181 | optional string comment = 17; /// User comment. 182 | optional int32 pocket = 18; /// Tool pocket position. 183 | } 184 | 185 | /** 186 | * Stores per axis information from motion. 187 | */ 188 | message EmcStatusMotionAxis { 189 | 190 | option (nanopb_msgopt).msgid = 1101; 191 | 192 | required int32 index = 1; /// Axis index. 193 | optional bool enabled = 2; /// Axis is enabled. 194 | optional bool fault = 3; /// Axis amp fault. 195 | optional double ferror_current = 4; /// Current following error. 196 | optional double ferror_highmark = 5; /// Magnitude of maximum following error. 197 | optional bool homed = 6; /// Axis has been homed. 198 | optional bool homing = 7; /// Homing currently progress. 199 | optional bool inpos = 8; /// Axis is in position. 200 | optional double input = 9; /// Current input position. 201 | optional bool max_hard_limit = 10; /// Maximum hard limit exceeded. 202 | optional bool max_soft_limit = 11; /// Maximum position limit was exceeded. 203 | optional bool min_hard_limit = 12; /// Minimum hard limit was exceeded. 204 | optional bool min_soft_limit = 13; /// Minimum position limit was exceeded. 205 | optional double output = 14; /// Commanded output position. 206 | optional bool override_limits = 15; /// Limits are overridden. 207 | optional double velocity = 16; /// Current velocity. 208 | } 209 | 210 | /** 211 | * Stores per axis information from configuration. 212 | */ 213 | message EmcStatusConfigAxis { 214 | 215 | option (nanopb_msgopt).msgid = 1102; 216 | 217 | required int32 index = 1; /// Axis index. 218 | optional EmcAxisType axis_type = 2; /// Type of axis. Reflects [AXIS_N]TYPE 219 | optional double backlash = 3; /// Axis backlash. Reflects [AXIS_N]BACKLASH 220 | optional double max_ferror = 4; /// Maximum following error. Reflects [AXIS_N]FERROR 221 | optional double max_position_limit = 5; /// Maximum position limit. Reflects [AXIS_N]MAX_LIMIT 222 | optional double min_ferror = 6; /// Minimum following error. Reflects [AXIS_N]MIN_FERROR 223 | optional double min_position_limit = 7; /// Minimum position limit. Reflects [AXIS_N]MIN_LIMIT 224 | //optional double units = 8; // Units per mm. field removed 225 | optional int32 home_sequence = 9; /// Homing sequence index. Reflects [AXIS_N]HOME_SEQUENCE 226 | optional double max_acceleration = 10; /// Maximum acceleration. Reflects [AXIS_N]MAX_ACCELERATION 227 | optional double max_velocity = 11; /// Maximum velocity. Reflects [AXIS_N]MAX_VELOCITY 228 | optional string increments = 12; /// Axis increments space separated.Reflects [AXIS_N]INCREMENTS or [DISPLAY]INCREMENTS 229 | } 230 | 231 | /** 232 | * Stores per joint information from motion. 233 | */ 234 | message EmcStatusMotionJoint { 235 | 236 | option (nanopb_msgopt).msgid = 1118; 237 | 238 | required int32 index = 1; /// Joint index. 239 | optional bool enabled = 2; /// Joint is enabled. 240 | optional bool fault = 3; /// Joint amp fault. 241 | optional double ferror_current = 4; /// Current following error. 242 | optional double ferror_highmark = 5; /// Magnitude of maximum following error. 243 | optional bool homed = 6; /// Joint has been homed. 244 | optional bool homing = 7; /// Homing currently progress. 245 | optional bool inpos = 8; /// Joint is in position. 246 | optional double input = 9; /// Current input position. 247 | optional bool max_hard_limit = 10; /// Maximum hard limit exceeded. 248 | optional bool max_soft_limit = 11; /// Maximum position limit was exceeded. 249 | optional bool min_hard_limit = 12; /// Minimum hard limit was exceeded. 250 | optional bool min_soft_limit = 13; /// Minimum position limit was exceeded. 251 | optional double output = 14; /// Commanded output position. 252 | optional bool override_limits = 15; /// Limits are overridden. 253 | optional double velocity = 16; /// Current velocity. 254 | } 255 | 256 | /** 257 | * Stores per joint information from configuration. 258 | */ 259 | message EmcStatusConfigJoint { 260 | 261 | option (nanopb_msgopt).msgid = 1119; 262 | 263 | required int32 index = 1; /// Joint index. 264 | optional EmcJointType joint_type = 2; /// Type of joint. Reflects [JOINT_N]TYPE 265 | optional double backlash = 3; /// Joint backlash. Reflects [JOINT_N]BACKLASH 266 | optional double max_ferror = 4; /// Maximum following error. Reflects [JOINT_N]FERROR 267 | optional double max_position_limit = 5; /// Maximum position limit. Reflects [JOINT_N]MAX_LIMIT 268 | optional double min_ferror = 6; /// Minimum following error. 269 | optional double min_position_limit = 7; /// Minimum position limit. Reflects [AXIS_N]MIN_LIMIT 270 | } 271 | 272 | 273 | /** 274 | * Stores per joint information from configuration. 275 | */ 276 | message EmcStatusMotionSpindle { 277 | 278 | option (nanopb_msgopt).msgid = 1120; 279 | 280 | required int32 index = 1; /// Spindle index. 281 | optional bool brake = 2; /// Spindle braked. 282 | optional int32 direction = 3; /// Rotational direction of the spindle. forward=1, reverse=-1. 283 | optional bool enabled = 4; /// Spindle enabled. 284 | optional bool override_enabled = 5; /// Spindle override is enabled. 285 | optional double speed = 6; /// Spindle speed value in rpm. > 0 is clockwise, < 0 is counterclockwise 286 | optional bool homed = 7; /// Spindle is homed. 287 | optional bool orient_fault = 8; /// Spindle orientation faulted. 288 | optional bool orient_state = 9; /// Spindle orientation running. 289 | optional bool increasing = 10; /// Spindle speed increasing? 290 | optional double override = 11; /// Spindle speed override scale. 291 | } 292 | 293 | /** 294 | * Program extension message. 295 | */ 296 | message EmcProgramExtension { 297 | 298 | option (nanopb_msgopt).msgid = 1103; 299 | 300 | required int32 index = 1; /// Index of the program extension. 301 | optional string extension = 2; /// Supported program extension. E.g. .gcode GCode program 302 | } 303 | 304 | /** 305 | * Analog IO pin message. 306 | */ 307 | message EmcStatusAnalogIO { 308 | 309 | option (nanopb_msgopt).msgid = 1104; 310 | 311 | required int32 index = 1; /// Index of analog IO pin. 312 | optional double value = 2; /// Current value of analog IO pin. 313 | } 314 | 315 | /** 316 | * Digital IO pin message. 317 | */ 318 | message EmcStatusDigitalIO { 319 | 320 | option (nanopb_msgopt).msgid = 1105; 321 | 322 | required int32 index = 1; /// Index of digital IO pin. 323 | optional bool value = 2; /// Current value of digital IO pin. 324 | } 325 | 326 | /** 327 | * Limit mask message. 328 | */ 329 | message EmcStatusLimit { 330 | 331 | option (nanopb_msgopt).msgid = 1106; 332 | 333 | required int32 index = 1; /// Axis index. 334 | optional int32 value = 2; /// Axis limit mask. minHardLimit=1, maxHardLimit=2, minSoftLimit=4, maxSoftLimit=8 335 | } 336 | 337 | /** 338 | * Currently active GCodes message. 339 | */ 340 | message EmcStatusGCode { 341 | 342 | option (nanopb_msgopt).msgid = 1107; 343 | 344 | required int32 index = 1; /// Index of the GCode. 345 | optional int32 value = 2; /// GCode value. E.g. 210 for G21 346 | } 347 | 348 | /** 349 | * Currently active MCodes message. 350 | */ 351 | message EmcStatusMCode { 352 | 353 | option (nanopb_msgopt).msgid = 1108; 354 | 355 | required int32 index = 1; /// Index of MCode. 356 | optional int32 value = 2; /// MCode value. E.g. 100 for M100 357 | } 358 | 359 | /** 360 | * Interpreter setting message. 361 | */ 362 | message EmcStatusSetting { 363 | 364 | option (nanopb_msgopt).msgid = 1109; 365 | 366 | required int32 index = 1; /// Index of interpreter setting. 367 | optional double value = 2; /// Interpreter settings value. 368 | } 369 | 370 | /** 371 | * EMC status configuration message. 372 | */ 373 | message EmcStatusConfig { 374 | 375 | option (nanopb_msgopt).msgid = 1110; 376 | 377 | optional double default_acceleration = 1; /// Default acceleration. Reflects parameter [TRAJ]DEFAULT_ACCELERATION. 378 | //optional double angular_units = 2; // Angular units scale. Reflects [TRAJ]ANGULAR_UNITS field removed 379 | optional int32 axes = 3; /// Number of axes. Reflects [TRAJ]AXES 380 | repeated EmcStatusConfigAxis axis = 4; /// Per axis configuration values. 381 | optional int32 axis_mask = 5; /// Mask of axes. Reflects [TRAJ]COORDINATES and returns the sum of the axes X=1, Y=2, Z=4, A=8, B=16, C=32, U=64, V=128, W=256. 382 | optional double cycle_time = 6; /// Polling cycle time. Reflects [TRAJ]CYCLE_TIME 383 | optional int32 debug = 7; /// Debug flag. 384 | optional EmcKinematicsType kinematics_type = 8; /// Kinematics type. 385 | //optional double linear_units = 9; // Linear units scale. Reflects [TRAJ]LINEAR_UNITS field removed 386 | optional double max_acceleration = 10; /// Maximum acceleration. Reflects [TRAJ]MAX_ACCELERATION 387 | optional double max_velocity = 11; /// Maximum velocity. Reflects [TRAJ]MAX_VELOCITY 388 | optional EmcLinearUnitsType linear_units = 12; /// Linear machine units. Reflects [TRAJ]LINEAR_UNITS 389 | optional double default_velocity = 13; /// Default velocity. Reflects [TRAJ]DEFAULT_VELOCITY 390 | repeated EmcProgramExtension program_extension = 14; /// List if program supported program extensions. 391 | optional EmcPositionOffsetType position_offset = 15; /// Position offset type. Reflects [DISPLAY]POSITION_OFFSET 392 | optional EmcPositionFeedbackType position_feedback = 16; /// Position feedback type. Reflects [DISPLAY]POSITION_FEEDBACK 393 | optional double max_feed_override = 17; /// Maximum feed override. Reflects [DISPLAY]MAX_FEED_OVERRIDE 394 | optional double min_feed_override = 18; /// Minimum feed override. Reflects [DISPLAY]MIN_FEED_OVERRIDE 395 | optional double max_spindle_override = 19; /// Maximum spindle speed override. Reflects [DISPLAY]MAX_SPINDLE_OVERRIDE 396 | optional double min_spindle_override = 20; /// Minimum spindle override. Reflects [DISPLAY]MIN_SPINDLE_OVERRIDE 397 | optional double default_spindle_speed = 21; /// Default spindle speed. Reflects [DISPLAY]DEFAULT_SPINDLE_SPEED 398 | optional double default_linear_velocity = 22; /// Default linear velocity. Reflects [DISPLAY]DEFAULT_LINEAR_VELOCITY 399 | optional double min_velocity = 23; /// Minimum velocity override. Reflects [DISPLAY]MIN_VELOCITY 400 | optional double max_linear_velocity = 24; /// Maximum linear velocity. Reflects [DISPLAY]MAX_LINEAR_VELOCITY 401 | optional double min_linear_velocity = 25; /// Minimum linear velocity. Reflects [DISPLAY]MIN_LINEAR_VELOCITY 402 | optional double default_angular_velocity = 26; /// Default angular velocity. Reflects [DISPLAY]DEFAULT_ANGULAR_VELOCITY 403 | optional double max_angular_velocity = 27; /// Maximum angular velocity. Reflects [DISPLAY]MAX_ANGULAR_VELOCITY 404 | optional double min_angular_velocity = 28; /// Minimum angular velocity. Reflects [DISPLAY]MIN_ANGULAR_VELOCITY 405 | optional string increments = 29; /// White space separated jog increments. Reflects [DISPLAY]INCREMENTS 406 | optional string grids = 30; /// Grid intervals. Reflects [DISPLAY]GRIDS 407 | optional bool lathe = 31; /// Is machine a lathe. Reflects [DISPLAY]LATHE 408 | optional string geometry = 32; /// Geometry of machine. E.g. XYZ. Reflects [DISPLAY]GEOMETRY 409 | optional uint32 arcdivision = 33; /// Display granularity for arcs. Reflects [DISPLAY]ARCDIVISION 410 | optional bool no_force_homing = 34; /// Do not enforce homing. Reflects [DISPLAY]NO_FORCE_HOMING 411 | optional string remote_path = 35; /// Remote file path. Reflects [DISPLAY]PROGRAM_PREFIX 412 | optional EmcTimeUnitsType time_units = 36; /// Time units type. Reflects [DISPLAY]TIME_UNITS 413 | optional string name = 37; /// Machine name. Reflects [EMC]MACHINE 414 | repeated EmcStatusUserCommand user_command = 38; /// List of user commands. Reflects [DISPLAY]USER_COMMAND 415 | optional EmcAngularUnitsType angular_units = 39; /// Angular machine units. Reflects [TRAJ]ANGULAR_UNITS 416 | optional int32 joints = 40; /// Number of joints. Reflects [TRAJ]JOINTS 417 | repeated EmcStatusConfigJoint joint = 41; /// Per joint configuration value 418 | optional int32 extrajoints = 42; /// Number of extra joints (not used in kinematics); 419 | optional int32 spindles = 43; /// Number of spindles. 420 | } 421 | 422 | /** 423 | * EMC status motion message. 424 | */ 425 | message EmcStatusMotion { 426 | 427 | option (nanopb_msgopt).msgid = 1111; 428 | 429 | optional int32 active_queue = 1; /// Number of motions blending. 430 | optional Position actual_position = 2; /// Current trajectory position. 431 | optional bool adaptive_feed_enabled = 3; /// Status of adaptive feed override. 432 | repeated EmcStatusAnalogIO ain = 4; /// Status of analog input pins. 433 | repeated EmcStatusAnalogIO aout = 5; /// Status of analog output pins. 434 | repeated EmcStatusMotionAxis axis = 6; /// Per axis motion values. 435 | optional bool block_delete = 7; /// Block delete on or off. 436 | optional int32 current_line = 8; /// Currently executing line. 437 | optional double current_vel = 9; /// Current velocity in Cartesian space. 438 | optional double delay_left = 10; /// Remaining time on dwell (G4) command. 439 | repeated EmcStatusDigitalIO din = 11; /// Status of digital input pins. 440 | optional double distance_to_go = 12; /// Remaining distance of current move reported by trajectory planner. 441 | repeated EmcStatusDigitalIO dout = 13; /// Status of digital output pins. 442 | optional Position dtg = 14; /// Remaining distance of current move reported by trajectory planner. 443 | optional bool enabled = 15; /// Trajectory planner enabled flag. 444 | optional bool feed_hold_enabled = 16; /// Enable flag for feed hold. 445 | optional bool feed_override_enabled = 17; /// Enable flag for feed override. 446 | optional double feedrate = 18; /// Current feedrate override. 447 | optional OriginIndex g5x_index = 19; /// Currently active coordinate system. 448 | optional Position g5x_offset = 20; /// Offset of the currently active coordinate system. 449 | optional Position g92_offset = 21; /// Current G92 offset. 450 | optional int32 id = 23; /// Currently executing motion id. 451 | optional bool inpos = 24; /// Machine in position flag. 452 | optional Position joint_actual_position = 25; /// Actual joint position. 453 | optional Position joint_position = 26; /// Desired joint position. 454 | repeated EmcStatusLimit limit = 27; /// Axis limit masks. 455 | optional int32 motion_line = 28; /// Source line number motion is currently executing. Relation to id is unclear. 456 | optional MotionType motion_type = 29; /// Trajectory planner mode. 457 | optional EmcTrajectoryModeType motion_mode = 30; /// Trajectory mode. 458 | optional bool paused = 31; /// Motion paused flag. 459 | optional Position position = 32; /// Trajectory position. 460 | optional bool probe_tripped = 33; /// True if probe has tripped. 461 | optional int32 probe_val = 34; /// Reflects the value of the motion.probe-input pin 462 | optional Position probed_position = 35; /// Position where probe has tripped 463 | optional bool probing = 36; /// Probe operation in progress. 464 | optional int32 queue = 37; /// Current size of trajectory planner queue. 465 | optional bool queue_full = 38; /// Trajectory planner queue is full. 466 | optional double rotation_xy = 39; /// Current XY rotation around Z axis. 467 | optional bool spindle_brake = 40; /// Spindle braked. 468 | optional int32 spindle_direction = 41; /// Rotational direction of the spindle. forward=1, reverse=-1. 469 | optional bool spindle_enabled = 42; /// Spindle enabled. 470 | optional int32 spindle_increasing = 43; /// Spindle speed is increasing. 471 | optional bool spindle_override_enabled = 44; /// Spindle override is enabled. 472 | optional double spindle_speed = 45; /// Spindle speed value in rpm. > 0 is clockwise, < 0 is counterclockwise 473 | optional double spindlerate = 46; /// Spindle speed override. 474 | optional RCS_STATUS state = 47; /// Current command execution status. 475 | optional double max_velocity = 48; /// Maximum velocity override. 476 | optional double max_acceleration = 49; /// TODO remove 477 | optional double rapidrate = 50; /// Current rapid override. 478 | repeated EmcStatusMotionJoint joint = 51; /// Per joint motion values. 479 | repeated EmcStatusMotionSpindle spindle = 52; /// Per spindle motion values. 480 | optional int32 g5x_index_extended = 53; /// Currently active coordinate system, extended index. 481 | } 482 | 483 | /** 484 | * EMC IO message. 485 | */ 486 | message EmcStatusIo { 487 | 488 | option (nanopb_msgopt).msgid = 1112; 489 | 490 | optional bool estop = 1; /// Estop active. 491 | optional bool flood = 2; /// Flood enabled. 492 | optional bool lube = 3; /// Lube enabled. 493 | optional bool lube_level = 4; /// Lube level. Reflects iocontrol.0.lube_level 494 | optional bool mist = 5; /// Mist enabled. 495 | //optional bool pocket_prepped = 6; /// replaced with field 10 496 | //optional bool tool_in_spindle = 7; /// replaced with field 11 497 | optional Position tool_offset = 8; /// Offset values of the current tool. 498 | repeated EmcToolData tool_table = 9; /// List of tool entries. 499 | optional int32 pocket_prepped = 10; /// A Tx command completed and this pocket is prepared 500 | optional int32 tool_in_spindle = 11; /// Current tool number. 501 | } 502 | 503 | /** 504 | * EMC status task message. 505 | */ 506 | message EmcStatusTask { 507 | 508 | option (nanopb_msgopt).msgid = 1113; 509 | 510 | /** 511 | * The serial number of the last executed command set by a UI to task. 512 | * All commands carry a serial number. Once the command has been executed, 513 | * its serial number is reflected in echo_serial_number. 514 | */ 515 | optional int32 echo_serial_number = 1; 516 | optional EmcTaskExecStateType exec_state = 2; /// Task execution state. 517 | optional string file = 3; /// Currently executing gcode file. 518 | optional bool input_timeout = 4; /// Flag for M66 timer in progress. 519 | optional bool optional_stop = 5; /// Optional stop enabled. 520 | optional int32 read_line = 6; /// Line the RS274NGC interpreter is currently reading. TODO move to interp 521 | optional EmcTaskModeType task_mode = 7; /// Current task mode. 522 | optional int32 task_paused = 8; /// Task paused. 523 | optional EmcTaskStateType task_state = 9; /// Current task state. 524 | optional int32 total_lines = 10; /// Total number of lines of currently active program file. 525 | optional int32 call_level = 11; /// Call level 526 | } 527 | 528 | /** 529 | * EMC status interpreter message. 530 | */ 531 | message EmcStatusInterp { 532 | 533 | option (nanopb_msgopt).msgid = 1114; 534 | 535 | optional string command = 1; /// Currently executing command. 536 | repeated EmcStatusGCode gcodes = 2; /// Currently active GCodes. 537 | optional EmcInterpStateType interp_state = 3; /// Current state of RS274NGC interpreter. 538 | optional EmcInterpExitCodeType interpreter_errcode = 4; /// Current RS274NGC interpreter return code. 539 | repeated EmcStatusMCode mcodes = 5; /// Currently active MCodes. 540 | repeated EmcStatusSetting settings = 6; /// Current interpreter settings. [0] = sequence number, [1] = feed rate, [2] = velocity 541 | optional EmcCanonUnitsType program_units = 7; /// Current interpreter program units. 542 | } 543 | 544 | /** 545 | * EMC command parameters. 546 | */ 547 | message EmcCommandParameters { 548 | 549 | option (nanopb_msgopt).msgid = 1115; 550 | 551 | optional uint32 index = 1; /// General purpose index. 552 | optional uint32 debug_level = 2; /// Debug level. 553 | optional int32 line_number = 3; /// General purpose line number. 554 | optional double scale = 4; /// General purpose scale value. 555 | optional double velocity = 5; /// General purpose velocity value. 556 | optional double distance = 6; /// General purpose distance value. 557 | optional double value = 7; /// General purpose value. 558 | optional bool enable = 8; /// General purpose enable value. 559 | optional string command = 9; /// General purpose command string. 560 | optional string path = 10; /// General purpose path string. 561 | optional EmcTaskModeType task_mode = 100; /// Task mode. 562 | optional EmcTaskStateType task_state = 101; /// Task state. 563 | optional EmcTrajectoryModeType traj_mode = 102; /// Trajectory mode. 564 | optional EmcPose pose = 103; /// General purpose pose. 565 | optional EmcToolData tool_data = 104; /// Tool data. 566 | repeated EmcToolData tool_table = 105; /// Complete tool table. 567 | } 568 | 569 | /** 570 | * User command message. 571 | */ 572 | message EmcStatusUserCommand { 573 | 574 | option (nanopb_msgopt).msgid = 1116; 575 | 576 | required int32 index = 1; /// User command index. 577 | optional string command = 2; /// User command separated by semicolon. E.g. G1A20;G1A0 Remove Filament. 578 | } 579 | 580 | /** 581 | * EMC status user interface message. 582 | */ 583 | message EmcStatusUI { 584 | option (nanopb_msgopt).msgid = 1117; 585 | 586 | optional bool spindle_brake_visible = 1; /// Spindle brake control visible 587 | optional bool spindle_cw_visible = 2; /// Spindle CW control visible 588 | optional bool spindle_ccw_visible = 3; /// Spindle CCW control visible 589 | optional bool spindle_stop_visible = 4; /// Spindle stop control visible 590 | optional bool spindle_plus_visible = 5; /// Spindle plus control visible 591 | optional bool spindle_minus_visible = 6; /// Spindle minus control visible 592 | optional bool spindle_override_visible = 7; /// Spindle override control visible 593 | optional bool coolant_flood_visible = 8; /// Coolant flood control visible 594 | optional bool coolant_mist_visible = 9; /// Coolant mist control visible 595 | } 596 | -------------------------------------------------------------------------------- /src/machinetalk/protobuf/task.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | // interpreter protocol messages 3 | 4 | 5 | // for the following commands the message type in Container is sufficient 6 | // so no submessage needed: 7 | 8 | // MT_EMC_TASK_INIT_TYPE = 10501; 9 | // MT_EMC_TASK_ABORT_TYPE = 10503; 10 | // MT_EMC_TASK_PLAN_CLOSE_TYPE = 10514; 11 | // MT_EMC_TASK_PLAN_INIT_TYPE = 10515; 12 | // MT_EMC_TASK_HALT_TYPE = 10502; 13 | // MT_EMC_TASK_PLAN_SYNCH_TYPE = 10516; 14 | // MT_EMC_TASK_PLAN_RESET_TYPE = 10520; 15 | 16 | // the following commands contain submessages: 17 | // MT_EMC_TASK_PLAN_EXECUTE_TYPE = 10509; // TaskPlanExecute 18 | // MT_EMC_TASK_PLAN_SET_BLOCK_DELETE_TYPE = 10518; // TaskPlanBlockDelete 19 | // MT_EMC_TASK_PLAN_SET_OPTIONAL_STOP_TYPE = 10517; // TaskPlanOptionalStop 20 | // MT_EMC_TASK_PLAN_OPEN_TYPE = 10506; // TaskPlanOpen 21 | 22 | 23 | // unlcear usage: 24 | 25 | // MT_EMC_TASK_SET_MODE_TYPE = 10504; 26 | // MT_EMC_TASK_SET_STATE_TYPE = 10505; 27 | // MT_EMC_TASK_PLAN_RUN_TYPE = 10507; 28 | // MT_EMC_TASK_PLAN_READ_TYPE = 10508; 29 | // MT_EMC_TASK_PLAN_PAUSE_TYPE = 10510; 30 | // MT_EMC_TASK_PLAN_STEP_TYPE = 10511; 31 | // MT_EMC_TASK_PLAN_RESUME_TYPE = 10512; 32 | // MT_EMC_TASK_PLAN_END_TYPE = 10513; 33 | // MT_EMC_TASK_PLAN_OPTIONAL_STOP_TYPE = 10519; 34 | // MT_EMC_TASK_STAT_TYPE = 10599; 35 | 36 | // interpreter reply to a command: 37 | // MT_EMC_TASK_PLAN_REPLY = 10530; 38 | 39 | import "machinetalk/protobuf/types.proto"; 40 | import "machinetalk/protobuf/nanopb.proto"; 41 | 42 | // see README.msgid 43 | // msgid base: 1200 44 | 45 | package machinetalk; 46 | 47 | 48 | message TaskPlanExecute { 49 | 50 | option (nanopb_msgopt).msgid = 1200; // see README.msgid 51 | 52 | 53 | optional string command = 10; // "MDI" 54 | optional sfixed32 line = 30; 55 | }; 56 | 57 | message TaskPlanBlockDelete { 58 | 59 | option (nanopb_msgopt).msgid = 1201; 60 | 61 | required bool state = 10; 62 | }; 63 | 64 | message TaskPlanOptionalStop { 65 | 66 | option (nanopb_msgopt).msgid = 1202; 67 | 68 | required bool state = 10; 69 | }; 70 | 71 | message TaskPlanOpen { 72 | 73 | option (nanopb_msgopt).msgid = 1203; 74 | 75 | required string filename = 10; 76 | }; 77 | 78 | message TaskPlanReply { 79 | 80 | option (nanopb_msgopt).msgid = 1204; 81 | 82 | required ContainerType cmd = 10; 83 | optional string errormsg = 20; 84 | }; 85 | 86 | 87 | // Ticket msgs 88 | message TaskReply { 89 | 90 | option (nanopb_msgopt).msgid = 1205; 91 | 92 | required fixed32 ticket = 10; 93 | }; 94 | 95 | // signal completion of a particular ticket 96 | message TicketUpdate { 97 | 98 | option (nanopb_msgopt).msgid = 1206; 99 | 100 | required fixed32 cticket = 10; 101 | required RCS_STATUS status = 20; 102 | optional string text = 30; 103 | }; 104 | -------------------------------------------------------------------------------- /src/machinetalk/protobuf/test.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | // use any of the below for testing and experimentation. 3 | 4 | import "machinetalk/protobuf/emcclass.proto"; 5 | import "machinetalk/protobuf/nanopb.proto"; 6 | 7 | package machinetalk; 8 | 9 | // see README.msgid 10 | // msgid base: 1300 11 | 12 | enum TestOpType { 13 | LINE = 10; 14 | CIRCLE = 20; 15 | }; 16 | 17 | 18 | message Test1 { 19 | 20 | option (nanopb_msgopt).msgid = 1300; // see README.msgid 21 | 22 | // minimum params to encode line or circle 23 | required TestOpType op = 10; 24 | required EmcPose end = 20; 25 | optional PmCartesian center = 30; 26 | optional PmCartesian normal = 40; 27 | optional int32 turn = 50; 28 | } 29 | 30 | 31 | message Test2 { 32 | 33 | option (nanopb_msgopt).msgid = 1301; 34 | 35 | } 36 | 37 | 38 | message Test3 { 39 | 40 | option (nanopb_msgopt).msgid = 1302; 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/machinetalk/protobuf/types.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | // fundamental types 3 | import "machinetalk/protobuf/nanopb.proto"; 4 | 5 | // see README.msgid 6 | // msgid base: 1400 7 | 8 | package machinetalk; 9 | 10 | enum ValueType { 11 | // the following tags correspond to hal.h: hal_type_t; 12 | HAL_BIT = 1; 13 | HAL_FLOAT = 2; 14 | HAL_S32 = 3; 15 | HAL_U32 = 4; 16 | HAL_S64 = 5; 17 | HAL_U64 = 6; 18 | // STRING and BYTES not currently used 19 | STRING = 7; 20 | BYTES = 8; 21 | 22 | INT32 = 20; 23 | UINT32 = 30; 24 | INT64 = 40; 25 | UINT64 = 50; 26 | DOUBLE = 60; 27 | BOOL = 80; 28 | 29 | CARTESIAN = 100; 30 | LEGACY_CARTESIAN = 110; 31 | POSE = 120; 32 | LEGACY_POSE = 130; 33 | } 34 | 35 | enum HalPinDirection { 36 | // the following tags correspond to hal.h: hal_pin_dir_t 37 | HAL_IN = 16; 38 | HAL_OUT = 32; 39 | HAL_IO = 48; // (HAL_IN | HAL_OUT), 40 | } 41 | 42 | enum HalParamDirection { 43 | // the following tags correspond to hal.h: hal_param_dir_t 44 | HAL_RO = 64; 45 | HAL_RW = 192; 46 | } 47 | 48 | enum HalFunctType { 49 | FS_LEGACY_THREADFUNC = 0; // legacy API 50 | FS_XTHREADFUNC = 1; // extended API 51 | FS_USERLAND = 2; // userland-callable, with argc/arv vector 52 | } 53 | 54 | enum ObjectType { 55 | // the following tags correspond to hal.h:hal_object_type 56 | HAL_OBJECT_INVALID = 0; 57 | HAL_PIN = 1; 58 | HAL_SIGNAL = 2; 59 | HAL_PARAM = 3; 60 | HAL_THREAD = 4; 61 | HAL_FUNCT = 5; 62 | HAL_COMPONENT = 6; 63 | HAL_VTABLE = 7; 64 | HAL_INST = 8; 65 | HAL_RING = 9; 66 | HAL_GROUP = 10; 67 | HAL_MEMBER = 11; 68 | HAL_PLUG = 12; 69 | 70 | // used at all? 71 | // VALUE = 120; 72 | // INSTANCE = 121; 73 | // ORIGINATOR = 122; 74 | // NAMED_VALUE = 125; 75 | // OT_ERROR = 130; 76 | } 77 | 78 | enum msgidType { 79 | // all "option (nanopb_msgopt).msgid = MUST be less than MSGID_MAX 80 | MSGID_MAX = 4000; 81 | 82 | // the empty zeromq frame which delimits route from payload 83 | MSGID_ROUTE_DELIMITER = 4001; 84 | 85 | // inband error message - use if a comp needs to signal an error with zeroMQ framing etc 86 | MSGID_ERROR_MSG = 4002; 87 | 88 | // an uninterpreted blob: 89 | MSGID_BLOB = 4003; 90 | // an uninterpreted string: 91 | MSGID_STRING = 4004; 92 | 93 | // when using multiframe rings with zeromq router/dealer, routing elements are 94 | // tagged MSGID_HOP 95 | MSGID_HOP = 4005; 96 | } 97 | 98 | enum socketType { 99 | ST_ZMQ_PAIR = 0; 100 | ST_ZMQ_PUB = 1; 101 | ST_ZMQ_SUB = 2; 102 | ST_ZMQ_REQ = 3; 103 | ST_ZMQ_REP = 4; 104 | ST_ZMQ_DEALER = 5; 105 | ST_ZMQ_ROUTER = 6; 106 | ST_ZMQ_PULL = 7; 107 | ST_ZMQ_PUSH = 8; 108 | ST_ZMQ_XPUB = 9; 109 | ST_ZMQ_XSUB = 10; 110 | ST_ZMQ_STREAM = 11; 111 | 112 | ST_ZMQ_INVALID = 15; 113 | }; 114 | 115 | enum securityMechanism { 116 | SM_ZMQ_NONE = -1; 117 | SM_ZMQ_NULL = 0; 118 | SM_ZMQ_PLAIN = 1; 119 | SM_ZMQ_CURVE = 2; 120 | }; 121 | 122 | enum RCS_STATUS { 123 | UNINITIALIZED_STATUS = -1; 124 | RCS_DONE = 1; 125 | RCS_EXEC = 2; 126 | RCS_ERROR = 3; 127 | RCS_RECEIVED = 4; 128 | }; 129 | 130 | // see rtapi.h 131 | enum MsgOrigin { 132 | MSG_KERNEL = 0; 133 | MSG_RTUSER = 1; 134 | MSG_ULAPI = 2; 135 | }; 136 | 137 | 138 | enum MsgLevel { 139 | // see enum msg_level_t in rtapi.h 140 | RTAPI_MSG_NONE = 0; 141 | RTAPI_MSG_ERR = 1; 142 | RTAPI_MSG_WARN = 2; 143 | RTAPI_MSG_INFO = 3; 144 | RTAPI_MSG_DBG = 4; 145 | RTAPI_MSG_ALL = 5; 146 | } 147 | 148 | enum OriginDetail { 149 | UNIX_SIGNAL = 10; 150 | INSTANCE_SHUTDOWN = 20; 151 | ZMQ_SOCKET = 70; 152 | NML_LAYER = 80; 153 | RCS_LAYER = 90; 154 | CMS_LAYER = 100; 155 | IP_LAYER = 110; 156 | TCP_LAYER = 120; 157 | PGM_LAYER = 130; 158 | } 159 | 160 | enum OriginType { 161 | PROCESS = 10; 162 | USER_THREAD = 20; 163 | RT_THREAD = 30; 164 | COMPONENT = 40; 165 | THREAD_FUNCTION = 50; 166 | COMPONENT_INIT = 60; 167 | COMPONENT_EXIT = 70; 168 | GROUP = 80; 169 | PIN = 90; 170 | SIGNAL = 100; 171 | } 172 | 173 | enum Severity { 174 | S_INFORMATIONAL = 1; 175 | S_WARNING = 2; 176 | S_FAIL = 4; 177 | } 178 | 179 | enum StatusType { 180 | ENQUEUED = 1; // intermediate 181 | PROCESSING = 2; // -- '' -- 182 | COMPLETE = 3; // final 183 | FAILED = 4; // -- '' -- 184 | } 185 | 186 | enum ReplyType { 187 | // NONE wont work with zmq REQ/REP sockets: 188 | // they require a reply 189 | // better to use XREQ/XREP 190 | NONE = 0; 191 | ON_RECEPTION = 1; 192 | ON_QUEUED = 2; 193 | ON_COMPLETION = 4; 194 | 195 | ALL_STEPS = 255; 196 | } 197 | 198 | // services exported by various entities 199 | enum ServiceType { 200 | 201 | ST_LOGGING = 1; 202 | ST_CONFIG = 2; 203 | ST_REDIS = 3; 204 | ST_HTTP = 4; 205 | ST_HTTPS = 5; 206 | ST_WEBSOCKET = 6; 207 | ST_WEBSOCKETS = 7; 208 | ST_RTAPI_COMMAND = 8; 209 | 210 | ST_STP_HALGROUP = 9; 211 | ST_STP_HALRCOMP = 10; 212 | ST_STP_INTERP = 11; 213 | ST_STP_TASK = 12; 214 | 215 | ST_HAL_RCOMMAND = 13; 216 | ST_TASK_COMMAND = 14; 217 | ST_INTERP_COMMAND = 15; 218 | 219 | ST_MESSAGEBUS_COMMAND = 16; 220 | ST_MESSAGEBUS_RESPONSE = 17; 221 | } 222 | 223 | enum ServiceAPI { 224 | SA_ZMQ_PROTOBUF = 1; 225 | SA_WS_JSON = 2; 226 | } 227 | 228 | enum ContainerType { 229 | 230 | MT_RTMESSAGE = 2; 231 | MT_MOTCMD = 3; 232 | MT_MOTSTATUS = 4; 233 | MT_LEGACY_MOTCMD = 5; 234 | MT_LEGACY_MOTSTATUS = 6; 235 | MT_WOU = 7; 236 | MT_HALUPDATE = 8; 237 | MT_RTAPI_MESSAGE = 9; 238 | MT_LOG_MESSAGE = 10; 239 | 240 | MT_PREVIEW = 11; 241 | MT_PROGRESS = 12; 242 | MT_INTERP_STAT = 13; 243 | 244 | MT_SYSLOG = 18; 245 | MT_LEGACY_NML = 19; 246 | MT_LEGACY_MOTCONFIG = 20; 247 | 248 | 249 | // MT_HALUPDATE_FULL = 25; 250 | MT_STP_UPDATE_FULL = 26; 251 | MT_STP_UPDATE = 28; 252 | MT_STP_NOGROUP = 27; 253 | 254 | // MT_OFFER = 30; 255 | // MT_CONFIRM_OFFER = 35; 256 | // MT_DISPLAY_MESSAGE = 40; 257 | MT_SHUTDOWN = 45; 258 | MT_CONFIRM_SHUTDOWN = 50; 259 | 260 | // identification of individual RTMessage submessages 261 | // field Container.rtmessage 262 | MT_RTMESSAGE0 = 30; 263 | MT_RTMESSAGE1 = 31; 264 | MT_RTMESSAGE2 = 32; 265 | MT_RTMESSAGE3 = 33; 266 | MT_RTMESSAGE4 = 34; 267 | 268 | 269 | MT_ASCII = 100; 270 | MT_UNICODE = 101; 271 | MT_GCODE = 102; 272 | MT_PYTHON = 103; 273 | MT_PICKLE = 104; 274 | MT_TCL = 105; 275 | MT_XML = 106; 276 | MT_JSON = 107; 277 | MT_JPEG = 108; 278 | MT_PNG = 109; 279 | MT_TIFF = 110; 280 | MT_POSTSCRIPT = 111; 281 | MT_SVG = 112; 282 | 283 | // in-band zeroMQ commands, evaluated in webtalk_jsonpolicy.cc 284 | 285 | MT_ZMQ_SUBSCRIBE = 150; 286 | MT_ZMQ_UNSUBSCRIBE = 151; 287 | 288 | MT_PING = 210; // keepalive test 289 | MT_PING_ACKNOWLEDGE = 215; 290 | MT_REJECT = 220; 291 | MT_DONE = 240; 292 | 293 | // ask for a specific list of services as specified in a ServiceRequest 294 | MT_SERVICE_REQUEST = 250; 295 | // respond to the above with one or several ServiceDescription messages 296 | MT_SERVICE_ANNOUNCEMENT = 251; 297 | // query for all available services 298 | MT_SERVICE_PROBE = 252; 299 | 300 | // error message generated by messagebus 301 | // also fills in note, destinaton 302 | MT_MESSAGEBUS_NO_DESTINATION = 255; 303 | 304 | // rcomp creation and binding 305 | MT_HALRCOMP_BIND = 256; 306 | MT_HALRCOMP_BIND_CONFIRM = 257; 307 | MT_HALRCOMP_BIND_REJECT = 258; 308 | 309 | // the following to a similar to MT_HALRCOMMAND_SET and MT_HALRCOMMAND_GET, except 310 | // in the context of HALRcomp, only pins and params are evaluated 311 | // also, to set a pin or param, it must have direction HAL_OUT or HAL_IO 312 | MT_HALRCOMP_SET = 259; 313 | MT_HALRCOMP_SET_REJECT = 260; 314 | MT_HALRCOMP_ACK = 263; 315 | 316 | // HAL object general setter/getter operations 317 | // these work as viewed from halcmd and include signals 318 | MT_HALRCOMMAND_SET = 265; 319 | MT_HALRCOMMAND_SET_REJECT = 266; 320 | 321 | MT_HALRCOMMAND_GET = 267; 322 | MT_HALRCOMMAND_GET_REJECT = 268; 323 | 324 | MT_HALRCOMMAND_CREATE = 269; 325 | MT_HALRCOMMAND_CREATE_REJECT = 270; 326 | 327 | MT_HALRCOMMAND_DELETE = 271; 328 | MT_HALRCOMMAND_DELETE_REJECT = 272; 329 | 330 | MT_HALRCOMMAND_ACK = 273; 331 | MT_HALRCOMMAND_ERROR = 274; 332 | 333 | // introspection request 334 | MT_HALRCOMMAND_DESCRIBE = 276; 335 | // full HAL description 336 | MT_HALRCOMMAND_DESCRIPTION = 277; 337 | 338 | // rcomp tracking 339 | MT_HALRCOMP_FULL_UPDATE = 288; 340 | MT_HALRCOMP_INCREMENTAL_UPDATE = 289; 341 | MT_HALRCOMP_ERROR = 290; 342 | 343 | // group creation and binding 344 | MT_HALGROUP_BIND = 294; 345 | MT_HALGROUP_BIND_CONFIRM = 295; 346 | MT_HALGROUP_BIND_REJECT = 296; 347 | 348 | // group tracking 349 | MT_HALGROUP_FULL_UPDATE = 297; 350 | MT_HALGROUP_INCREMENTAL_UPDATE = 298; 351 | MT_HALGROUP_ERROR = 299; 352 | 353 | 354 | // rtapi_app commands from halcmd: 355 | MT_RTAPI_APP_EXIT = 300; 356 | MT_RTAPI_APP_PING = 301; 357 | MT_RTAPI_APP_LOADRT = 302; 358 | MT_RTAPI_APP_LOG = 303; 359 | MT_RTAPI_APP_UNLOADRT= 305; 360 | MT_RTAPI_APP_NEWINST= 306; 361 | MT_RTAPI_APP_NEWTHREAD = 307; 362 | MT_RTAPI_APP_DELTHREAD = 308; 363 | MT_RTAPI_APP_CALLFUNC = 309; 364 | 365 | MT_RTAPI_APP_REPLY = 310; 366 | MT_RTAPI_APP_DELINST= 311; 367 | 368 | 369 | // application discovery 370 | MT_LIST_APPLICATIONS = 350; 371 | // this is answered with a MT_DESCRIBE_APPLICATION type 372 | // and repeated field apps 373 | // (see message Application) 374 | MT_DESCRIBE_APPLICATION = 351; 375 | 376 | MT_RETRIEVE_APPLICATION = 352; 377 | // this is answered with a MT_APPLICATION_DETAIL type and 378 | // a single field apps 379 | // BUT all files and config items are attached in the 380 | // message Application 381 | MT_APPLICATION_DETAIL = 353; 382 | 383 | // generic error reply. note field contains explanation. 384 | MT_ERROR = 360; 385 | 386 | // generic full update and incremental update 387 | MT_FULL_UPDATE = 370; 388 | MT_INCREMENTAL_UPDATE = 371; 389 | 390 | // generic cmd reply 391 | MT_CMD_COMPLETE = 380; 392 | 393 | // task/client comms 394 | MT_TASK_REPLY = 400; 395 | MT_TICKET_UPDATE = 401; 396 | 397 | // credit-based flow control for queues 398 | MT_CREDIT_UPDATE = 450; // sent by consumer 399 | 400 | // Motion command types. Frequently used, so bring in at offset 1000. 401 | // (see emc/motion/motion.h) 402 | 403 | // in case a Motion message type was added: 404 | // first run: make 405 | // then manually include protobuf/generated/mottypes.proto here 406 | 407 | // adjust this to be below lowest motion message type 408 | MT_EMCMOT_LOWER = 1000; 409 | // adjust this to be above highest motion message type 410 | MT_EMCMOT_UPPER = 1100; 411 | // neded for the is_Motion_container(msgtype) test in container.hh 412 | 413 | // --- snip --- 414 | MT_EMCMOT_ABORT = 1001; 415 | MT_EMCMOT_AXIS_ABORT = 1002; 416 | MT_EMCMOT_ENABLE = 1003; 417 | MT_EMCMOT_DISABLE = 1004; 418 | MT_EMCMOT_ENABLE_AMPLIFIER = 1005; 419 | MT_EMCMOT_DISABLE_AMPLIFIER = 1006; 420 | MT_EMCMOT_ENABLE_WATCHDOG = 1007; 421 | MT_EMCMOT_DISABLE_WATCHDOG = 1008; 422 | MT_EMCMOT_ACTIVATE_JOINT = 1009; 423 | MT_EMCMOT_DEACTIVATE_JOINT = 1010; 424 | MT_EMCMOT_PAUSE = 1011; 425 | MT_EMCMOT_RESUME = 1012; 426 | MT_EMCMOT_STEP = 1013; 427 | MT_EMCMOT_FREE = 1014; 428 | MT_EMCMOT_COORD = 1015; 429 | MT_EMCMOT_TELEOP = 1016; 430 | MT_EMCMOT_SPINDLE_SCALE = 1017; 431 | MT_EMCMOT_SS_ENABLE = 1018; 432 | MT_EMCMOT_FEED_SCALE = 1019; 433 | MT_EMCMOT_FS_ENABLE = 1020; 434 | MT_EMCMOT_FH_ENABLE = 1021; 435 | MT_EMCMOT_AF_ENABLE = 1022; 436 | MT_EMCMOT_OVERRIDE_LIMITS = 1023; 437 | MT_EMCMOT_HOME = 1024; 438 | MT_EMCMOT_UNHOME = 1025; 439 | MT_EMCMOT_JOG_CONT = 1026; 440 | MT_EMCMOT_JOG_INCR = 1027; 441 | MT_EMCMOT_JOG_ABS = 1028; 442 | MT_EMCMOT_SET_LINE = 1029; 443 | MT_EMCMOT_SET_CIRCLE = 1030; 444 | MT_EMCMOT_SET_TELEOP_VECTOR = 1031; 445 | MT_EMCMOT_CLEAR_PROBE_FLAGS = 1032; 446 | MT_EMCMOT_PROBE = 1033; 447 | MT_EMCMOT_RIGID_TAP = 1034; 448 | MT_EMCMOT_SET_POSITION_LIMITS = 1035; 449 | MT_EMCMOT_SET_BACKLASH = 1036; 450 | MT_EMCMOT_SET_MIN_FERROR = 1037; 451 | MT_EMCMOT_SET_MAX_FERROR = 1038; 452 | MT_EMCMOT_SET_VEL = 1039; 453 | MT_EMCMOT_SET_VEL_LIMIT = 1040; 454 | MT_EMCMOT_SET_JOINT_VEL_LIMIT = 1041; 455 | MT_EMCMOT_SET_JOINT_ACC_LIMIT = 1042; 456 | MT_EMCMOT_SET_ACC = 1043; 457 | MT_EMCMOT_SET_TERM_COND = 1044; 458 | MT_EMCMOT_SET_NUM_AXES = 1045; 459 | MT_EMCMOT_SET_WORLD_HOME = 1046; 460 | MT_EMCMOT_SET_HOMING_PARAMS = 1047; 461 | MT_EMCMOT_SET_DEBUG = 1048; 462 | MT_EMCMOT_SET_DOUT = 1049; 463 | MT_EMCMOT_SET_AOUT = 1050; 464 | MT_EMCMOT_SET_SPINDLESYNC = 1051; 465 | MT_EMCMOT_SPINDLE_ON = 1052; 466 | MT_EMCMOT_SPINDLE_OFF = 1053; 467 | MT_EMCMOT_SPINDLE_INCREASE = 1054; 468 | MT_EMCMOT_SPINDLE_DECREASE = 1055; 469 | MT_EMCMOT_SPINDLE_BRAKE_ENGAGE = 1056; 470 | MT_EMCMOT_SPINDLE_BRAKE_RELEASE = 1057; 471 | MT_EMCMOT_SET_MOTOR_OFFSET = 1058; 472 | MT_EMCMOT_SET_JOINT_COMP = 1059; 473 | MT_EMCMOT_SET_OFFSET = 1060; 474 | MT_EMCMOT_COMMAND_OK = 1061; 475 | MT_EMCMOT_COMMAND_UNKNOWN_COMMAND = 1062; 476 | MT_EMCMOT_COMMAND_INVALID_COMMAND = 1063; 477 | MT_EMCMOT_COMMAND_INVALID_PARAMS = 1064; 478 | MT_EMCMOT_COMMAND_BAD_EXEC = 1065; 479 | MT_EMCMOT_MOTION_DISABLED = 1066; 480 | MT_EMCMOT_MOTION_FREE = 1067; 481 | MT_EMCMOT_MOTION_TELEOP = 1068; 482 | MT_EMCMOT_MOTION_COORD = 1069; 483 | MT_EMCMOT_JOINT_FLAG = 1070; 484 | MT_EMCMOT_MOTION_FLAG = 1071; 485 | // --- snip --- 486 | 487 | // Miscellanous types 488 | 489 | MT_PRU_FIRMWARE = 2048; 490 | 491 | // Mesanet firmware types: 3000 - 3999 492 | MT_MESA_5I20_FIRMWARE = 3000; 493 | 494 | // a blob of unspecified content - for temporary use during development 495 | MT_BLOB = 4000; 496 | 497 | // test message range: 5000-5100 - never used by core code 498 | MT_TEST1 = 5001; 499 | MT_TEST2 = 5002; 500 | MT_TEST3 = 5003; 501 | 502 | // NML messsage types are offset by 10000 503 | // reserved range 10000-13000 504 | // 505 | // example: 506 | // EMC_OPERATOR_ERROR_TYPE has NMLTYPE 11 507 | // (see src/emc/nml_intf/emc.hh) 508 | // corresponding container type: 509 | // MT_EMC_OPERATOR_ERROR = 10011; 510 | // all the NML message types 511 | // just the first three for now as examples: 512 | 513 | // include the file protobuf/generated/emctypes.proto 514 | // in case an NML message types was added 515 | // first run make 516 | // then manually include protobuf/generated/emctypes.proto here 517 | 518 | 519 | // adjust this to be below lowest NML message type 520 | MT_EMC_NML_LOWER = 10000; 521 | // adjust this to be above highest NML message type 522 | MT_EMC_NML_UPPER = 13000; 523 | // neded for the is_NML_container(msgtype) test in container.hh 524 | 525 | // --- snip --- 526 | MT_EMC_OPERATOR_ERROR = 10011; 527 | MT_EMC_OPERATOR_TEXT = 10012; 528 | MT_EMC_OPERATOR_DISPLAY = 10013; 529 | MT_EMC_NULL = 10021; 530 | MT_EMC_SET_DEBUG = 10022; 531 | MT_EMC_SYSTEM_CMD = 10030; 532 | MT_EMC_AXIS_SET_AXIS = 10101; 533 | MT_EMC_AXIS_SET_UNITS = 10102; 534 | MT_EMC_AXIS_SET_MIN_POSITION_LIMIT = 10107; 535 | MT_EMC_AXIS_SET_MAX_POSITION_LIMIT = 10108; 536 | 537 | MT_EMC_TOOL_START_CHANGE = 1110; 538 | MT_EMC_EXEC_PLUGIN_CALL = 1112; 539 | MT_EMC_IO_PLUGIN_CALL = 1113; 540 | 541 | MT_EMC_AXIS_SET_FERROR = 10111; 542 | MT_EMC_AXIS_SET_HOMING_PARAMS = 10112; 543 | MT_EMC_AXIS_SET_MIN_FERROR = 10115; 544 | MT_EMC_AXIS_SET_MAX_VELOCITY = 10116; 545 | MT_EMC_AXIS_INIT = 10118; 546 | MT_EMC_AXIS_HALT = 10119; 547 | MT_EMC_AXIS_ABORT = 10120; 548 | MT_EMC_AXIS_ENABLE = 10121; 549 | MT_EMC_AXIS_DISABLE = 10122; 550 | MT_EMC_AXIS_HOME = 10123; 551 | MT_EMC_AXIS_UNHOME = 10135; 552 | MT_EMC_AXIS_JOG = 10124; 553 | MT_EMC_AXIS_INCR_JOG = 10125; 554 | MT_EMC_AXIS_ABS_JOG = 10126; 555 | MT_EMC_AXIS_ACTIVATE = 10127; 556 | MT_EMC_AXIS_DEACTIVATE = 10128; 557 | MT_EMC_AXIS_OVERRIDE_LIMITS = 10129; 558 | MT_EMC_AXIS_LOAD_COMP = 10131; 559 | MT_EMC_AXIS_SET_BACKLASH = 10134; 560 | MT_EMC_AXIS_STAT = 10199; 561 | MT_EMC_TRAJ_SET_AXES = 10201; 562 | MT_EMC_TRAJ_SET_UNITS = 10202; 563 | MT_EMC_TRAJ_SET_CYCLE_TIME = 10203; 564 | MT_EMC_TRAJ_SET_MODE = 10204; 565 | MT_EMC_TRAJ_SET_VELOCITY = 10205; 566 | MT_EMC_TRAJ_SET_ACCELERATION = 10206; 567 | MT_EMC_TRAJ_SET_MAX_VELOCITY = 10207; 568 | MT_EMC_TRAJ_SET_MAX_ACCELERATION = 10208; 569 | MT_EMC_TRAJ_SET_SCALE = 10209; 570 | MT_EMC_TRAJ_SET_MOTION_ID = 10210; 571 | MT_EMC_TRAJ_INIT = 10211; 572 | MT_EMC_TRAJ_HALT = 10212; 573 | MT_EMC_TRAJ_ENABLE = 10213; 574 | MT_EMC_TRAJ_DISABLE = 10214; 575 | MT_EMC_TRAJ_ABORT = 10215; 576 | MT_EMC_TRAJ_PAUSE = 10216; 577 | MT_EMC_TRAJ_STEP = 10217; 578 | MT_EMC_TRAJ_RESUME = 10218; 579 | MT_EMC_TRAJ_DELAY = 10219; 580 | MT_EMC_TRAJ_LINEAR_MOVE = 10220; 581 | MT_EMC_TRAJ_CIRCULAR_MOVE = 10221; 582 | MT_EMC_TRAJ_SET_TERM_COND = 10222; 583 | MT_EMC_TRAJ_SET_OFFSET = 10223; 584 | MT_EMC_TRAJ_SET_G5X = 10224; 585 | MT_EMC_TRAJ_SET_HOME = 10225; 586 | MT_EMC_TRAJ_SET_ROTATION = 10226; 587 | MT_EMC_TRAJ_SET_G92 = 10227; 588 | MT_EMC_TRAJ_CLEAR_PROBE_TRIPPED_FLAG = 10228; 589 | MT_EMC_TRAJ_PROBE = 10229; 590 | MT_EMC_TRAJ_SET_TELEOP_ENABLE = 10230; 591 | MT_EMC_TRAJ_SET_TELEOP_VECTOR = 10231; 592 | MT_EMC_TRAJ_SET_SPINDLESYNC = 10232; 593 | MT_EMC_TRAJ_SET_SPINDLE_SCALE = 10233; 594 | MT_EMC_TRAJ_SET_FO_ENABLE = 10234; 595 | MT_EMC_TRAJ_SET_SO_ENABLE = 10235; 596 | MT_EMC_TRAJ_SET_FH_ENABLE = 10236; 597 | MT_EMC_TRAJ_RIGID_TAP = 10237; 598 | MT_EMC_TRAJ_SET_RAPID_SCALE = 10238; 599 | MT_EMC_TRAJ_STAT = 10299; 600 | MT_EMC_MOTION_INIT = 10301; 601 | MT_EMC_MOTION_HALT = 10302; 602 | MT_EMC_MOTION_ABORT = 10303; 603 | MT_EMC_MOTION_SET_AOUT = 10304; 604 | MT_EMC_MOTION_SET_DOUT = 10305; 605 | MT_EMC_MOTION_ADAPTIVE = 10306; 606 | 607 | MT_EMC_SPINDLE_ORIENT = 10317; 608 | MT_EMC_SPINDLE_WAIT_ORIENT_COMPLETE = 10318; 609 | 610 | 611 | MT_EMC_MOTION_STAT = 10399; 612 | MT_EMC_TASK_INIT = 10501; 613 | MT_EMC_TASK_HALT = 10502; 614 | MT_EMC_TASK_ABORT = 10503; 615 | MT_EMC_TASK_SET_MODE = 10504; 616 | MT_EMC_TASK_SET_STATE = 10505; 617 | MT_EMC_TASK_PLAN_OPEN = 10506; 618 | MT_EMC_TASK_PLAN_RUN = 10507; 619 | MT_EMC_TASK_PLAN_READ = 10508; 620 | MT_EMC_TASK_PLAN_EXECUTE = 10509; 621 | MT_EMC_TASK_PLAN_PAUSE = 10510; 622 | MT_EMC_TASK_PLAN_STEP = 10511; 623 | MT_EMC_TASK_PLAN_RESUME = 10512; 624 | MT_EMC_TASK_PLAN_END = 10513; 625 | MT_EMC_TASK_PLAN_CLOSE = 10514; 626 | MT_EMC_TASK_PLAN_INIT = 10515; 627 | MT_EMC_TASK_PLAN_SYNCH = 10516; 628 | MT_EMC_TASK_PLAN_SET_OPTIONAL_STOP = 10517; 629 | MT_EMC_TASK_PLAN_SET_BLOCK_DELETE = 10518; 630 | MT_EMC_TASK_PLAN_OPTIONAL_STOP = 10519; 631 | MT_EMC_TASK_PLAN_RESET = 10520; 632 | MT_EMC_TASK_PLAN_REPLY = 10530; 633 | MT_EMC_TASK_STAT = 10599; 634 | MT_EMC_TOOL_INIT = 11101; 635 | MT_EMC_TOOL_HALT = 11102; 636 | MT_EMC_TOOL_ABORT = 11103; 637 | MT_EMC_TOOL_PREPARE = 11104; 638 | MT_EMC_TOOL_LOAD = 11105; 639 | MT_EMC_TOOL_UNLOAD = 11106; 640 | MT_EMC_TOOL_LOAD_TOOL_TABLE = 11107; 641 | MT_EMC_TOOL_SET_OFFSET = 11108; 642 | MT_EMC_TOOL_SET_NUMBER = 11109; 643 | MT_EMC_TOOL_UPDATE_TOOL_TABLE = 11110; 644 | MT_EMC_TOOL_STAT = 11199; 645 | MT_EMC_AUX_ESTOP_ON = 11206; 646 | MT_EMC_AUX_ESTOP_OFF = 11207; 647 | MT_EMC_AUX_ESTOP_RESET = 11208; 648 | MT_EMC_AUX_INPUT_WAIT = 11209; 649 | MT_EMC_AUX_STAT = 11299; 650 | MT_EMC_SPINDLE_ON = 11304; 651 | MT_EMC_SPINDLE_OFF = 11305; 652 | MT_EMC_SPINDLE_INCREASE = 11309; 653 | MT_EMC_SPINDLE_DECREASE = 11310; 654 | MT_EMC_SPINDLE_CONSTANT = 11311; 655 | MT_EMC_SPINDLE_BRAKE_RELEASE = 11312; 656 | MT_EMC_SPINDLE_BRAKE_ENGAGE = 11313; 657 | MT_EMC_SPINDLE_SPEED = 11316; 658 | MT_EMC_SPINDLE_STAT = 11399; 659 | MT_EMC_COOLANT_MIST_ON = 11404; 660 | MT_EMC_COOLANT_MIST_OFF = 11405; 661 | MT_EMC_COOLANT_FLOOD_ON = 11406; 662 | MT_EMC_COOLANT_FLOOD_OFF = 11407; 663 | MT_EMC_COOLANT_STAT = 11499; 664 | MT_EMC_LUBE_ON = 11504; 665 | MT_EMC_LUBE_OFF = 11505; 666 | MT_EMC_LUBE_STAT = 11599; 667 | MT_EMC_IO_INIT = 11601; 668 | MT_EMC_IO_HALT = 11602; 669 | MT_EMC_IO_ABORT = 11603; 670 | MT_EMC_IO_SET_CYCLE_TIME = 11604; 671 | MT_EMC_IO_STAT = 11699; 672 | MT_EMC_INIT = 11901; 673 | MT_EMC_HALT = 11902; 674 | MT_EMC_ABORT = 11903; 675 | MT_EMC_STAT = 11999; 676 | // --- snip --- 677 | 678 | // EMC status 679 | MT_EMCSTAT_FULL_UPDATE = 12500; 680 | MT_EMCSTAT_INCREMENTAL_UPDATE = 12501; 681 | 682 | // EMC error 683 | MT_EMC_NML_ERROR = 12510; 684 | MT_EMC_NML_TEXT = 12511; 685 | MT_EMC_NML_DISPLAY = 12512; 686 | 687 | // EMC command 688 | MT_EMCCMD_EXECUTED = 12520; 689 | MT_EMCCMD_COMPLETED = 12521; 690 | 691 | // launcher pub-sub 692 | MT_LAUNCHER_FULL_UPDATE = 12600; 693 | MT_LAUNCHER_INCREMENTAL_UPDATE = 12601; 694 | MT_LAUNCHER_ERROR = 12602; 695 | // launcher command 696 | MT_LAUNCHER_START = 12610; 697 | MT_LAUNCHER_TERMINATE = 12611; 698 | MT_LAUNCHER_KILL = 12612; 699 | MT_LAUNCHER_WRITE_STDIN = 12613; 700 | MT_LAUNCHER_CALL = 12614; 701 | MT_LAUNCHER_SHUTDOWN = 12615; 702 | MT_LAUNCHER_SET = 12616; 703 | 704 | // remote file 705 | MT_FILE_GET = 12700; 706 | MT_FILE_PUT = 12701; 707 | MT_FILE_LS = 12702; 708 | MT_FILE_MKDIR = 12703; 709 | MT_FILE_DELETE = 12704; 710 | MT_FILE_DATA = 12705; 711 | MT_FILE_LISTING = 12706; 712 | } 713 | 714 | enum OriginIndex { 715 | ORIGIN_UNKNOWN = 0; 716 | ORIGIN_G54 = 1; 717 | ORIGIN_G55 = 2; 718 | ORIGIN_G56 = 3; 719 | ORIGIN_G57 = 4; 720 | ORIGIN_G58 = 5; 721 | ORIGIN_G59 = 6; 722 | ORIGIN_G59_1 = 7; 723 | ORIGIN_G59_2 = 8; 724 | ORIGIN_G59_3 = 9; 725 | ORIGIN_G54_1 = 10; /// extended origin 726 | } 727 | 728 | 729 | // add leading _ to avoid collision with macros in emc.hh 730 | enum TermConditionType { 731 | _EMC_TRAJ_TERM_COND_STOP = 1; 732 | _EMC_TRAJ_TERM_COND_BLEND = 2; 733 | } 734 | 735 | enum CanonDirection { 736 | _CANON_STOPPED = 1; 737 | _CANON_CLOCKWISE = 2; 738 | _CANON_COUNTERCLOCKWISE = 3; 739 | } 740 | 741 | enum InputType { 742 | _ANALOG_INPUT = 0; 743 | _DIGITAL_INPUT = 1; 744 | } 745 | 746 | enum WaitType { 747 | IMMEDIATE = 0; 748 | RISE = 1; 749 | FALL = 2; 750 | BE_HIGH = 3; 751 | BE_LOW = 4; 752 | } 753 | 754 | // types for EMC_TASK interpState 755 | enum InterpreterStateType { 756 | INTERP_IDLE = 1; 757 | INTERP_RUNNING = 2; 758 | INTERP_SYNC_WAIT = 3; 759 | INTERP_PAUSED = 4; 760 | INTERP_QUEUE_WAIT = 5; 761 | INTERP_ABORT_WAIT = 6; 762 | INTERP_STATE_UNSET = 99; // to ease change tracking 763 | }; 764 | -------------------------------------------------------------------------------- /src/machinetalk/protobuf/value.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | import "machinetalk/protobuf/nanopb.proto"; 3 | 4 | import "machinetalk/protobuf/emcclass.proto"; 5 | import "machinetalk/protobuf/types.proto"; 6 | 7 | // see README.msgid 8 | // msgid base: 1500 9 | 10 | package machinetalk; 11 | 12 | 13 | // a value for 'passing around'. 14 | 15 | message Value { 16 | option (nanopb_msgopt).msgid = 1500; // see README.msgid 17 | 18 | required ValueType type = 10; 19 | // actual values 20 | 21 | // One of the following must be filled in, 22 | // depending on type. 23 | 24 | // scalars 25 | optional bool halbit = 100; 26 | optional double halfloat = 101; 27 | optional sfixed32 hals32 = 102; 28 | optional fixed32 halu32 = 103; 29 | 30 | optional bytes v_bytes = 120; 31 | optional sfixed32 v_int32 = 130; 32 | optional sfixed64 v_int64 = 140; 33 | optional fixed32 v_uint32 = 150; 34 | optional fixed64 v_uint64 = 160; 35 | optional double v_double = 170; 36 | optional string v_string = 180 [(nanopb).max_size = 41]; 37 | optional bool v_bool = 190; 38 | 39 | // compound types 40 | optional PmCartesian carte = 200; 41 | optional EmcPose pose = 220; 42 | } 43 | --------------------------------------------------------------------------------