Giter Site home page Giter Site logo

vrx-docker's Introduction

VRX Automated Evaluation

This repository contains scripts and infrastructure that will be used for automatic evaluation of Virtual RobotX (VRX) teams' submissions.

This repository consists of two major components:

  1. The VRX server system, which runs the VRX Gazebo simulation

  2. The VRX competitor system, which runs a team's control software.

For security and reproducibility, the VRX server and the VRX competitor's systems will be run in separate, isolated environments called Docker containers.

Overview

Scripts

This repository primarily consists of the following main scripts:

  • vrx_server/vrx-server/build_image.bash - A script that runs docker build ... on the files in vrx_server/vrx-server to build the image. This script may take 30-60 minutes to run the first time, but is cached afterwards. It must be run every time the files in vrx_server/vrx-server are modified to not simply use the old cached versions.

  • prepare_team_wamv.bash - A script that runs roslaunch vrx_gazebo generate_wamv.launch ... and stores the generated files appropriately.

  • prepare_task_trials.bash - A script that runs roslaunch vrx_gazebo generated_worlds.launch ... and stores the generated files appropriately

  • run_trial.bash - A script that runs a vrx trial with a given team, task and environmental condition. It requires that the above prepare scripts be called before using it. It is the script that runs the simulation and the competitor container. This is the most important script of this repository.

  • vrx_server/vrx-server/run_vrx_trial.sh - A script that the vrx-server container runs after entry. This is the code that starts the simulation. Please note that you must run the build image script every time you modify this file to see the changes. This script is automatically called when running run_trial.bash

  • generate_trial_video.bash - A script that runs roslaunch vrx_gazebo playback.launch ... to playback a trial and also record it with recordmydesktop. It requires that the above run script be called before using. This script is not important for the running of the competition, but for visualizing and documenting progress.

Every other script is either:

  • a helper script that the main scripts call or

  • a multi_script version of the main scripts, which means that it calls the main scripts multiple times for convenience (eg. do multiple tasks, trials, teams, etc.)

The average user should not need to modify any files, but may want to change some values in one of the main scripts. The other scripts should not need to be modified.

File structure

This section will give descriptions of the directories in this repository:

  • vrx_server - contains scripts for building and running the vrx-server container, as well as its Docker files

  • team_config - stores the team config files. The prepare team scripts look inside of this directory to generate the WAM-V URDF files. More details about this below.

  • task_config - stores the task config files. The prepare task scripts look inside of this directory to generate the trial world files. More details about this below.

  • utils - contains helper scripts that the main scripts call

  • multi_scripts - contains convenience scripts that call the main scripts multiple times

  • generated - contains generated files from all the scripts. This includes command outputs, scores, ROS logs, Gazebo logs, videos, WAM-V URDFs, trial worlds etc. More details about this below.

Quick Start Instructions For a Single Trial: Setting up workspace to run automated evaluation

Installing Docker

Docker is required to run the automated evaluation. Please follow the VRX Docker install tutorial and the Nvidia Docker install tutorial if you are using an Nvidia GPU.

Setting up vrx_gazebo

