Skip to content

Commit

Permalink
Greet alg (#82)
Browse files Browse the repository at this point in the history
* * Moved platforms::Epsilon and base classes to pose namespace
* Modified platforms and algorithms to use new pose::Epsilon and PositionBounds
* Added initial Greet algorithm which moves agents to greeting locations if a target in a list of targets moves within a greeting distance
  * Follow option is not quite working yet
* Added scripts for testing Greet in simulation

* * Updated GAMS repo to style guide
* Updated follow capabilities in the Greet algorithm
* Updated demo scripts for the Greet algorithm
* Removed bazel build files from GAMS

* * Fixing segfault that could occur in GroupFixedList and was causing issues in test_auctions/CI
  • Loading branch information
jredmondson authored Mar 19, 2019
1 parent 2058a6e commit 5907df3
Show file tree
Hide file tree
Showing 255 changed files with 8,803 additions and 8,040 deletions.
128 changes: 0 additions & 128 deletions BUILD

This file was deleted.

2 changes: 1 addition & 1 deletion scripts/linux/base_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,7 @@ if [ $UNREAL_GAMS -eq 1 ] ; then
./build.sh

else
echo "NOT CHECKING EIGEN"
echo "NOT CHECKING UNREAL GAMS"
fi

if [ $GAMS -eq 1 ] || [ $EIGEN_AS_A_PREREQ -eq 1 ]; then
Expand Down
40 changes: 40 additions & 0 deletions scripts/simulation/unreal/greet/greet.mf
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

.id < .targets => (
!.origin => (.origin = [0, .id * 10, 2]);
!.initial_pose => (.initial_pose = .origin);

// targets run a line along [0, *, 5]

{.prefix}.algorithm="waypoints";
{.prefix}.algorithm.args.locations.size=2;
{.prefix}.algorithm.args.locations.0=[0, swarm.size * 10 + .id * 10, 2];
{.prefix}.algorithm.args.locations.1=.origin;
{.prefix}.algorithm.args.repeat=5;
);

.id >= .targets => (
!.origin => (.origin = [10, .id * 10, 20]);
!.guard => (.guard = [0, .id * 10, 10]);
!.distance => (.distance = 30);
!.initial_pose => (.initial_pose = .origin);
!.targets => (.targets = 1);

.osc.loiter_timeout=-1;
.osc.respawn_timeout=-1;

// follow.max_agents
// follow
// follow.group
// guard.location
// guard.distance
// home.location
// target.group

group.targets.members.size=1;
group.targets.members.0='agent.0';

{.prefix}.algorithm="greet";
{.prefix}.algorithm.args.home.location=.origin;
{.prefix}.algorithm.args.guard.distance=.distance;
{.prefix}.algorithm.args.guard.location=.guard;
);
44 changes: 44 additions & 0 deletions scripts/simulation/unreal/greet/greet_and_follow.mf
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@

.id < .targets => (
!.origin => (.origin = [0, .id * 10, 2]);
!.initial_pose => (.initial_pose = .origin);

// targets run a line along [0, *, 5]

{.prefix}.algorithm="waypoints";
{.prefix}.algorithm.args.locations.size=2;
{.prefix}.algorithm.args.locations.0=[0, swarm.size * 10 + .id * 10, 2];
{.prefix}.algorithm.args.locations.1=.origin;
{.prefix}.algorithm.args.repeat=5;
);

.id >= .targets => (
!.origin => (.origin = [10, .id * 10, 20]);
!.guard => (.guard = [0, .id * 10, 10]);
!.distance => (.distance = 30);
!.max_distance => (.max_distance = 40);
!.initial_pose => (.initial_pose = .origin);
!.targets => (.targets = 1);
!.followers => (.followers = 2);

.osc.loiter_timeout=-1;
.osc.respawn_timeout=-1;

// follow.max_agents
// follow
// follow.group
// guard.location
// guard.distance
// home.location
// target.group

group.targets.members.size=1;
group.targets.members.0='agent.0';

{.prefix}.algorithm="greet";
{.prefix}.algorithm.args.home.location=.origin;
{.prefix}.algorithm.args.guard.distance=.distance;
{.prefix}.algorithm.args.guard.location=.guard;
{.prefix}.algorithm.args.guard.max_follow_distance=.max_distance;
{.prefix}.algorithm.args.follow.max_agents=.followers;
);
41 changes: 41 additions & 0 deletions scripts/simulation/unreal/greet/run_greet.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#/bin/bash

TYPE="quadcopter"
LEAD="agent.0"
N=10
NT=0
TARGETS=1
SCRIPTS_DIR=`dirname $0`
SCRIPT="$SCRIPTS_DIR/greet.mf"
LOG_LEVEL=1

if [ $# -ge 1 ]; then
if [ "$1" == "help" ] || [ "$1" == "-h" ]; then
echo "$0 [type=quad] [targets=1] [num agents=10] [no-transport]"
exit 0
fi

TYPE="$1"

if [ $# -ge 2 ]; then
TARGETS=$2
fi

if [ $# -ge 3 ]; then
N=$3
fi

if [ $# -ge 4 ]; then
NT=1
fi
fi

if [ $NT -eq 1 ]; then
echo gams_controller -mc $N -n $N -nt -p osc-$TYPE -0 ".targets=$TARGETS" -M $SCRIPT -z 4 --gams-level $LOG_LEVEL
gams_controller -mc $N -n $N -nt -p osc-$TYPE -0 ".targets=$TARGETS" -M $SCRIPT -z 4 --gams-level $LOG_LEVEL
else
echo gams_controller -mc $N -n $N -p osc-$TYPE -0 ".targets=$TARGETS" -M $SCRIPT -z 4 --gams-level $LOG_LEVEL
gams_controller -mc $N -n $N -p osc-$TYPE -0 ".targets=$TARGETS" -M $SCRIPT -z 4 --gams-level $LOG_LEVEL
fi

exit 0
46 changes: 46 additions & 0 deletions scripts/simulation/unreal/greet/run_greet_and_follow.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#/bin/bash

TYPE="quadcopter"
LEAD="agent.0"
N=10
FOLLOWERS=2
NT=0
TARGETS=1
SCRIPTS_DIR=`dirname $0`
SCRIPT="$SCRIPTS_DIR/greet_and_follow.mf"
LOG_LEVEL=1

if [ $# -ge 1 ]; then
if [ "$1" == "help" ] || [ "$1" == "-h" ]; then
echo "$0 [type=quad] [targets=1] [followers=2] [num agents=10] [no-transport]"
exit 0
fi

TYPE="$1"

if [ $# -ge 2 ]; then
TARGETS=$2
fi

if [ $# -ge 3 ]; then
FOLLOWERS=$3
fi

if [ $# -ge 4 ]; then
N=$4
fi

if [ $# -ge 5 ]; then
NT=1
fi
fi

if [ $NT -eq 1 ]; then
echo gams_controller -mc $N -n $N -nt -p osc-$TYPE -0 ".targets=$TARGETS;.followers=$FOLLOWERS" -M $SCRIPT -z 4 --gams-level $LOG_LEVEL
gams_controller -mc $N -n $N -nt -p osc-$TYPE -0 ".targets=$TARGETS;.followers=$FOLLOWERS" -M $SCRIPT -z 4 --gams-level $LOG_LEVEL
else
echo gams_controller -mc $N -n $N -p osc-$TYPE -0 ".targets=$TARGETS;.followers=$FOLLOWERS" -M $SCRIPT -z 4 --gams-level $LOG_LEVEL
gams_controller -mc $N -n $N -p osc-$TYPE -0 ".targets=$TARGETS;.followers=$FOLLOWERS" -M $SCRIPT -z 4 --gams-level $LOG_LEVEL
fi

exit 0
18 changes: 9 additions & 9 deletions src/gams/algorithms/AlgorithmFactory.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2014 Carnegie Mellon University. All Rights Reserved.
* Copyright(c) 2014 Carnegie Mellon University. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
Expand Down Expand Up @@ -51,42 +51,42 @@
using std::cerr;
using std::endl;

gams::algorithms::AlgorithmFactory::AlgorithmFactory ()
: knowledge_ (0), agents_ (0), platform_ (0), self_ (0), sensors_ (0)
gams::algorithms::AlgorithmFactory::AlgorithmFactory()
: knowledge_(0), agents_(0), platform_(0), self_(0), sensors_(0)
{
}

gams::algorithms::AlgorithmFactory::~AlgorithmFactory ()
gams::algorithms::AlgorithmFactory::~AlgorithmFactory()
{
}

void
gams::algorithms::AlgorithmFactory::set_agents (variables::Agents * agents)
gams::algorithms::AlgorithmFactory::set_agents(variables::Agents * agents)
{
agents_ = agents;
}

void
gams::algorithms::AlgorithmFactory::set_knowledge (
gams::algorithms::AlgorithmFactory::set_knowledge(
madara::knowledge::KnowledgeBase * knowledge)
{
knowledge_ = knowledge;
}

void
gams::algorithms::AlgorithmFactory::set_platform (platforms::BasePlatform * platform)
gams::algorithms::AlgorithmFactory::set_platform(platforms::BasePlatform * platform)
{
platform_ = platform;
}

void
gams::algorithms::AlgorithmFactory::set_self (variables::Self * self)
gams::algorithms::AlgorithmFactory::set_self(variables::Self * self)
{
self_ = self;
}

void
gams::algorithms::AlgorithmFactory::set_sensors (variables::Sensors * sensors)
gams::algorithms::AlgorithmFactory::set_sensors(variables::Sensors * sensors)
{
sensors_ = sensors;
}
Loading

0 comments on commit 5907df3

Please # to comment.