Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ ctest --test-dir build

`build.sh` passes any arguments on to IvPico's CMake, and `BUILD_DIR` overrides the build directory. Add `build/usr/bin` to your `PATH` to run the installed apps.

## Helm library

*Outline, to be written:*

- `ivpico::helm::Helm`: construct from a `HelmConfig`, `handle()` the inputs, `iterate()` at the helm's rate.
- Each iteration's `Output` (solution, status, postings, behavior events, visualizations, offboard messages, life events, objective functions, configuration) and its pHelmIvP equivalent.
- Field levels (CORE, ADVANCED, DEVELOPER) and what each adds to `Status` and `HelmConfig`.
- Differences from pHelmIvP: the MOOSDB echo, rejournal, standby helm.

## Goby app

*This section was written by Claude.*
Expand All @@ -48,7 +57,7 @@ ctest --test-dir build

Contacts come in as `Navigation` with `self: false`, or as `NODE_REPORT` variables. The helm raises pContactMgrV20's alerts itself (configured in `helm.contact_manager`), so contact behaviors such as collision avoidance spawn without a separate contact manager.

`launch/goby/alpha` runs the alpha mission against Goby's basic frontseat simulator, with OpenCPN as a chart display: see its [README](launch/goby/alpha/README.md).
`launch/goby/alpha` runs the alpha mission against Goby's basic frontseat simulator, shown on Liaison's map: see its [README](launch/goby/alpha/README.md).


## License
Expand Down
7 changes: 3 additions & 4 deletions init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,9 @@ apt_install "${packages[@]}"
packages=(libopenocean-messages-dev libivp-helm-dev)
if ${goby}; then
# libgoby3-dev only recommends libais-dev and dccl5-compiler, but goby's CMake package
# links libais.so, and goby_add_app() runs protoc-gen-dccl. MOOS-IvP's apps
# (pMarineViewer for the Goby launches) need libmoos-ivp but don't depend on it
packages+=(libgoby3-dev goby3-apps libais-dev dccl5-compiler
libgoby3-moos-dev goby3-moos moos10-mit-db moos-ivp-apps moos-ivp-gui libmoos-ivp)
# links libais.so, and goby_add_app() runs protoc-gen-dccl. goby3-gui has goby_liaison,
# for the Goby launches' map
packages+=(libgoby3-dev goby3-apps goby3-gui libais-dev dccl5-compiler libgoby3-moos-dev)
fi

# Adds an apt.oceansoft.org channel to openocean_sources, checking its key's fingerprint
Expand Down
1 change: 0 additions & 1 deletion launch/goby/alpha/.gitignore

This file was deleted.

