|
Goby3 3.7.0
2026.11.12
|
The goby command line tool is a starting point for managing, running, and understanding a Goby system from the Linux command line.
Like many modern tools (e.g., git) is has many sub-commands that allow you to access a wealth of functionality from a simple natural language syntax with built-in help.
The goby tool is available if you install from the goby3-apps package or build from source.
The help command gives information on any subcommand. For example:
gives help on the zeromq command.
This function is useful for post-mission analysis of .goby log files written by goby_logger.
Converts a .goby log file into useful formats: HDF5, JSON, etc. See the goby_logger page for more details.
goby launch is a basic process manager. It launches a number of Goby application at once in series from a single .launch file. At its simplest, a .launch file is simply a list of commands to execute
goby launch runs them in a screen session by default. You can type CTRL-C to quit, using goby_terminate by default.
See goby help launch for more options.
Runs declarative publish/subscribe tests against a Goby system, for example in CI or after a deployment, without writing a Goby application. It has three actions:
run starts the test's fixtures, runs the test and stops the fixtures. It exits 0 when every expectation passed, 1 when one failed, and 2 when the test could not run (an invalid file, a fixture that never became ready, an endpoint that could not connect, a required application that never responded, or an interruption).validate checks the file without connecting to anything and lists every problem with its location (such as test.run[2].expect[0].match). It exits 0 when the file is valid and 1 otherwise. run performs the same checks first.visualize writes the test plan as a Graphviz graph, e.g. goby test visualize nav.yml | dot -Tpng -o nav.png.The test file is YAML (.yml/.yaml), JSON (.json) or Protobuf TextFormat (any other extension). Its fields are the TestFile message in goby/apps/middleware/test_tool/test_tool_config.proto, with the test itself in goby/middleware/protobuf/pubsub_test.proto. YAML requires Goby built with yaml-cpp (libyaml-cpp-dev; -Denable_yaml=ON, the default when found).
endpoint: named connections, each with zeromq settings (one gobyd) or udpm settings (one multicast group), on the interprocess (LAYER_INTERPROCESS, the default), intermodule (LAYER_INTERMODULE) or intervehicle (LAYER_INTERVEHICLE, see below) layer. A test may mix transports. An endpoint with neither uses zeromq when Goby was built with it, otherwise udpm; with no endpoints, one named default is created. Endpoint settings are layered over run's --zeromq (also GOBY_INTERPROCESS) and --udpm settings.fixture: commands (run with /bin/sh -c, in cwd, each in its own process group) started in order before the test, each waiting until it is ready: every output_regex (one or more) has matched a line of output within timeout, in any order, then an optional delay. After the test they are stopped in reverse order with stop.signal (default SIGINT), escalating to SIGTERM and SIGKILL after stop.grace seconds. On Linux, goby test also stops descendants that left the process group (such as detached screen sessions). Each fixture's output is written to a log in --log_dir (a new temporary directory by default); a failed test's report includes the log path and its last lines.test.require_app: application names that must answer the coroner health request before the runs start; a running goby_coroner's report is used instead once seen.test.run: runs execute SEQUENTIAL (default) or PARALLEL as given by test.mode. A run holds publish, expect and wait entries directly, or a list of step entries executed by its own mode. A wait keeps a run or step open for at least that long; on its own it is a pause.Within a run or step the expectations are subscribed first, then the publications are sent (after delay), then the tool waits until every expectation is satisfied or times out. An expectation names an endpoint, a group regex and a type regex (optionally prefixed by a scheme, such as DCCL/), and passes when the number of matching messages satisfies min_count (default 1, done as soon as it is reached) or count (exact; the step lasts its whole timeout so that extra messages are seen, and count: 0 asserts nothing arrives). A message matches when it satisfies match, a partial message in the same syntax as publish (TextFormat for Protobuf and DCCL, JSON for JSON), and every condition (a field path such as pos.lat or waypoint[0].id, an op of EQ, NE, LT, LE, GT, GE, REGEX, EXISTS or ABSENT, and a value). Messages that fail to match are counted as rejected and the reason for the last rejection is reported. Durations are in seconds.
A LAYER_INTERVEHICLE endpoint publishes and subscribes through its gobyd's intervehicle links, as an application does, so a test with one endpoint per vehicle (each with its own gobyd fixture) checks traffic across the link.
group: "7"; "0" is broadcast). Any other group is carried in the message: group_field names the top-level integer field that holds it.require_app has passed and before the first run. intervehicle { publisher_id: 1 } lists the modem ids it is forwarded to, and a publish needs a delay that lets it cross the link.intervehicle sets its buffer (ttl, max_queue, ack_required, ...), broadcast and clear_pending. With ack_required: true, its acks and expiries are reported on the publishing endpoint, in its group, as PROTOBUF/goby.middleware.intervehicle.protobuf.AckData and ExpireData.A run with repeat: N runs N times in sequence. A run with for_each runs once per entry, with ${NAME} anywhere in the run (its name, groups, types, publish values, match and conditions) replaced by that entry's value; with both, each entry runs repeat times. ${ITERATION} is the pass number, from 1. Each pass is reported as its own run, named after the run (or <name> [k/N] when the name doesn't use a variable), and validate and visualize show every pass.
for_each names must not also be set by -D or the environment, which replace ${NAME} when the file is read (validate reports this). In TextFormat an entry is written for_each { var { key: "HEADING" value: "0" } ... }.
goby test run --repeat N runs the whole test N times with the fixtures left running, and fails if any pass fails; the report lists each pass, with details for those that didn't pass.
${NAME} and ${NAME:-default} are replaced by -D NAME=value, then the environment, then the default (or a run's for_each); ${TEST_DIR} is the directory of the file being read, and $${ is a literal ${. A name that is never set is reported by validate.include: [endpoints.yml] merges other files (of any format) before this one, so endpoints or fixtures can be shared.load_shared_library entries, include paths and fixture cwd resolve relative to the file that declares them. Libraries can also be given with -l or GOBY_TOOL_LOAD_SHARED_LIBRARY as for publish and subscribe.find_package(GOBY) sets GOBY_EXECUTABLE to the goby tool from the same build or installation as the libraries, e.g. add_test(NAME nav COMMAND ${GOBY_EXECUTABLE} test run nav.yml).Works with the publish/subscribe interface files that goby_clang_tool -gen writes for each application (<target>_interface.yml, see cmake_modules/GobyClangTool.cmake), and the deployment files that place those applications on platforms and modules (see Interfaces and deployments):
validate checks that every required subscription has a publisher in its scope (required-unmet, an error) and every recommended one (recommended-unmet, a warning), along with problems reading the files. It exits 0 when the deployment is valid, 1 on an error (or a warning, with --strict) and 2 when the deployment file cannot be read. -o JSON writes the InterfaceValidation message in goby/apps/middleware/interface_tool/interface_tool_config.proto.visualize writes the deployment as a Graphviz graph, e.g. goby interface visualize fleet.yml | dot -Tsvg -o fleet.svg, or with --format D2 as a D2 diagram, e.g. goby interface visualize fleet.yml --format D2 > fleet.d2 && d2 fleet.d2 fleet.svg. Both use the same colors and edge styles: bold for required, tapered (dashed in D2) for recommended, dotted for regex and dashed for dynamic groups, with full group, scheme and type in each tooltip. The D2 output sets the ELK layout, which handles connections between nested containers better than D2's default. Goby's own applications are drawn for what they do in the deployment: gobyd is named on its platform or module ("auv (gobyd)"), the interprocess boundary it is, and other goby_* applications are one box with only their connections to the project's applications. Goby's threads within a project's application, Goby's internal groups (goby::configuration, goby::datum_update, terminate and health), and template arguments in thread names are left out; --expand_goby_apps draws Goby's applications in full and --include_all draws everything. A deployment of only Goby's applications (such as one of their interface files) is drawn in full. goby_clang_tool -viz (-format=dot|d2) draws the same graph, and goby_visualize_interfaces(... FORMAT D2 ...) renders it in CMake.list prints each application with its thread count and publications/subscriptions per layer, each platform with its applications and modules, or each group with its publishers and subscribers.explain shows, for every publication and subscription whose group contains a match for the regex, who it reaches, and for a subscription with no publisher, why: a publisher on another layer, out of its layer's scope (interprocess in another module, intervehicle on the same platform), of another type or scheme, with other numerics, only a dynamic one with its numeric set at run time, or one whose group goby_clang_tool could not determine. It exits 1 when nothing matches.diff compares two deployments, or one deployment against two sets of interface files (--interface_dir_a and --interface_dir_b, e.g. two builds), and lists applications and connections added or removed and required subscriptions newly unmet or newly met. As diff does, it exits 0 when they are the same, 1 when they differ and 2 when a file cannot be read.init writes a starting deployment file that runs every application declared in a directory of interface files on one platform.goby interface launch writes the goby_launch file for a platform (or one module of it, one gobyd) from its run list, so the deployment file is the one list of what runs where. --outdir writes one for every platform, instance and module. goby launch fleet.yml --platform bot1 [goby_launch options] writes the file beside the deployment (as .fleet.bot1.launch, so preseed.goby and relative paths still work) and runs it.
exec (its application by default) with config and args; launch: defaults gives these, kill and env for every Goby application on the platform, with ${app} the entry's name and ${instance} the instance. A process entry is a program with no interface file, which validate and visualize ignore; it is stopped with SIGTERM unless kill says otherwise.when runs the entry only if the condition holds when it is launched: A =~ REGEX, A == B, A != B, or a shell command whose exit status decides. Otherwise the line waits in sleep infinity. enabled: false writes the line as a comment.hold: auto on gobyd holds publications until every application with a required intervehicle subscription, and goby_intervehicle_portal, has subscribed; expected: auto on goby_coroner expects every other Goby application except those marked expected: false. Either takes a list instead, which may include auto.validate and launch report a Goby application listed before gobyd (launch-order), a hold list that leaves out a required intervehicle subscriber (hold-incomplete), an expected list that differs from what is launched (coroner-expected), and a line goby_launch would cut at a # (launch-hash) or misread at a ] (launch-bracket).launch_check compares a hand-written launch file with the deployment, for moving to generated ones: lines with no entry, entries with no line, and differing kill or env. It exits 0 when they agree and 1 when they differ.goby interface systemd writes the same run list as systemd units: a <name>.service for each entry and a <deployment>-<platform>.target that wants them all (systemd_fleet-bot1.target below). It prints them, or writes them to --outdir (one directory per platform, instance and module when no --platform is given). --check compares them with the installed units in --unit_dir (/etc/systemd/system) and exits 1 if any are missing or differ. It never installs units or reloads systemd.
BindsTo and After gobyd.service and stopped with goby_terminate; a process is stopped with its kill signal. A command that needs a shell (<(...), a pipe, a redirect) runs under /bin/bash -c. Relative paths in a command are relative to the service's working directory, which service: "WorkingDirectory=..." sets.systemd: on an entry, or as the platform's systemd: defaults, sets user, group, description, wanted_by (the target by default), a condition line, and text appended to the unit, service and install sections. template replaces the built-in unit with a project file, relative to the deployment, in which ${exec_start}, ${name}, ${unit_name}, ${description}, ${target}, ${wanted_by}, ${user}, ${env} and the other settings, plus any vars, are replaced. skip: true writes no unit, for an entry started some other way.systemd: target uses an existing unit instead of generating one, and ordered: true starts each service after the one before it.when is decided as the units are written, from -D and the environment: an entry whose condition is false gets no unit, and one that cannot be decided (a value left unset, or a shell command) gets none with a systemd-when warning; give it a condition instead. systemd-dropped warns when gobyd's hold or goby_coroner's expected names include an entry with no unit.runs, or groups that into modules, each one gobyd. Connections are matched within each layer's scope: interthread within an application, interprocess within a module, intermodule across the modules of a platform, and intervehicle between platforms.run entry names an application, and the interface file that declares it is found beside the deployment file, then in each -I directory and GOBY_INTERFACE_PATH (colon separated), then in Goby's own share/goby/interfaces. plugins merges plugin interfaces into their host application, name tells two instances of one application apart, and file gives an interface file by path. A list of files under interfaces (each optionally { file: ..., application: ... }) is also accepted.${NAME} and ${NAME:-default} are replaced by -D NAME=value, then the environment. ${GOBY_INTERFACES_DIR} is Goby's own interface directory. goby_clang_tool -gen records publications and subscriptions made with publish_dynamic() and subscribe_dynamic() on a DynamicGroup as dynamic: true. When the group's string is known but its numeric part is set at run time (DynamicGroup(groups::rx, cfg().modem_id())), it adds numeric: runtime; when the string itself is set at run time, the group is "*" and expr holds the C++ expression. The deployment file supplies what the code cannot:
bind (on a platform, or on one run entry, which takes precedence) gives the numeric part of matching groups (* is a wildcard), as a number, a range a-b, a list, or arithmetic on ${instance}; or, with dynamic: selecting by layer, scheme and type, the groups and types a fully dynamic publication or subscription stands for.instances makes one platform per value, named <name><instance>. validate checks each; visualize draws the platform once (its binds taking every instance's numerics) unless --expand_instances is given.necessity sets the necessity of the subscriptions it selects (by platform, module, application, thread, layer, group and type regexes) in this deployment, whatever the code said.--assume_dynamic is given. A group whose string is unknown reaches nothing. validate reports these as dynamic-unbound (warning) and dynamic-unresolved (info), and binds or overrides that select nothing as bind-unused and necessity-unused (warnings).goby_validate_interfaces(DEPLOYMENT_YAML fleet.yml INTERFACE_DIRS ${YML_OUT_DIR}) (from find_package(GOBY)) adds a test that runs goby interface validate --strict.This function is for launching and interfacing with the ZeroMQ interprocess applications.
The following commands are shortcuts to the equivalent application described in the ZeroMQ applications page:
goby zeromq terminate: runs goby_terminategoby zeromq playback: runs goby_playbackgoby zeromq daemon: runs gobydgoby zeromq logger: runs goby_loggergoby zeromq coroner: runs goby_coronergoby zeromq intervehicle_portal: runs goby_intervehicle_portalgoby zeromq gps: runs goby_gpsgoby zeromq geov: runs goby_geov_interfacegoby zeromq frontseat_interface: runs goby_frontseat_interfacegoby zeromq liaison: runs goby_liaisongoby zeromq opencpn: runs goby_opencpn_interfacegoby zeromq moos_gateway: runs goby_moos_gatewayPublishes a single message to gobyd on the interprocess layer. You can either use the --interprocess parameter or set the environmental variable GOBY_INTERPROCESS to define the gobyd interprocess settings.
Usage:
You can use -l to load shared libraries containing your custom Protobuf messages, or set the environmental variable GOBY_TOOL_LOAD_SHARED_LIBRARY.
Subscribes to all or some messages from gobyd on the interprocess layer. You can either use the --interprocess parameter or set the environmental variable GOBY_INTERPROCESS to define the gobyd interprocess settings.
You can use -l to load shared libraries containing your custom Protobuf messages, or set the environmental variable GOBY_TOOL_LOAD_SHARED_LIBRARY.
If you omit the optional regex settings, they default to ".*", meaning that you'll see all publications.
(optional) Set the desired interprocess community in your .bashrc or similar:
In one terminal:
In another terminal:
Finally, in a third terminal:
This publishes the goby::middleware::protobuf::LatLonPoint message defined in goby/middleware/protobuf/geographic.proto. You should then see it in the goby zeromq subscribe terminal:
Functions for dealing with Protobuf messages
Displays the contents of a Protobuf message.
For example:
gives the full .proto definition:
You can use -l to load shared libraries containing your custom Protobuf messages, or set the environmental variable GOBY_TOOL_LOAD_SHARED_LIBRARY.