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
2 changes: 1 addition & 1 deletion .github/workflows/record-missions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Init
run: |
git config --global --add safe.directory '*'
./init.sh
./init.sh --no-goby
# all of MOOS-IvP, not just the helm libraries
apt-get install -y --no-install-recommends make patch

Expand Down
4 changes: 4 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@ Guidance for Claude when working in this repository.
- When in doubt leave the documentation unwritten, but provide an outline for the human developers to use to fill out the rest of the document.
- Prefer figures to text when an idea can be better explained graphically.

## Branches

- Name a feature branch with a short description of the change: `add-goby-test-tool`, `fix-udpm-reassembly`. Name a bug fix branch with the issue it closes after the description: `fix-bad-bug/13`

9 changes: 8 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,22 @@ set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")

option(BUILD_SHARED_LIBS "Build shared libraries" ON)

include(GNUInstallDirs)
# installed programs find the libraries installed beside them, e.g. in build.sh's build/usr
set(CMAKE_INSTALL_RPATH "$ORIGIN/../${CMAKE_INSTALL_LIBDIR}")

find_package(Protobuf REQUIRED)
find_package(openocean_messages 0.1 REQUIRED COMPONENTS cpp)

# MOOS-IvP's helm libraries (IVP_BUILD_HELM_LIBS_ONLY)
find_package(IVP CONFIG REQUIRED)

find_package(GOBY 3.0 COMPONENTS zeromq)
find_package(GOBY 3.0 COMPONENTS zeromq OPTIONAL_COMPONENTS moos)
if(NOT GOBY_FOUND)
message(STATUS "Goby3 not found: not building the Goby app")
elseif(GOBY_moos_FOUND)
# goby_moos links MOOS::MOOS
find_package(MOOS 10 QUIET)
endif()

include(CTest)
Expand Down
18 changes: 4 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ One way to think of this project is as a generator for the equivalent of the MOO

*This section was written by Claude.*

