Skip to content

Commit

Permalink
Use a std::promise/std::future to avoid busy waiting the step ack mes…
Browse files Browse the repository at this point in the history
…sages in NetworkManagerPrimary (#470)

Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
Signed-off-by: Louise Poubel <louise@openrobotics.org>

Co-authored-by: Louise Poubel <louise@openrobotics.org>

Hacking the nectwork secondary loop to allow taking steps asynchronously

Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>

tweaks so the secondary sends ack messages more eagerly, and 'goes ahead' more slowly

Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>

Something that works with the distributed_levels demo

Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>

Primary acks secondaries steps each N/2

Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>

Use real robots in the distributed levels world

Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>

Speedup primary in distributed simulation

Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>

Clenup NewtworkManagerPrimary::Step() code

Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>

Primary indicates how many steps secondaries can move ahead

Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>

Scripts to run the distributed_levels simulation with N robots and M secondaries

Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>

Record statistics with ign_imgui

Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>

Delete unrelated file

Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
  • Loading branch information
ivanpauno committed Jan 7, 2021
1 parent 1672d2b commit 028b0ac
Show file tree
Hide file tree
Showing 17 changed files with 2,274 additions and 3,280 deletions.
1,070 changes: 0 additions & 1,070 deletions examples/scripts/distributed_levels/primary.sdf

This file was deleted.

625 changes: 625 additions & 0 deletions examples/scripts/distributed_levels/primary.sdf.em

Large diffs are not rendered by default.

77 changes: 68 additions & 9 deletions examples/scripts/distributed_levels/primary.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,76 @@
#!/usr/bin/env bash

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
set -e

SCRIPTNAME="$(basename $0)"
HELP="$(cat << EOM
$SCRIPTNAME [--secondaries N] [--robots N]
--secondaries, -s: Number of secondaries the primary expects, defaults to 2.
--robots, -r: Number of robots, defaults to 2.
EOM
)
"

ROBOTS="2"
SECONDARIES="2"

while [[ $# -gt 0 ]]
do
key="$1"

case $key in
-s|--secondaries)
SECONDARIES="$2"
shift
shift
;;
-r|--robots)
ROBOTS="$2"
shift
shift
;;
*)
echo "$HELP"
exit 0
;;
esac
done

FILENAME="${SCRIPTNAME%.*}"
TMPFILE=$(mktemp /tmp/primary.XXXXXX.sdf)
function cleanup {
rm $TMPFILE
}
trap cleanup EXIT

OUTPUT_STATS_FILE="stats_distributed_r${ROBOTS}_s${SECONDARIES}.csv"

if [[ -f $OUTPUT_STATS_FILE ]]; then
echo "$OUTPUT_STATS_FILE already exists, delete it before running a simulation with the same settings"
exit 0
fi

empy3 -o "$TMPFILE" "$FILENAME.sdf.em" $ROBOTS

echo "-----------------------"
echo "Launching Gazebo"
echo "-----------------------"
# --levels is implied by --network-role
ign gazebo -v 4 -z 100000000 --network-role primary --network-secondaries 2 $DIR/primary.sdf
ign gazebo -v 4 -z 100000000 -r --network-role primary --network-secondaries $SECONDARIES $TMPFILE &

# Ignition Gazebo 1.x.x and 2.x.x support using environment variables to
# configure distributed simulation. This capability is deprecated in
# version 2.x.x, and removed in verion 3.x.x of Inition Gazebo. Please use the
# --network-role and --network-secondaries command line options instead.
sleep 10s

# export IGN_GAZEBO_NETWORK_ROLE="PRIMARY"
# export IGN_GAZEBO_NETWORK_SECONDARIES=3
# ign-gazebo -v 4 --distributed -f $DIR/primary.sdf
echo "-----------------------"
echo "Launching ign_imgui"
echo "-----------------------"
ign_imgui -o $OUTPUT_STATS_FILE &

sleep 120s

echo "-----------------------"
echo "Closing"
echo "-----------------------"
kill -SIGINT %1 %2
wait %1 %2
Loading

0 comments on commit 028b0ac

Please sign in to comment.