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
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")

option(BUILD_SHARED_LIBS "Build shared libraries" ON)

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)

Expand Down
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ One way to think of this project is as a generator for the equivalent of the MOO
- src: Source code
- lib: Library source
- interface: Interface messages (Protobuf)
- helm: The helm, pHelmIvP without MOOS (`ivpico::helm::Helm`)
- bin: Binary source
- goby: Goby middleware app
- goby: Goby middleware app (`goby_helm_ivp`)
- ros: ROS middleware node
- test: Tests, including replays of MOOS-IvP missions (`test/missions`)
- launch: Example missions
- external: Submodules
- openocean-messages: [openocean-messages](https://github.com/openocean-software/openocean-messages), for the `Navigation` and `ControlSetpoint` messages
- moos-ivp: [MOOS-IvP](https://github.com/GobySoft/moos-ivp), for the IvP solver and behaviors
Expand All @@ -38,3 +41,22 @@ ctest --test-dir build
`build.sh` passes any arguments on to IvPico's CMake, and `BUILD_DIR` overrides the build directory.

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

## Goby app

*This section was written by Claude.*

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

4 changes: 3 additions & 1 deletion init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ fi
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
apt_install libgoby3-dev goby3-apps
# 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
11 changes: 11 additions & 0 deletions launch/goby/alpha/alpha.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env goby_launch

# start the simulator
[kill=SIGTERM] goby_basic_frontseat_simulator 54321

# start the Goby processes
gobyd config/gobyd.pb.cfg
goby_frontseat_interface_basic_simulator config/frontseat.pb.cfg
goby_helm_ivp config/helm_ivp.pb.cfg
# goby_liaison (from the goby3-gui package) shows and publishes messages at http://localhost:50001
# goby_liaison config/liaison.pb.cfg
74 changes: 74 additions & 0 deletions launch/goby/alpha/config/alpha.bhv
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
//-------- FILE: alpha.bhv -------------

initialize DEPLOY = false
initialize RETURN = false

//----------------------------------------------
Behavior = BHV_Waypoint
{
name = waypt_survey
pwt = 100
condition = RETURN = false
condition = DEPLOY = true
endflag = RETURN = true

updates = WPT_UPDATE
perpetual = true

lead = 8
lead_damper = 1
lead_to_start = true
speed = 12 // meters per second
capture_line = true
capture_radius = 5.0
slip_radius = 15.0
efficiency_measure = all

polygon = 60,-40 : 60,-40 : 60,-160 : 150,-160 : 180,-100 : 150,-40

order = normal
repeat = 1

visual_hints = nextpt_color=yellow
visual_hints = nextpt_vertex_size=8
visual_hints = nextpt_lcolor=gray70
visual_hints = vertex_color=dodger_blue, edge_color=white
visual_hints = vertex_size=5, edge_size=1
}

//----------------------------------------------
Behavior=BHV_Waypoint
{
name = waypt_return
pwt = 100
condition = RETURN = true
condition = DEPLOY = true
perpetual = true
updates = RETURN_UPDATE
endflag = RETURN = false
endflag = DEPLOY = false
endflag = MISSION = complete

speed = 2.0
capture_radius = 2.0
slip_radius = 8.0
points = 0,-20
}

//----------------------------------------------
Behavior=BHV_ConstantSpeed
{
name = const_speed
pwt = 200
condition = SPD=true
condition = DEPLOY = true
perpetual = true
updates = SPEED_UPDATE
endflag = SPD = false

speed = 0.5
duration = 10
duration_reset = CONST_SPD_RESET=true

}

39 changes: 39 additions & 0 deletions launch/goby/alpha/config/frontseat.pb.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
app {
geodesy {
lat_origin: 43.825300
lon_origin: -70.330400
}
simulation {
time {
use_sim_time: true
warp_factor: 10
}
}
}

interprocess {
platform: "frontseat_sim_example"
}

frontseat_cfg {
require_helm: true
helm_running_timeout: 10
frontseat_connected_timeout: 10
status_period: 5
exit_on_error: false
[goby.middleware.frontseat.protobuf.basic_simulator_config] {
tcp_address: "127.0.0.1"
tcp_port: 54321
start {
lat: 43.825 # deg
lon: -70.330 # deg
duration: 0 # 0 == no timeout, otherwise timeout in seconds
control_freq: 10 # Hz
vehicle {
accel: 1.0 # m/s^2
hdg_rate: 50 # deg/s
z_rate: 2 # m/s
}
}
}
}
12 changes: 12 additions & 0 deletions launch/goby/alpha/config/gobyd.pb.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
app {
simulation {
time {
use_sim_time: true
warp_factor: 10
}
}
}

interprocess {
platform: "frontseat_sim_example"
}
26 changes: 26 additions & 0 deletions launch/goby/alpha/config/helm_ivp.pb.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
app {
geodesy {
lat_origin: 43.825300
lon_origin: -70.330400
}
simulation {
time {
use_sim_time: true
warp_factor: 10
}
}
}

interprocess {
platform: "frontseat_sim_example"
}

helm {
behavior_file: "config/alpha.bhv"
domain { name: "course" low: 0 high: 359 points: 360 }
domain { name: "speed" low: 0 high: 4 points: 41 }
}

frontseat {
enable: true
}
20 changes: 20 additions & 0 deletions launch/goby/alpha/config/liaison.pb.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
app {
simulation {
time {
use_sim_time: true
warp_factor: 10
}
}
}

interprocess {
platform: "frontseat_sim_example"
}

http_address: "localhost"
http_port: 50001
pb_commander_config {
sqlite3_database: "/tmp/liaison_commander_autosave.db"
}
pb_scope_config {
}
9 changes: 9 additions & 0 deletions launch/goby/alpha/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
# Deploys the vehicle: DEPLOY=true for the behaviors, and lifts the manual override.
set -euo pipefail

export GOBY_INTERPROCESS='platform: "frontseat_sim_example"'
export GOBY_TOOL_LOAD_SHARED_LIBRARY=${GOBY_TOOL_LOAD_SHARED_LIBRARY:-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'
1 change: 1 addition & 0 deletions src/bin/goby/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
add_subdirectory(helm_ivp)
29 changes: 29 additions & 0 deletions src/bin/goby/groups.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#ifndef IVPICO_GOBY_GROUPS_H
#define IVPICO_GOBY_GROUPS_H

#include <goby/middleware/group.h>

namespace ivpico
{
namespace goby
{
namespace groups
{
constexpr ::goby::middleware::Group navigation{"ivpico::helm::navigation"};
constexpr ::goby::middleware::Group variable{"ivpico::helm::variable"};
constexpr ::goby::middleware::Group command{"ivpico::helm::command"};

constexpr ::goby::middleware::Group solution{"ivpico::helm::solution"};
constexpr ::goby::middleware::Group posting{"ivpico::helm::posting"};
constexpr ::goby::middleware::Group status{"ivpico::helm::status"};
constexpr ::goby::middleware::Group behavior_event{"ivpico::helm::behavior_event"};
constexpr ::goby::middleware::Group visualization{"ivpico::helm::visualization"};
constexpr ::goby::middleware::Group offboard_message{"ivpico::helm::offboard_message"};
constexpr ::goby::middleware::Group life_event{"ivpico::helm::life_event"};
constexpr ::goby::middleware::Group objective_function{"ivpico::helm::objective_function"};
constexpr ::goby::middleware::Group configuration{"ivpico::helm::configuration"};
} // namespace groups
} // namespace goby
} // namespace ivpico

#endif
7 changes: 7 additions & 0 deletions src/bin/goby/helm_ivp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
goby_add_app(TARGET goby_helm_ivp
SOURCES helm_ivp.cpp
PROTOS helm_ivp_config.proto
PROTOC_OUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/proto
PROTO_IMPORT_DIRS ${PROJECT_SOURCE_DIR}/src/lib ${openocean_messages_PROTO_DIR}
LINK_LIBRARIES goby_zeromq ivpico_helm)
target_include_directories(goby_helm_ivp PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/..)
Loading