`init.sh` checks out the submodules and installs the Ubuntu packages needed to build them and IvPico. These include Goby3 from [packages.gobysoft.org](http://packages.gobysoft.org), for the Goby app; without Goby3, `build.sh` skips the Goby app. `build.sh` then builds, all in `build/`:
`init.sh` checks out the submodules and installs the Ubuntu packages needed to build them and IvPico. These include Goby3, for the Goby app, adding [packages.gobysoft.org](http://packages.gobysoft.org)'s continuous builds if apt doesn't already have it; `init.sh --no-goby` leaves Goby3 out, and `build.sh` then skips the Goby app. `build.sh` then builds, all in `build/`, and installs each into `build/usr`:

- openocean-messages, into `build/external/openocean-messages`;
- MOOS-IvP's helm libraries (`IVP_BUILD_HELM_LIBS_ONLY`, as shared libraries, without MOOS or its apps), into `build/external/moos-ivp`, installed into `build/external/install` for `find_package(IVP)`;
- MOOS-IvP's helm libraries (`IVP_BUILD_HELM_LIBS_ONLY`, as shared libraries, without MOOS or its apps), into `build/external/moos-ivp`, installed first so that IvPico can `find_package(IVP)`;
- IvPico, against both.

```
Expand All @@ -38,7 +38,7 @@ One way to think of this project is as a generator for the equivalent of the MOO
ctest --test-dir build
```

`build.sh` passes any arguments on to IvPico's CMake, and `BUILD_DIR` overrides the build directory.
`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.

To update a submodule, check out the commit you want in it and commit the new pointer, e.g. `git -C external/openocean-messages pull origin main && git add external/openocean-messages`.

Expand All @@ -48,15 +48,5 @@ To update a submodule, check out the commit you want in it and commit the new po

`goby_helm_ivp` runs the helm in Goby3. It publishes and subscribes the `ivp.interface` messages on the `ivpico::helm::*` groups (`src/bin/goby/groups.h`), and can stand in for the MOOS helm behind `goby_frontseat_interface` (`frontseat { enable: true }`). `goby_helm_ivp -e` prints an example configuration.

To run the alpha mission against Goby's basic frontseat simulator:

```
export PATH=$PWD/build/src/bin/goby/helm_ivp:$PATH
export GOBY_TOOL_LOAD_SHARED_LIBRARY=$PWD/build/src/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.
`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).

15 changes: 9 additions & 6 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
# Builds the dependencies from their submodules (openocean-messages, and MOOS-IvP's helm libraries),
# then IvPico against them, all in BUILD_DIR (default build). Arguments are passed on to IvPico's
# cmake.
# then IvPico against them, all in BUILD_DIR (default build), and installs them all into
# BUILD_DIR/usr (e.g. add build/usr/bin to PATH). Arguments are passed on to IvPico's cmake.
set -euo pipefail

cd "$(dirname "$0")"
Expand All @@ -14,21 +14,24 @@ done
BUILD_DIR=$(realpath -m "${BUILD_DIR:-build}")
OPENOCEAN_BUILD_DIR=${BUILD_DIR}/external/openocean-messages
IVP_BUILD_DIR=${BUILD_DIR}/external/moos-ivp
# find_package(IVP) only works from an installation
IVP_INSTALL_DIR=${BUILD_DIR}/external/install
PREFIX=${BUILD_DIR}/usr

BUILD_DIR=${OPENOCEAN_BUILD_DIR} external/openocean-messages/build.sh -DBUILD_TESTING=OFF
cmake --install "${OPENOCEAN_BUILD_DIR}" --prefix "${PREFIX}" > /dev/null

cmake -S external/moos-ivp/ivp/src -B "${IVP_BUILD_DIR}" -G Ninja \
-DIVP_BUILD_HELM_LIBS_ONLY=ON -DBUILD_SHARED_LIBS=ON \
-DIVP_LIB_DIRECTORY="${IVP_BUILD_DIR}/lib" \
-DIVP_INC_DIRECTORY="${IVP_BUILD_DIR}/include" \
-DIVP_BIN_DIRECTORY="${IVP_BUILD_DIR}/bin"
ninja -C "${IVP_BUILD_DIR}"
cmake --install "${IVP_BUILD_DIR}" --prefix "${IVP_INSTALL_DIR}" > /dev/null
# find_package(IVP) only works from an installation
cmake --install "${IVP_BUILD_DIR}" --prefix "${PREFIX}" > /dev/null

cmake -S . -B "${BUILD_DIR}" -G Ninja \
-Dopenocean_messages_DIR="${OPENOCEAN_BUILD_DIR}" \
-DIVP_DIR="${IVP_INSTALL_DIR}/lib/cmake/IVP" \
-DIVP_DIR="${PREFIX}/lib/cmake/IVP" \
-DCMAKE_INSTALL_PREFIX="${PREFIX}" \
"$@"
ninja -C "${BUILD_DIR}"
cmake --install "${BUILD_DIR}" > /dev/null
66 changes: 41 additions & 25 deletions init.sh
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
#!/usr/bin/env bash
# Checks out the submodules and installs the Ubuntu packages needed to build them and IvPico.
#
# Usage: init.sh
# Usage: init.sh [--no-goby]
# --no-goby don't install Goby3 (build.sh then skips the Goby app)
set -euo pipefail

cd "$(dirname "$0")"

case "${1:-}" in
"") ;;
-h | --help)
sed -n '4p' "$0" | sed 's/^# //'
exit 0
;;
*)
sed -n '4p' "$0" | sed 's/^# //' >&2
exit 1
;;
esac
usage() { sed -n '4,5p' "$0" | sed 's/^# //'; }

goby=true
for arg in "$@"; do
case "${arg}" in
--no-goby) goby=false ;;
-h | --help)
usage
exit 0
;;
*)
usage >&2
exit 1
;;
esac
done

git submodule update --init --recommend-shallow

Expand All @@ -31,22 +37,32 @@ apt_install() {

# moos-ivp's helm libraries (IVP_BUILD_HELM_LIBS_ONLY) need only CMake and a compiler
# xz-utils: the replay tests' recorded missions are compressed
packages=(cmake ninja-build g++ git ca-certificates protobuf-compiler libprotobuf-dev curl gpg xz-utils)
packages=(cmake ninja-build g++ git ca-certificates protobuf-compiler libprotobuf-dev xz-utils)
$SUDO apt-get update
apt_install "${packages[@]}"

# Goby3, for src/bin/goby, from packages.gobysoft.org
keyring=/usr/share/keyrings/gobysoft-archive-keyring.gpg
if [ ! -f "${keyring}" ]; then
curl -fsSL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x19478082E2F8D3FE" |
gpg --dearmor | $SUDO tee "${keyring}" > /dev/null
if ${goby}; then
# Goby3, for src/bin/goby. If apt doesn't have it yet, add packages.gobysoft.org's
# continuous builds, which have 'goby test' (newer than 3.6.1)
goby_policy=$(apt-cache policy libgoby3-dev)
if ! grep -q "Candidate: [^(]" <<< "${goby_policy}"; then
apt_install curl gpg
keyring=/usr/share/keyrings/gobysoft-archive-keyring.gpg
if [ ! -f "${keyring}" ]; then
curl -fsSL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x19478082E2F8D3FE" |
gpg --dearmor | $SUDO tee "${keyring}" > /dev/null
fi
. /etc/os-release
echo "deb [signed-by=${keyring}] http://packages.gobysoft.org/${ID}/continuous/ ${VERSION_CODENAME}/" |
$SUDO tee /etc/apt/sources.list.d/gobysoft_continuous.list > /dev/null
$SUDO apt-get update
fi
# libgoby3-dev only recommends these, but goby's CMake package links libais.so,
# and goby_add_app() runs protoc-gen-dccl
apt_install libgoby3-dev goby3-apps libais-dev dccl5-compiler
# pMarineViewer for the Goby launches (viewer.launch), through goby_moos_gateway;
# MOOS-IvP's apps need libmoos-ivp but don't depend on it
apt_install libgoby3-moos-dev goby3-moos moosdb10 moos-ivp-apps moos-ivp-gui libmoos-ivp
fi
. /etc/os-release
echo "deb [signed-by=${keyring}] http://packages.gobysoft.org/${ID}/release/ ${VERSION_CODENAME}/" |
$SUDO tee /etc/apt/sources.list.d/gobysoft_release.list > /dev/null
$SUDO apt-get update
# libgoby3-dev only recommends these, but goby's CMake package links libais.so,
# and goby_add_app() runs protoc-gen-dccl
apt_install libgoby3-dev goby3-apps libais-dev dccl5-compiler

external/openocean-messages/init.sh --cxx
65 changes: 65 additions & 0 deletions launch/goby/alpha/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# alpha

*This section was written by Claude.*

MOOS-IvP's alpha mission (a survey, then a return) with `goby_helm_ivp` driving Goby's basic frontseat simulator, at time warp 10.

```mermaid
flowchart LR
helm["goby_helm_ivp"] -- "DesiredCourse" --> fs["goby_frontseat_interface"]
fs <--> sim["goby_basic_frontseat_simulator"]
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
```

## Running

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.

As in MOOS-IvP's alpha, the helm parks when the survey is done (pHelmIvP's `park_on_allstop`); deploy again to return.

## Viewing in pMarineViewer

`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`:

```
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.

## 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.

## Viewing in OpenCPN

`goby_opencpn_interface` serves the vehicle's position as AIS on TCP port 54000 (`config/opencpn.pb.cfg`).

1. Install OpenCPN: `sudo add-apt-repository ppa:opencpn/opencpn && sudo apt install opencpn`.
2. In Options: Connections, add a Network connection: TCP, address 127.0.0.1, port 54000.
3. The vehicle appears as an AIS target near 43.825 N, 70.330 W. Charts are optional (Options: Charts: Chart Downloader).

See Goby's [visualization interfaces](https://github.com/GobySoft/goby3/blob/3.0/src/doc/markdown/doc507_goby_viz.md) for more.
2 changes: 2 additions & 0 deletions launch/goby/alpha/alpha.launch
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@
gobyd config/gobyd.pb.cfg
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
87 changes: 87 additions & 0 deletions launch/goby/alpha/alpha.moos
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
// pMarineViewer for the Goby alpha mission (viewer.launch), as in MOOS-IvP's
// s1_alpha mission. goby_moos_gateway posts NAV_*, the helm's postings and
// IVPHELM_* here, and gives pMarineViewer's buttons back to goby_helm_ivp.

ServerHost = localhost
ServerPort = 9000
Community = alpha

MOOSTimeWarp = 10

LatOrigin = 43.825300
LongOrigin = -70.330400

ProcessConfig = pNodeReporter
{
AppTick = 2
CommsTick = 2

platform_type = kayak
platform_color = yellow
platform_length = 4
}

ProcessConfig = pMarineViewer
{
AppTick = 4
CommsTick = 4

tiff_file = forrest19.tif
//tiff_file = MIT_SP.tif

set_pan_x = -90
set_pan_y = -280
zoom = 0.65
vehicle_shape_scale = 1.5
hash_delta = 50
hash_shade = 0.22
hash_viewable = true

trails_point_size = 1

//op_vertex = x=-83, y=-47, lwidth=1,lcolor=yellow,looped=true,group=moa
//op_vertex = x=-46.4, y=-129.2, lwidth=1,lcolor=yellow,looped=true,group=moa
//op_vertex = x=94.6, y=-62.2, lwidth=1,lcolor=yellow,looped=true,group=moa
//op_vertex = x=58, y=20, lwidth=1,lcolor=yellow,looped=true,group=moa

// Appcast configuration
appcast_height = 75
appcast_width = 30
appcast_viewable = true
appcast_color_scheme = indigo
nodes_font_size = xlarge
procs_font_size = xlarge
appcast_font_size = large

// datum_viewable = true
// datum_size = 18
// gui_size = small

// left_context[survey-point] = DEPLOY=true
// left_context[survey-point] = MOOS_MANUAL_OVERRIDE=false
// left_context[survey-point] = RETURN=false

right_context[return] = DEPLOY=true
right_context[return] = MOOS_MANUAL_OVERRIDE=false
right_context[return] = RETURN=false

scope = SUMMARY
scope = RETURN
scope = WPT_STAT
scope = VIEW_SEGLIST
scope = VIEW_POINT
scope = VIEW_POLYGON
scope = MVIEWER_LCLICK
scope = MVIEWER_RCLICK

button_one = DEPLOY # DEPLOY=true
button_one = MOOS_MANUAL_OVERRIDE=false # RETURN=false
button_two = RETURN # RETURN=true
button_three = SLOWER # WPT_UPDATE=speed=1.5
button_four = FASTER # WPT_UPDATE=speed=3.5

action = MENU_KEY=deploy # DEPLOY = true # RETURN = false
action+ = MENU_KEY=deploy # MOOS_MANUAL_OVERRIDE=false
action = RETURN=true
action = UPDATES_RETURN=speed=1.4
}
Loading