CarterFendley / moos-ivp-agent-1

Model agnostic ML tooling for MOOS-IvP

Home Page:https://mivp-agent.github.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

moos-ivp-agent

C++ Build Python Build

Model agnostic ML tooling for MOOS-IvP. See very simple implementation below based on the ManagerExample. See the mivp-agent.github.io website for more information about getting started.

VEHICLES = ['alder', ]

from mivp_agent.manager import MissionManager
with MissionManager() as mgr:
  print('Waiting for vehicle connection...')
  mgr.wait_for(VEHICLES)

  while True:
    # Get state message from server
    msg = mgr.get_message()

    # Decide on action
    action = None
    if msg.state['NAV_X'] < 100:
      action = {
        'speed': 2.0,
        'course': 90.0
      }
    if msg.state['NAV_X'] > 50:
      action = {
        'speed': 2.0,
        'course': 270.0
      }

    # Respond to BHV_Agent's message with an action
    msg.act(action)

This project builds upon the ground work done by moos-ivp-pLearn. It implements a "model bridge" from moos-ivp to python 3.x land.

The above example shows how to use MissionManager (python) with BHV_Agent (MOOS-IvP). This repository also contains useful tools for training MOOS-IvP agents like pEpisodeManager

Installation instructions

Install docker

See this page for instructions for each major OS.

Download this repo

git clone https://github.com/CarterFendley/moos-ivp-agent.git

See the docker section below for usage of the docker container.

Linux

Follow the post install instructions for docker here

Mac OSX & XQuartz

Install XQuartz for the GUI components to render properly.

Fix multi-threading issue

pMarineViewer has a compatibility issue with connections inside of the docker container on some versions of OSX. On your host NOT docker terminal enter the following command.

defaults write org.xquartz.X11 enable_iglx -bool true

Reference

Allow networked connections

Run the following command to start XQuartz (again, on a host terminal).

xhost +

After the command completes go to the task bar and XQuarts > Preferences > Security and check the box labeled Allow connections from network clients. After doing this you will need to restart xhost. The following method will work among others.

killall Xquartz
xhost +

FAQ

My pMarine viewer will not show up

If on mac, read the "XQuartz on OSX section" carefully and follow the steps. After done, restart the docker container & XQuartz.

I can't install or get something work

Open an issue this repository is still very young and I need to know about any issues with the install process.

Using the docker script

This repo comes with the docker.sh script for OSX and Linux to make managing it's docker container easier.

Note the password for the moos user is moos

Building the container

We can build the mivp-agent image with the following usage. The first time you run this it will take a while.

./docker.sh build

The image will take a while to build the first time.

Running the container

If no mivp-agent container is running, the following command will start one and put you in a bash shell inside the container.

REALLY IMPORTANT NOTE: This script will create a link between the moos-ivp-agent/examples, moos-ivp-agent/src, and moos-ivp-agent/missions folders on the host machine and the docker container. Any change on the host or docker container will be reflected in the other. This is intended to make development and data exfiltration easier but can very easily get you into trouble if not cautious.

NOTE: If previously run, you will need to ./docker.sh rm before starting another container. See below.

./docker.sh run

If you want another terminal inside the running container use the following command.

./docker.sh connect

Shutting down the container

The following sequence of commands will both stop the mivp-agent container (regardless of any activity) and remove the container.

./docker.sh stop
./docker.sh rm

Where do I start?

See the mivp-agent.github.io website for more information about getting started.

About

Model agnostic ML tooling for MOOS-IvP

https://mivp-agent.github.io/

License:MIT License


Languages

Language:C++ 64.4%Language:Python 19.7%Language:Shell 11.2%Language:CMake 3.2%Language:C 1.0%Language:Dockerfile 0.5%