vrx_gazebo must be setup on your machine to run these scripts. As of July 23, 2019, having vrx from source is required (this is related to Issue#1 of this repository). If you have not done so already, please follow the VRX System Setup Tutorial sections Install all prerequisites in your host system and Option 2: Build VRX from source. Make sure it is sourced so that you can run launch files from vrx_gazebo. Make sure that your file structure is /home/<username>/vrx_ws, as this will assure reliable functionality.

Installing dependencies

  • sudo apt-get install recordmydesktop wmctrl psmisc vlc - for generating and viewing videos

Setting up vrx-docker

vrx-docker must be setup on your machine to run these scripts. Please note that most of the commands listed here are written to be run from the vrx-docker directory. These scripts should be able to be run from other directories, but you will need to change the command paths accordingly.

git clone https://github.com/osrf/vrx-docker.git
cd vrx-docker

Building your vrx-server image

The next step is to build your vrx-server image. This involves running

./vrx_server/build_image.bash -n # for Nvidia computers

OR

./vrx_server/build_image.bash # for non-Nvidia computers (not recommended, runs slower than real-time.)


# Usage: ./vrx_server/build_image.bash [-n --nvidia]

This will create the image for the vrx server that runs the simulation. This step may take 30-60 minutes the first time, but it will be cached in the future calls.

Adding VRX team files

To run the competition with a VRX team's configuration, the team's folder containing its configuration files must be put into the team_config directory.

We have provided example submissions in the team_config directory of this repository. You should see that there is a directory called example_team that has the following configuration files in it:

$ ls team_config/example_team/
dockerhub_image.txt component_config.yaml thruster_config.yaml

Together these files constitute a submission. The files are explained in the Files Required From VRX Teams For Submission section below. We will work with the files of the example_team submission for this tutorial; you can use them as a template for your own team's submission.

Preparing a team's system

To prepare a team's system, call:

./prepare_team_wamv.bash example_team

# For your team you will run:
# ./prepare_team_wamv.bash <your_team_name>

This will call generate_wamv.launch on the files in team_config/example_team and store the generated files in generated/team_generated/example_team.

The end of the output for this command should look something like this:

[INFO] [1570212125.006407]: 
Using /home/bsb/vrx_comp/vrx-docker/team_config/example_team/component_config.yaml as the component configuration yaml file


WAM-V urdf file sucessfully generated. File location: /home/bsb/vrx_comp/vrx-docker/generated/team_generated/example_team/example_team.urdf
================================================================================REQUIRED process [wamv_config/wamv_generator-2] has died!
process has finished cleanly
log file: /home/bsb/.ros/log/123992a6-e6d1-11e9-af7a-408d5c555554/wamv_config-wamv_generator-2*.log
Initiating shutdown!
================================================================================
[wamv_config/wamv_generator-2] killing on exit
[rosout-1] killing on exit
[master] killing on exit
shutting down processing monitor...
... shutting down processing monitor complete
done
OK

Checking /home/bsb/.ros/log/latest/wamv_config-wamv_generator-2.log for compliance
Compliant? true. Writing to /home/bsb/vrx_comp/vrx-docker/generated/team_generated/example_team/compliant.txt
OK

Note that the REQUIRED process [wamv_config/wamv_generator-2] has died! message is expected.

This will also create a file generated/team_generated/example_team/compliant.txt that says true is the configuration was compliant or false otherwise. By compliant, we are refering to the limitations for component and propulsion configuration described in the VRX competition documentation .You can view this result by:

cat generated/team_generated/example_team/compliant.txt

Preparing trials for a task

In this README, we will be using some vocabulary that will be clearly defined here.

  • task: One of the major competition tasks, e.g., stationkeeping, wayfinding, perception, nav_challenge, dock or scan_and_dock.

  • trial: A specific task with a specific set of environmental conditions (e.g., sea state, wind magnitude and direction, lighting, etc.). Each task has multiple trials. Each trial will have a specific world file associated with it.

  • trial_number: Each task will have n trials. Each trial will be labelled with a trial_number, which ranges from 0 to n-1 inclusive.

To prepare all of the trials for a task, call:

./prepare_task_trials.bash stationkeeping

#./prepare_task_trials.bash <task_name>

This will call generate_worlds.launch on task_config/stationkeeping.yaml and store the generated files in generated/task_generated/stationkeeping.

The last part of the output of this should look something

setting /run_id to 172c61c0-e6cd-11e9-af7a-408d5c555554
process[rosout-1]: started with pid [30491]
started core service [/rosout]
process[world_gen-2]: started with pid [30505]



All  3  worlds generated
================================================================================REQUIRED process [world_gen-2] has died!
process has finished cleanly
log file: /home/bsb/.ros/log/172c61c0-e6cd-11e9-af7a-408d5c555554/world_gen-2*.log
Initiating shutdown!
================================================================================
[world_gen-2] killing on exit
[rosout-1] killing on exit
[master] killing on exit
shutting down processing monitor...
... shutting down processing monitor complete
done
OK

where the important parts are All 3 worlds generated indicating success. Also note that the REQUIRED process [world_gen-2] has died! message is expected.

Please note that we will be writing our own private .yaml files for the tasks. Essentially, the only difference between testing out your system with these steps and the real competition is that for the real competition, we will be creating our own .yaml files for tasks that you have not seen, which will vary the environmental conditions. We will not be trying to surprise you with the conditions, but we want to simply reward teams that are robust to different environmental conditions.

File structure after successful prepare

After running the prepare scripts, you should have the following file structure in generated/team_generated:

generated/team_generated
├── example_team
│   ├── compliant.txt
│   ├── example_team.urdf
│   ├── component_config.xacro
│   └── thruster_config.xacro

After running the prepare scripts, you should have the following file structure in generated/task_generated:

generated/task_generated
├── stationkeeping
│   ├── worlds
│   │   ├── stationkeeping0.world
│   │   └── stationkeeping1.world
│   └── world_xacros
│       ├── stationkeeping0.world.xacro
│       └── stationkeeping1.world.xacro

If you are missing these files, please review the command output (either in terminal or in multi_scripts/prepare_output/) to investigate the issue.

Quick Start Instructions For a Single Trial: Running a single trial for a single team

In order to run a trial with a specific team, the prepare scripts above must have been called on the associated task and team before running. To run a single trial with a specific team (in this case the team fromteam_config/example_team and the trial with trial_number 0 associated with task_config/stationkeeping.yaml), call:

./run_trial.bash -n example_team stationkeeping 0 # for Nvidia computers
# OR
./run_trial.bash example_team stationkeeping 0 # for non-Nvidia computers


# For your team you will run:
# ./run_trial.bash [-n --nvidia] <your_team_name> <task_name> <trial_number>

This will instantiate two Docker containers.

  1. The simulation server container, which runs the VRX Gazebo simulation with the desired team WAM-V and desired task trial world.

  2. The VRX team's container, which runs their system from the Dockerhub image in team_config/<your_team_name>/dockerhub_image.txt.

After the trial is over, it stores log files of the results. More about logs in a section below.

This pulls the competitor image first, then starts the simulation container, then starts the competitor container. Note: Need to ensure that there is enough initial_state_duration time so that competition does not start before the competitor container has started.

Quick Start Instructions For a Single Trial: Reviewing the results of a trial

Reviewing the trial performance

After the trial has finished, you can go to generated/logs/<your_team_name>/<task_name>/<trial_number>/ to review the generated log files.

The generated/logs directory has the following structure:

generated/logs
└── example_team
    ├── stationkeeping
    │   └── 0
    │       ├── gazebo-server
    │       │   ├── ogre.log
    │       │   ├── server-11345
    │       │   │   ├── default.log
    │       │   │   └── gzserver.log
    │       │   └── state.log
    │       ├── ros-competitor
    │       │   ├── rostopic_29_1564524270930.log
    │       │   └── rostopic_30_1564524270921.log
    │       ├── ros-server-latest
    │       │   ├── master.log
    │       │   ├── roslaunch-d560550c9290-50.log
    │       │   ├── rosout-1-stdout.log
    │       │   ├── rosout.log
    │       │   ├── spawn_model-3.log
    │       │   └── spawn_model-3-stdout.log
    │       ├── trial_score.txt
    │       ├── verbose_output.txt
    │       └── vrx_rostopics.bag

The generated/logs directory will have numerous directories with the date and time of creation. In each of those directories are the log files of each trial.

  • gazebo-server - contains the gazebo server logs

  • ros-competitor - the log files from the competitor's container. Note: this is more prone to error, as finding the files depends on the competitor images's file structure

  • ros-server-latest - contains the log files from the ros server

  • vrx_rostopics.bag - a bag file containing rostopics from the vrx trial. Currently only stores /vrx/task/info to save space, but this can be edited in vrx_server/vrx-server/run_vrx_trial.sh. Note: to apply any changes to this file, you must also run ./vrx_server/build_image.bash to use the updated file, instead of cache.

  • verbose_output.txt - verbose Gazebo log output from the competition

  • trial_score.txt - text file with one number representing the final score of the trial (from the last message of vrx_rostopics.bag)

  • task_score.txt - (only created when running multi_scripts, how to do so in section below) text file with comma separated values, which are the trial scores of one task for a given team

  • team_score.txt - (only created when running multi_scripts, how to do so in section below) text file with comma separated values, which are the trial scores of all tasks for a given team

  • video - (only created after running generate video scripts, how to do so in section below) contains the generated trial video and its record and playback command outputs

View the score of the trial by running

cat generated/logs/example_team/stationkeeping/0/trial_score.txt

Quick Start Instructions For a Single Trial: Trial videos and playback

Playing back the recorded log of a single trial

After running a trial, a state.log file is stored under generated/logs/<team>/<task>/<trial_num>/gazebo-server. This is a playback log file that allows you to play back the trial.

To play back the trial with Gazebo GUI from within the competition Docker container, run

./replay_trial.bash -n example_team stationkeeping 0

By default, this is on autopilot and will shut down Gazebo after log playback is finished. A side effect is that it will shut down if the playback is paused (which happens to be an indication of the log playback having finished).

To inspect more carefully, you may wish to pause playback without Gazebo shutting down. That can be done by issuing --keep-gz on the command line:

./replay_trial.bash -n --keep-gz example_team wayfinding 0

When you are done with manual inspection, you can shut down Gazebo cleanly by issuing this to the container:

docker exec -it vrx-server-system killall -w gzclient gzserver

The autopilot will detect Gazebo termination and shut down the rest of the container.

replay_trial.bash accepts a few options for more manual inspections, which you can view in the usage by running it alone without arguments.

Generating a single trial video

To make a screen recording of the trial while playing back, run the following command. Internally, this calls replay_trial.bash above.

./generate_trial_video.bash -n example_team stationkeeping 0

# For your team you will run:
# ./generate_trial_video.bash -n <your_team_name> <task_name> <trial_number>

This will start the Gazebo trial playback, begin screen capture on the Gazebo window, and then store the video file, record output and playback output in generated/logs/<team>/<task>/<trial_num>/video. Please note that you must close other tabs related to Gazebo for this to work properly, as it puts the Gazebo window at the front (not background). Keep the Gazebo window on top. If you have a browser tab open related to Gazebo, it may find that window, instead of the actual Gazebo simulation window.

There should be a new directory called generated/logs/<team>/<task>/<trial_num>/video that contains the following:

generated/logs/example_team/stationkeeping/0/video/
├── playback_video.ogv
├── playback_video.ogv.playback_output.txt
└── playback_video.ogv.record_output.txt

You can play the video with

vlc generated/logs/example_team/stationkeeping/0/video/playback_video.ogv

Playing back the simulation

To play back a specific trial's log file, move to vrx-docker and call:

roslaunch vrx_gazebo playback.launch log_file:=`pwd`/generated/logs/example_team/stationkeeping/0/gazebo-server/state.log

# For your team you will run:
# roslaunch vrx_gazebo playback.launch log_file:=`pwd`/generated/logs/<your_team_name>/<task_name>/<trial_number>/gazebo-server/state.log

Important information

  • All generated files will be stored in the generated directory. This will include team and task generated files, log files, scoring, playback videos, etc. These files may get overwritten if scripts are called more than once. Remember to delete these generated files if you want to start fresh.

  • After calling ./vrx_server/build_image.bash the first time, your image will be cached. This means that it will use the old image until this script is called again. If you update vrx_server/vrx-server/run_vrx_trial.sh or any file in vrx_server/vrx-server, those changes will not affect things until you call ./vrx_server/build_image.bash again after making the change

  • For video generation, you can edit generate_trial_video.bash to change the x, y, width, height, or BLACK_WINDOW_TIME variables to change the position and size of recording as well as the length of time that is waited before recording starts.

  • Currently, only the /vrx/task/info topic is recorded in the generated rosbag to save space. You can change this by editing vrx_server/vrx-server/run_vrx_trial.sh and changing the rosbag record ... line to rosbag record -O ~/vrx_rostopics.bag --all &

  • Currently, the playback log files are always played back at the same speed. To change the speed of playback, you must change the rate of recording. You can change this by editing vrx_server/vrx-server/run_vrx_trial.sh and changing the RECORD_PERIOD=.... A higher number means faster playback. A lower number means slower playback.

  • Note that some scripts (build_image.bash, run_container.bash, run_trial.bash, all multi_scripts for running) have an optional [-n --nvidia] argument that should be set for Nvidia devices. Please create an issue if there are any difficulties with this.

Expected errors:

  • In verbose_output.txt, expect to see
Error [parser_urdf.cc:3170] Unable to call parseURDF on robot model
Error [parser.cc:406] parse as old deprecated model file failed.
...
...
[Msg] OnReady
[Msg] OnRunning
[Msg] 4.999000Segmentation fault (core dumped)
[gazebo-2] process has died [pid 86, exit code 139, cmd /opt/ros/melodic/lib/gazebo_ros/gzserver --verbose -e ode -r --record_period 0.01 --record_path /home/tylerlum/.gazebo /task_generated/worlds/perception0.world __name:=gazebo __log:=/home/tylerlum/.ros/log/1d527252-b319-11e9-89c0-0242ac100016/gazebo-2.log].
log file: /home/tylerlum/.ros/log/1d527252-b319-11e9-89c0-0242ac100016/gazebo-2*.log

The parse error message comes from recording, and is a known issue that does not affect the competition. The segmentation fault at the end comes from the scoring plugin shutting down Gazebo when the competition is over.

  • A known bug is that getting log files from the competitor container might not work, depending on the location that it is stored.

  • As well, during video generation you cannot have any other windows related to Gazebo open. The script looks for a window with Gazebo in the name to move to the front for recooding, but this can be ruined by another window.

  • When building the vrx server image with ./vrx_server/build_image.bash [-n --nvidia], you can expect to see the following types errors, which are normal:

WARNING: apt does not have a stable CLI interface…
  • Depending on the size of your display, the resolution/size of the video recording may be incorrect. If your video generation does not work, type the following command and see the result.
cat generated/logs/<team>/<task>/<trial_num>/video/playback_video.ogv.record_output.txt

Window size specification out of bounds!(current resolution:1920x1080)

You can look in the Important Information section for details about how to change the width and height.

Multi_scripts

The above quick start instructions gave an overview of how to use the main scripts to run automated evaluation. For convenience, we also have multi_scripts that run the main scripts multiple times for convenience. We describe these below.

Before beginning, you may want to remove the previously generated files to start fresh, as it may get confusing or messy if you keep old files along with new ones.

Note that some of the files are tracked in the Git repository, so you may want to rename rather than remove, or plan on stashing and dropping the removals afterwards.

rm -r generated

Prepare all scripts

For the purpose of competition, we have a convenience script to run prepare all teams and a convenience script to run prepare all tasks.

Prepare all teams:

./multi_scripts/prepare_all_team_wamvs.bash

# Runs ./prepare_team_wamv.bash on all teams in team_config

Prepare all tasks:

./multi_scripts/prepare_all_task_trials.bash

# Runs ./prepare_task_trials.bash on all task yaml files in task_config

To keep the terminal output clean, all of the output will be stored in generated/multi_scripts/prepare_output/. These scripts should end if there is an error and show OK if it is working. These convenience scripts are more bug-prone, so if you notice any issues, please submit an issue here.

Running all trials for a given task for a single team

To run all trials for a given task, call:

./multi_scripts/run_one_team_one_task.bash example_team example_task # for non-Nvidia computers
# or
./multi_scripts/run_one_team_one_task.bash -n example_team example_task # for Nvidia computers

# For your team you will run:
# ./multi_scripts/run_one_team_one_task.bash [-n --nvidia] <your_team_name> <task_name>

This will run run_trial.bash on all trials in generated/task_generated/<task>/worlds for a given task for one team.

Running all trials for all tasks for a single team

To run all trials for all tasks listed in the task_generated directory, call:

./multi_scripts/run_one_team_all_tasks.bash example_team # for non-Nvidia computers
# or
./multi_scripts/run_one_team_all_tasks.bash -n example_team # for Nvidia computers

# For your team you will run:
# ./multi_scripts/run_one_team_all_tasks.bash [-n --nvidia] <your_team_name>

This will run run_one_team_one_task.bash on all tasks in generated/task_generated/ for a given team.

Running all trials for all tasks for all teams

To run all trials for all tasks listed in the task_generated directory for all teams in team_generated, call:

./multi_scripts/run_all_teams_all_tasks.bash # for non-Nvidia computers
# or
./multi_scripts/run_all_teams_all_tasks.bash -n # for Nvidia computers

# For your team you will run:
# ./multi_scripts/run_all_teams_all_tasks.bash [-n --nvidia]

This will run run_one_team_all_tasks.bash on all teams in generated/team_generated. This is the invocation that will be used to test submissions for the Finals: your system will not be provided with any information about the conditions of the trials. If your system performs correctly with this invocation, regardless of the set of configuration files in the task_config directory, you're ready for the competition.

Note: To keep the terminal output clean, all of the output from multi_scripts will be stored in generated/multi_scripts/run_output/. These convenience scripts are more bug-prone, so if you notice any issues, please submit an issue here.

Generating all trial videos for a given task for a single team

To generate all trial videos for one team and one task, run

./multi_scripts/generate_one_team_one_task_videos.bash example_team example_task

# For your team you will run:
# ./multi_scripts/generate_one_team_one_task_videos.bash <your_team_name> <task_name>

This will run generate_trial_video.bash for all trials in generated/logs/<team>/<task> for a given task and team.

Generating all trial videos for all tasks for a single team

To generate all trial videos for one team and all its tasks, run

./multi_scripts/generate_one_team_all_task_videos.bash example_team

# For your team you will run:
# ./multi_scripts/generate_one_team_all_task_videos.bash <your_team_name>

This will run generate_one_team_one_task_videos.bash for all tasks in generated/logs/<team> for a given team.

Generating all trial videos for all tasks for all teams

To generate all trial videos for all teams and all its tasks, run

./multi_scripts/generate_all_team_all_task_videos.bash

# For your team you will run:
# ./multi_scripts/generate_all_team_all_task_videos.bash

This will run generate_one_team_all_task_videos.bash for all teams in generated/logs.

Note: To keep the terminal output clean, all of the output from multi_scripts will be stored in generated/multi_scripts/generate_video_output/. These convenience scripts are more bug-prone, so if you notice any issues, please submit an issue here.

Expected Output After Multi_scripts

If you are confident your setup is working, you can run

./vrx_server/build_image.bash && ./multi_scripts/prepare_all_team_wamvs.bash && ./multi_scripts/prepare_all_task_trials.bash && ./multi_scripts/run_all_teams_all_tasks.bash && ./multi_scripts/generate_all_team_all_task_videos.bash

After running this, you should expect your generated directory to look like

ls generated
logs  multi_scripts  task_generated  team_generated

and your generated/logs directory to look like

generated/logs
├── example_team
│   ├── stationkeeping
│   │   ├── 0
│   │   │   ├── gazebo-server
│   │   │   │   ├── ogre.log
│   │   │   │   ├── server-11345
│   │   │   │   │   ├── default.log
│   │   │   │   │   └── gzserver.log
│   │   │   │   └── state.log
│   │   │   ├── ros-competitor
│   │   │   │   ├── rostopic_29_1564519107303.log
│   │   │   │   └── rostopic_30_1564519107315.log
│   │   │   ├── ros-server-latest
│   │   │   │   ├── master.log
│   │   │   │   ├── roslaunch-8fe010b975a0-50.log
│   │   │   │   ├── rosout-1-stdout.log
│   │   │   │   ├── rosout.log
│   │   │   │   ├── spawn_model-3.log
│   │   │   │   └── spawn_model-3-stdout.log
│   │   │   ├── trial_score.txt
│   │   │   ├── verbose_output.txt
│   │   │   ├── video
│   │   │   │   ├── playback_video.ogv
│   │   │   │   ├── playback_video.ogv.playback_output.txt
│   │   │   │   └── playback_video.ogv.record_output.txt
│   │   │   └── vrx_rostopics.bag
│   │   ├── 1
│   │   │   ├── gazebo-server
│   │   │   │   ├── ogre.log
│   │   │   │   ├── server-11345
│   │   │   │   │   ├── default.log
│   │   │   │   │   └── gzserver.log
│   │   │   │   └── state.log
│   │   │   ├── ros-competitor
│   │   │   │   ├── rostopic_29_1564519155778.log
│   │   │   │   └── rostopic_30_1564519155773.log
│   │   │   ├── ros-server-latest
│   │   │   │   ├── master.log
│   │   │   │   ├── roslaunch-8410d47cfdaa-51.log
│   │   │   │   ├── rosout-1-stdout.log
│   │   │   │   ├── rosout.log
│   │   │   │   ├── spawn_model-3.log
│   │   │   │   └── spawn_model-3-stdout.log
│   │   │   ├── trial_score.txt
│   │   │   ├── verbose_output.txt
│   │   │   ├── video
│   │   │   │   ├── playback_video.ogv
│   │   │   │   ├── playback_video.ogv.playback_output.txt
│   │   │   │   └── playback_video.ogv.record_output.txt
│   │   │   └── vrx_rostopics.bag
│   │   └── task_score.txt
│   │   ....
│   └── team_score.txt
│   ...

Development tips

Investigating errors

If you encountered errors, it is recommended that you view the Gazebo verbose output by running:

cat generated/logs/<team>/<task>/<trial_num>/verbose_output.txt

or investigate the generated rosbag by running:

rosbag info generated/logs/<team>/<task>/<trial_num>/vrx_rostopics.bag

or if you ran a multi_script, run

cat generated/multi_scripts/prepare_output/<team or task>/output.txt
# or
cat generated/multi_scripts/run_output/<team>/<task>/<trial_number>/output.txt
# or 
cat generated/multi_scripts/generate_video_output/<team>/<task>/<trial_number>/output.txt

or if you had an issue with video generation you can run

cat generated/logs/<team>/<task>/<trial_num>/video/playback_video.ogv.record_output.txt 
# or
cat generated/logs/<team>/<task>/<trial_num>/video/playback_video.ogv.playback_output.txt 

You can even run these commands while the script is still running to investigate issues.

Stopping the Docker containers

If during your development you need to kill the server and competitor containers, you can do so with:

./utils/kill_vrx_containers.bash

This will kill and remove all VRX containers.

Investigating issues in the competitor container

If you are having difficulties running your team's system, you can open a terminal in the container that has your system installed. There are two ways:

To create a new container for investigation, run:

docker run -it --rm --name vrx-competitor-system <image_name>

To investigate a running container for investigation, run:

docker exec -it vrx-competitor-system bash

From here, you can investigate what is happening inside of your container.

Submission Details

Files Required From VRX Teams For Submission

All VRX teams must submit one folder containing three files for automated evaluation. The name of the folder should be the name of the team. Please note that the filenames must be identical with how they are listed below.

  1. component_config.yaml: The team's component configuration yaml file. One component configuration is used for all trials. For more information about this file, please refer to the Creating a Custom WAM-V tutorial.

  2. thruster_config.yaml: The team's thruster configuration yaml file. One thruster configuration is used for all trials. For more information about this file, please refer to the Creating a Custom WAM-V tutorial.

  3. dockerhub_image.txt: A text file containing only the name of their docker image publicly available on Dockerhub, e.g., tylerlum/vrx-competitor-example:v2.2019. For more information about this file, please refer to the Creating a Dockerhub image for submission

Testing Your Submission

All teams should test their submissions by following the instructions above. They detail how to run the scripts to test your system in a mock competition.

It is imperative that teams use the outlined process for testing their systems, as it replicates the process that will be used during automated evaluation. If your system does not work in the mock competition setup, then it will not work for the real competition.

Uploading Your Submission

Details about the submission will be coming shortly.

vrx-docker's People

Contributors

bsb808 avatar caguero avatar crvogt avatar j-herman avatar m1chaelm avatar mabelzhang avatar tiko5000 avatar tylerlum avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vrx-docker's Issues

Infinite loop when executing run

Original report (archived issue) by Steven Liu (Bitbucket: acenturyandabit).


After following the previous instructions and running run_trial.bash, the containers never finish. I see stdout from my container and docker ps verifies they are running.

I am running on a non-nvidia device; but the containers have been running for 6 hours with no gazebo log file or rosbag file in sight.

Can I have a hand?

VRX docker kills gymkhana task at the end of navigation subtask

It appears to me that when testing my image in vrx-docker, task 5 exits whenever the navigation sub-task is complete.

I believe this may be due to the fact that the scoring plugin checks if the VRX_EXIT_ON_COMPLETION environment variable is true. If this environment variable is true, it overrides the per_plugin_exit_on_completion attribute of the plugin itself (assigned in the world file). In the run_trial.bash script, this VRX_EXIT_ON_COMPLETION environment variable is set to true. Therefore, when Exit() is called in the scoring plugin, it exits (instead of listening to the attribute defined in the world file for the navigation plugin, which was false).

vrx_entrypoint.sh does not expand "~" to correct user home directory

Problem

When running the vrx-docker container, the "~" character expands to "/" instead of the correct home directory. This causes the entrypoint to fail on line 11 while trying to source the setup.sh file

/vrx_entrypoint.sh: line 11: //vrx_ws/devel/setup.sh: No such file or directory

To reproduce:

Run the vrx-docker container with the following command:

vrx_server/run_container.bash -n <any_container_name> <image_name>

Decide How to Check Compliance of Team Configs

Original report (archived issue) by Tyler Lum (Bitbucket: tylerlum).


Currently, the testing workflow is:

  1. Setup server image
  2. Build trial world files
  3. Build team urdf files
  4. Run all teams on all worlds

If teams fail the compliance tests in the build team urdf step, then what should we do? Manual checks? Booleans stored somewhere?

Gazebo playback hanging

Original report (archived issue) by Steven Liu (Bitbucket: acenturyandabit).

The original report had attachments: playback_video.ogv.playback_output.txt


When attempting to record a video, gazebo hangs. The window shows but then ubuntu tells me its not responding.

Attached is the playback output file. There’s some error about a missing model, which seems to make sense if i take a look at the state file - there seems to be chunks but not models.

Change Server Simulation Docker image to use branch of Gazebo with limited exposed topics

Original report (archived issue) by Tyler Lum (Bitbucket: tylerlum).


For competition purposes, we need to use a different branch of Gazebo ROS packages such that there will be limited exposure of topics that are not meant for competitors to use. This will involve updating the VRX server Dockerfile to use the custom gazebo_ros packages and to make a new branch of Gazebo based on the template given by ARIAC. We need to figure out which topics need to be removed and which should stay.

ARIAC

The Gazebo server running in the ARIAC server container is configured to not accept communication from external clients such as the competitor container. A custom version of the Gazebo-ROS interface that runs in the ARIAC server container is used, which does not expose ROS interfaces that can be used to interface with the simulator. Only the ARIAC ROS interface is exposed.

https://github.com/osrf/ariac-docker/blob/master/ariac-server/ariac-server/Dockerfile

https://github.com/ros-simulation/gazebo_ros_pkgs/tree/ariac-network-kinetic

https://github.com/ros-simulation/gazebo_ros_pkgs/tree/ariac-network-melodic

oyaml dependency

Original report (archived issue) by Brian Bingham (Bitbucket: brian_bingham).


We discussed removing the oyaml dependency listed in README.md

pip install oyaml - for generating wam-v and worlds

I believe the default yaml library is sufficient and this avoids using pip, which we are not using in other parts of the project.

vrx-docker server uses a base image that is not portable

Currently vrx-docker pulls from npslearninglab/watery_robots:vrx_current, which was built from the dockwater repository image using rocker with the -x option. However, the graphics on this image fail when moved to other machines, probably because rocker customized it to work on the machine it was built on.

To fix this we need a new build process that incorporates rocker and dynamically customizes the server for the hardware on which it's being run.

Steps:

  • Create a new VRX ros-humble-jammy base image from the Dockwater build.bash script.
  • Push to npslearninglab/watery_robots:vrx_base
  • Edit build_image.bash to first use rocker to build and tag a server customized for local hardware, then tag with vrx_current.
  • Use this as the base image in the local Dockerfile
  • Update Dockerfile to use new VRX install process.

run_trial crashes when gz sim can't reach fuel

Most of our models are stored remotely in gz fuel. By default, they are cached during the first run. However, for our docker image, every run is the first run, so we are not getting any caching benefit. This means that the sever is slow to run in the best case scenario.

Making this worse, the gazebo fuel service is highly unreliable, and frequently cannot be reached. Without local caching, this problem becomes more pronounced. When the service can't be reached, gz produces Error in REST request messages when the models we need to load the simulation can't be found, and eventually it causes the whole process to crash, which makes it look like our server doesn't work.

The simplest workaround is to run a command that caches the models we need in the image itself when we build it. This will mean the build will still fail if fuel is down, but after the image is built we don't have to worry about it.

A second solution would be to keep local copies of the models in our repository like we used to, and hold off on pushing things to fuel until the service is fixed. An advantage of this is that users can still build the image successfully even if fuel is down. Disadvantages are that it's more work and our repository gets bigger.

xacro now requires some parameters in order

  • Our wayfinding.yaml file generates a wayfinding.world.xacro that calls the wayfinding.xacro when xacro is run on it to create a wayfinding.world.
  • The first two parameters of the wayfinding.xacro are **wp_markers and **waypoints.
  • Previously, our yaml listed the **waypoints parameter before the **wp_markers parameter, and this generated a xacro in which the <waypoints> element appeared before the <wp_markers> element, but xacro still correctly matched the arguments and inserted them in the right place.
  • Now it seems that the blocks to be inserted are just taken in the order they appear, so listing <waypoints> first causes it to be treated as the argument to **wp_markers.

I'm guessing this is a change to xacro but I'm not entirely sure.

Figure out if Server or Competitor Image Starts First

Original report (archived issue) by Tyler Lum (Bitbucket: tylerlum).


As of right now, the simulation server container is created first before the competitor container, but we should figure out if this is the right approach

Pros of Server First

  • The server creates the ROS master, which should be created before the competitor’s container is run to prevent error messages and possible errors in competitor container that prevents it from running correctly

Cons of Server First

  • If slow to start, competition might start before competitor container is created. This would mean the competitor would be at a disadvantage if their software starts too late. (should be okay with the ready time)

Pros of Client First

  • ARIAC had the competitor’s container start first, likely to ensure that the competition didn’t somehow start early before the competitor container had even been run

Cons of Client First

  • ROS Master not created, will have error message

I believe that the ready time before the competition is long enough, but we should test it to be sure.

The important thing is to make sure that this ordering makes no impact on the competition.

refactor prepare team scripts

How it works now

The prepare_team_wamv.bash script in the vrx-docker repository is a bash script that checks for required submission files and then builds a urdf for the wamv from the config data by running roslaunch vrx_gazebo generate_wamv.launch from the vrx repository.

generate_wamv.launch takes the config files and the path to the file to be generated as input and loads them into the parameter server along with wamv_gazebo.urdf.xacro, the directory containing the sensor xacros, and the directory containing the thruster xacros. It then calls generate_wamv.py as a ros node.

generate_wamv.py does nothing except call configure_wamv.py

configure_wamv.py relies almost entirely on python code we wrote ourselves (utils.py and compliance.py). It only uses rospy to retrieve parameters from the parameter server and to output logs.

Proposal

It seems likely that we could simplify this system by eliminating the reliance on ros altogether and putting all the necessary scripts in the same repository.

Generate Video Gazebo Window Not in Front

Original report (archived issue) by Tyler Lum (Bitbucket: tylerlum).


Currently, the generate video script works, except that the Gazebo window is hidden in the background, rather than in the front as it needs to be. We should find a way to move it to foreground without human intervention.

If sensor_config.yaml fails compliance once, it fails all day

Original report (archived issue) by Michael McCarrin (Bitbucket: m1chaelm).


Our prepare_team_wamv.bash script checks that sensors are compliant by grepping through the $HOME/.ros/log/latest/wamv_config-wamv_generator-1.log for the string “ERROR”. This method produces some false positives. In particular, since the log can contain messages from multiple consecutive runs, any run that produces the string ERROR once will cause compliance checks to fail until the logs are rotated.

A workaround is to delete the log file or removing the lines that say ERROR and run again. Ideally we would record the output of our compliance check directly instead of searching the log.

Gazebo Playback Missing WAM-V

Original report (archived issue) by Tyler Lum (Bitbucket: tylerlum).


Description

Currently, the Gazebo simulation playback log files are being created and saved onto the host computer. The issue is that when these files are played, the WAM-V is not visible. It is still listed as one of the Models on the Gazebo GUI, but right-clicking > Move to moves to a location where the boat is not visible.

Instructions to Recreate

  1. Move to vrx-docker
  2. Run ./prepare_team_wamv.bash example_team && ./prepare_task_trials.bash example_task && ./vrx_server/build_image.bash && ./run_trial.bash example_team example_task 0
  3. Playback with roslaunch vrx_gazebo playback.launch log_file:=/home/tylerlum/vrx-docker/logs/<recent date>/gazebo-server/log/<data>/state.log

Gzclient on host?

Original report (archived issue) by Brian Bingham (Bitbucket: brian_bingham).


In vrx_entrypoint.sh is the line: “TODO: optionally disable this so a gzclient can be run on the host for development.”

Is it possible to be able to run the client on the host (or even in a different container)? I think that would be very powerful.

Unable to launch practice worlds using run_trial.bash

  1. Currently run_trial.bash runs SERVER_CMD="/run_vrx_trial.sh /team_generated/${TEAM_NAME}.urdf /task_generated/worlds/${TASK_NAME}${TRIAL_NUM} ${LOG_DIR}"
    and run_vrx_trial.sh runs
    ros2 launch vrx_gz competition.launch.py headless:=false urdf:=$WAMV_URDF world:=$TRIAL_WORLD extra_gz_args:="--record_period ${RECORD_PERIOD} --record_path /home/developer/.gazebo --log_overwrite" verbose:=true competition_mode:=true > ~/verbose_output.txt 2>&1 & internally,
    However, I suspect competition.launch.py does not seem to support absolute file paths as world, and it only works when I change world to the name of the world e.g. practice_2023_${TASK}${TRIAL}_task where it will use the worlds in the vrx repo.

generate_one_team_one_task_videos.bash couldn't find docker image vrx-server-noetic:latest

Hello!

I've run 3 trials for station keeping task for my team, the trail folders have logs, everything seems normal.
I wanted to generate videos for all trials of this task, but it seem that the video-generation script runs into an error

Unable to find image 'vrx-server-noetic:latest' locally

See full log output here
output.txt

I couldn't find this image on the docker hub, could you please let me know if

  • this image is expected to be built locally by some other script that I need to run prior, or
  • this image is available from another image repository (not docker hub)

Thanks!

Move preparation scripts into Docker container

Currently, setting up vrx-docker requires the host machine to have the vrx (and vorc for the vorc branch) repo compiled in the workspace.

This adds a significant hurdle for teams to test their solutions against the evaluation, especially if the host is not Ubuntu 18.04, e.g. as reported in osrf/vorc-events#20 .

#26 has moved the log playback and video recording portions into the Docker containers.

Remaining to move into the Docker container are the preparation scripts and the corresponding instructions in the README.
That should cover everything.

This issue is considered done when the host machine is no longer required to have vrx and vorc compiled in order to run vrx-docker.

Evaluation timing verification

Original report (archived issue) by Brian Bingham (Bitbucket: brian_bingham).


Currently the run_trial.bash script does the following in order:

  • Starts up the vrx-server container
  • Waits a fixed amount of time (9 seconds)
  • Then starts the team’s container

We should verify that this timing won’t cause any problems. I believe it is done this way b/c if we start the team’s container first, it will not have a ROS master on the network which could cause problems.

This seems to have the potential for the simulation to start (and proceed towards Running state) before the team’s code gets up and running, especially if the team’s container takes significant time to spin up.

Also, Tyler left notes in the source to check on this, so wanted to get it into our list.

GPU Ray Sensor and Camera Sensor Not Working

Original report (archived issue) by Tyler Lum (Bitbucket: tylerlum).


When running ./vrx_server/build_image.bash; ./prepare_team_wamv.bash example_team; ./prepare_task_trials.bash example_team; ./run_trial.bash example_team example_task 0, the following error shows up.

[Err] [CameraSensor.cc:112] Unable to create CameraSensor. Rendering is disabled.
[Err] [GpuRaySensor.cc:136] Unable to create GpuRaySensor. Rendering is disabled.

A possible solution to look into is http://answers.gazebosim.org/question/8065/unable-to-create-depthcamerasensor-when-launching-in-remote-computer/. I believe it is not related to gui:=false, but the fact that it cannot render correctly from docker containers without a screen. This may be related to Issue#1, as this error may prevent the model from spawning.

Finalize how ROS_HOSTNAME and ROS_MASTER_URI and ROS_IP work

Original report (archived issue) by Tyler Lum (Bitbucket: tylerlum).


From http://wiki.ros.org/ROS/Tutorials/MultipleMachines, it looks like I should only be setting ROS_IP or ROS_HOSTNAME. For our case, which should we set? If hostname, does it matter what names I choose? If IP address, how do I choose an IP Address? Please read the section below to ensure that any changes made do not make the same issue that happened before. ( Initially, when I started the server and competition containers, the competition could see the topics (`rostopic list` showed topics from the simulator), but if I published to /left_thrust_cmd from the competition container, the server container was not seeing it. Changing the ROS_MASTER_URIs made it work.)

Previous Steps taken to make it work

I am not super confident about how ROS_MASTER_URI, ROS_HOSTNAME, ROS_IP, and GAZEBO_IP work. I used [https://answers.ros.org/question/228292/exposing-ros-containers-to-host-machine/](https://answers.ros.org/question/228292/exposing-ros-containers-to-host-machine) and [https://answers.ros.org/question/298602/how-to-have-topics-publish-and-subscribe-both-ways-between-host-and-docker-container/](https://answers.ros.org/question/298602/how-to-have-topics-publish-and-subscribe-both-ways-between-host-and-docker-container) for reference. Initially, when I started the server and competition containers, the competition could see the topics (`rostopic list` showed topics from the simulator), but if I published to /left_thrust_cmd from the competition container, the server container was not seeing it. Changing the ROS_MASTER_URIs made it work.

http://wiki.ros.org/ROS/EnvironmentVariables

ROS_IP/ROS_HOSTNAME

ROS_IP and ROS_HOSTNAME are optional environment variable that sets the declared network address of a ROS Node or tool. The options are mutually exclusive, if both are set ROS_HOSTNAME will take precedence. Use ROS_IP if you are specifying an IP address, and ROS_HOSTNAME if you are specifying a host name. When a ROS component reports a URI to the master or other components, this value will be used. This setting is only needed in situations where you have multiple addresses for a computer and need to force ROS to a particular one.

With the exception of 'localhost', it does not affect the actual bound address as ROS components bind to all available network interfaces. If the value is set to localhost, the ROS component will bind only to the loopback interface. This will prevent remote components from being able to talk to your local component.

http://wiki.ros.org/ROS/Tutorials/MultipleMachines

If something in the above sequence didn't work, the cause is likely in your network configuration. See ROS/NetworkSetup and ROS/Troubleshooting for configuration requirements and troubleshooting tips.

One common trap is the missing define of ROS_IP on the machine, where talker.py is running.

check it with: echo $ROS_IP

If you dont't define ROS_IP, then rostopic info will show indeed the proper connections of publisher and listener, but rostopic echo will be empty. You will see no TX-traffic on LAN, on machine with talker. First, after defining ROS_IP with proper IP-address ( export ROS_IP=machine_ip_addr) you will see trafic on LAN and the listener.py will show received data.

It looks like I should only be setting ROS_IP or ROS_HOSTNAME. For our case, which should we set? If hostname, does it matter what names I choose? If IP address, how do I choose an IP Address? I am still new to these network topics.

Finalize how to log command output for multi-scripts

Original report (archived issue) by Tyler Lum (Bitbucket: tylerlum).


For multi-scripts, we want to store command outputs to a text file so that we can review the output and not be overwhelmed by the output of all scripts called. We should finalize how the output should be. (Use append to file, where it is stored, should it show errors to terminal still? should we have option to show all? also colored text looks bad in txt file currently)

This gives a good description of the options there are for logging command output. https://askubuntu.com/questions/420981/how-do-i-save-terminal-output-to-a-file

run_trial.bash fails if host uid and gid are not 1000

Original report (archived issue) by Michael McCarrin (Bitbucket: m1chaelm).


The vrx-server Dockerfile attempts to create the vrx-server so its user matches the username of the host system. However, it hard codes uid and gid to 1000. If the user running the container has different uid or gid, the server’s home environment won’t be configured correctly, and the relative path shortcut “~” will be empty. This will cause the run_trial.bash script to fail to find the vrx_ws directory it needs to initialize the server.

A quick workaround is to change the uid and gid values in the Dockerfile to match the uid and gid of the user on the host.

Followup Issues for Port to VORC

A meta-ticket of followup issues to #19. Applies to the vorc branch.

VORC essentials

  • #21 and osrf/vorc#31: Need a new YAML file in task_config for the new gymkhana task
  • In task_config, all trials > 0 need to have coordinates customized for VORC #32 removes all trials > 0

Infrastructure

  • #26: Videos should be recorded from a window from server Docker playback.launch, as opposed to a window from the evaluator's host machine, which is likely on some arbitrary environment different from that in the server Docker.
    • #31: Backport to VRX in master branch
  • #23 and osrf/vrx#229: Fix https://github.com/osrf/vrx vrx_gazebo package setup to follow standard practices, so that the Python scripts for world generation can be used if vrx_gazebo is compiled with catkin_make --install as opposed to catkin_make. Currently they import from relative paths and cannot be used from outside the package.

Style

  • This line in VRX competition evaluation
    roslaunch vrx_gazebo sandisland.launch gui:=false urdf:=$WAMV_URDF world:=$TRIAL_WORLD extra_gazebo_args:="-r --record_period ${RECORD_PERIOD} --record_path $HOME/.gazebo" verbose:=true non_competition_mode:=false > ~/verbose_output.txt 2>&1 &
    should really use a separate launch file in vrx_gazebo in https://github.com/osrf/vrx vrx_gazebo, as opposed to piggybacking on sandisland.launch, which is an entry-level example file and doesn't need all the complexity associated with the non_competition_mode Boolean.
  • The non_competition_mode Boolean should be renamed to avoid the double-negative, especially in the launch file, where it is used like "unless non_competition_mode". This might be the flag that hides ROS topics with ground truths when the world runs in competition mode, so be mindful to not drop that feature.
  • Look into why environment variable GAZEBO_MODEL_PATH needs to be set in the launch file with non_competition_mode Boolean. The parameter should really be <export>ed from package.xml and not need to be manually set.
  • xacro files in generated/task_generated/*/world_xacros/ can use better indentation

Need to specify version tag for vrx repository in Dockerfile

During development, we build the latest version of the VRX repository. Once we have a code freeze release for VRX 2023, we need to add the appropriate tag to the clone command in our Dockerfile to make sure the server images always use the same version of the code.

range_bearing not availiable after finishing navigation subtask of Gymkhana task

When testing without docker, I was able to get data from range_bearing topic and use that to get closer to the pinger. However, when I tested it using the docker, I saw the boat was able to pass the exit gate but after that, it could not receive any data from range_bearing and it just stayed at the exit forever. I have already used the latest version of vrx_server and vrx_gazebo. I am not sure how to fix this and I hope it won't be an issue when the VRX team tests our final submission.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.