30 changes: 11 additions & 19 deletions launch/goby/alpha/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,9 @@ flowchart LR
fs -- "NodeStatus" --> helm
fs -- "NodeStatus" --> ocpn["goby_opencpn_interface"]
ocpn -- "AIS, TCP 54000" --> opencpn["OpenCPN"]
fs -- "NodeStatus" --> gw["goby_moos_gateway"]
helm -- "Posting, Status" --> gw
gw -- "buttons (Variable)" --> helm
subgraph moos["MOOS (viewer.launch)"]
gw <--> db["MOOSDB"] <--> pnr["pNodeReporter"]
db <--> pmv["pMarineViewer"]
end
fs -- "NodeStatus" --> liaison["goby_liaison<br/>(http://localhost:50001)"]
helm -- "Posting, Status, ..." --> liaison
liaison -- "Variable, Command" --> helm
```

## Running
Expand All @@ -26,34 +22,30 @@ From the top of IvPico, after `./build.sh`:

```
export PATH=$PWD/build/usr/bin:$PATH
export GOBY_TOOL_LOAD_SHARED_LIBRARY=$PWD/build/usr/lib/libivpico_interface.so
cd launch/goby/alpha
goby_launch alpha.launch
./deploy.sh
```

`deploy.sh` publishes DEPLOY=true and lifts the manual override with `goby zeromq publish`, which can publish any other `Variable` or `Command` the same way.
`deploy.sh` publishes DEPLOY=true and lifts the manual override with `goby zeromq publish`, which can publish any other `Variable` or `Command` the same way, given IvPico's `build/usr/lib/libivpico_interface.so` with `-l`.

As in MOOS-IvP's alpha, the helm parks when the survey is done (pHelmIvP's `park_on_allstop`); deploy again to return.
As in MOOS-IvP's alpha, the vehicle surveys, returns, and stops at the return point; deploy again to repeat.

## Viewing in pMarineViewer
## Viewing in Liaison

`viewer.launch` shows the vehicle in pMarineViewer as in MOOS-IvP's alpha mission, with its buttons (DEPLOY, RETURN, ...) working. Start it after `alpha.launch`, having fetched MOOS-IvP's background images once with `get_images.sh`:
`goby_liaison` (`config/liaison.pb.cfg`) serves http://localhost:50001:

```
./get_images.sh
goby_launch viewer.launch
```

It runs a MOOS community (`alpha.moos`), which `goby_moos_gateway` with IvPico's plugin (`src/bin/goby/moos_gateway`) gives what pHelmIvP and its navigation would post: `NAV_*`, the helm's postings (`VIEW_*`, `WPT_STAT`, ...) and `IVPHELM_*`. The MOOS variables listed in `config/moos_gateway.pb.cfg` go back to the helm as `Variable`s.
- Map: the vehicle and its track. The helm's `Visualization`s (waypoints, ...) aren't drawn yet.
- Scope: the helm's messages (`Status`, `Posting`, ...).
- Commander: publishes a `Variable` (e.g. RETURN=true) or `Command` to the helm, as `deploy.sh` does.

## Changing the datum and time warp

```
./set_datum_warp.sh --datum 42.358456 -71.087589 --warp 5
```

sets them in every configuration (and `alpha.moos`), starts the vehicle at the datum, and chooses the MOOS-IvP image covering it for pMarineViewer. With no options it prints the current settings.
sets them in every configuration, starts the vehicle at the datum, and opens Liaison's map there. With no options it prints the current settings.

## Viewing in OpenCPN

Expand Down
4 changes: 2 additions & 2 deletions launch/goby/alpha/alpha.launch
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ goby_frontseat_interface_basic_simulator config/frontseat.pb.cfg
goby_helm_ivp config/helm_ivp.pb.cfg
# the vehicle as an AIS target for OpenCPN (see README.md)
goby_opencpn_interface config/opencpn.pb.cfg
# goby_liaison (from the goby3-gui package) shows and publishes messages at http://localhost:50001
# goby_liaison config/liaison.pb.cfg
# the map, and the helm's messages, at http://localhost:50001 (see README.md)
goby_liaison config/liaison.pb.cfg
87 changes: 0 additions & 87 deletions launch/goby/alpha/alpha.moos

This file was deleted.

15 changes: 15 additions & 0 deletions launch/goby/alpha/config/liaison.pb.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,23 @@ interprocess {

http_address: "localhost"
http_port: 50001
load_shared_library: "../../../build/usr/lib/libivpico_interface.so"

pb_commander_config {
sqlite3_database: "/tmp/liaison_commander_autosave.db"
load_protobuf {
name: "ivp.interface.Variable"
publish_to { group: "ivpico::helm::variable" }
}
load_protobuf {
name: "ivp.interface.Command"
publish_to { group: "ivpico::helm::command" }
}
}
pb_scope_config {
}
pb_map_config {
initial_lat: 43.825300
initial_lon: -70.330400
initial_zoom: 16
}
22 changes: 0 additions & 22 deletions launch/goby/alpha/config/moos_gateway.pb.cfg

This file was deleted.

9 changes: 6 additions & 3 deletions launch/goby/alpha/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
set -euo pipefail

export GOBY_INTERPROCESS='platform: "alpha"'
export GOBY_TOOL_LOAD_SHARED_LIBRARY=${GOBY_TOOL_LOAD_SHARED_LIBRARY:-libivpico_interface.so}
# IvPico's build (build.sh), or else an installed libivpico_interface.so. Given with -l, as
# GOBY_TOOL_LOAD_SHARED_LIBRARY may be set for another project
lib=$(dirname "$0")/../../../build/usr/lib/libivpico_interface.so
[ -f "${lib}" ] || lib=libivpico_interface.so

goby zeromq publish ivpico::helm::variable PROTOBUF/ivp.interface.Variable 'key: "DEPLOY" sval: "true"'
goby zeromq publish ivpico::helm::command PROTOBUF/ivp.interface.Command 'manual_override: false'
goby zeromq publish -l "${lib}" ivpico::helm::variable PROTOBUF/ivp.interface.Variable 'key: "DEPLOY" sval: "true"'
goby zeromq publish -l "${lib}" ivpico::helm::command PROTOBUF/ivp.interface.Command 'manual_override: false'
14 changes: 0 additions & 14 deletions launch/goby/alpha/get_images.sh

This file was deleted.

30 changes: 4 additions & 26 deletions launch/goby/alpha/set_datum_warp.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
# Sets the alpha mission's datum (also the simulator's start position) and time warp in its
# Goby configuration and alpha.moos, choosing the MOOS-IvP image that covers the datum.
# Sets the alpha mission's datum (also the simulator's start position and where Liaison's
# map opens) and time warp in its configuration.
#
# Usage: set_datum_warp.sh [--datum <lat> <lon>] [--warp <factor>]
# With no options, prints the current settings.
Expand Down Expand Up @@ -38,37 +38,15 @@ while [ $# -gt 0 ]; do
done

goby_cfgs=(config/*.pb.cfg)
image_dir=${IVP_IMAGE_DIRS:-images}

# the smallest image whose .info bounds contain the datum
image_for() {
for info in "${image_dir}"/*.info; do
awk -v lat="$1" -v lon="$2" -v tif="$(basename "${info%.info}").tif" -F= '
{ gsub(/[ \t]/, ""); b[$1] = $2 }
END {
if (!("lat_north" in b) || !("lon_east" in b)) exit
if (lat <= b["lat_north"] && lat >= b["lat_south"] && lon <= b["lon_east"] && lon >= b["lon_west"])
print (b["lat_north"] - b["lat_south"]) * (b["lon_east"] - b["lon_west"]), tif
}' "${info}"
done | sort -g | head -1 | cut -d' ' -f2
}

if [ -n "${lat}" ]; then
sed -i -E "s/(lat_origin: ).*/\1${lat}/; s/(lon_origin: ).*/\1${lon}/" "${goby_cfgs[@]}"
sed -i -E "s/^(\s*lat: )[-0-9.]+/\1${lat}/; s/^(\s*lon: )[-0-9.]+/\1${lon}/" config/frontseat.pb.cfg
sed -i -E "s/^(LatOrigin\s*=\s*).*/\1${lat}/; s/^(LongOrigin\s*=\s*).*/\1${lon}/" alpha.moos
image=$(image_for "${lat}" "${lon}")
if [ -n "${image}" ]; then
sed -i -E "s/^(\s*tiff_file\s*=\s*).*/\1${image}/" alpha.moos
else
echo "No image in ${image_dir} covers ${lat}, ${lon}: set tiff_file in alpha.moos" >&2
fi
sed -i -E "s/(initial_lat: ).*/\1${lat}/; s/(initial_lon: ).*/\1${lon}/" config/liaison.pb.cfg
fi

if [ -n "${warp}" ]; then
sed -i -E "s/(warp_factor: ).*/\1${warp}/" "${goby_cfgs[@]}"
sed -i -E "s/^(MOOSTimeWarp\s*=\s*).*/\1${warp}/" alpha.moos
fi

grep -HE "lat_origin|lon_origin|warp_factor|^\s*(lat|lon): " "${goby_cfgs[@]}" | sed -E 's/\s+/ /g'
grep -HE "^(LatOrigin|LongOrigin|MOOSTimeWarp)|^\s*tiff_file" alpha.moos | sed -E 's/\s+/ /g'
grep -HE "lat_origin|lon_origin|initial_lat|initial_lon|warp_factor|^\s*(lat|lon): " "${goby_cfgs[@]}" | sed -E 's/\s+/ /g'
7 changes: 0 additions & 7 deletions launch/goby/alpha/viewer.launch

This file was deleted.

Loading