diff --git a/scripts/simulation/unreal/greet/greet.mf b/scripts/simulation/unreal/greet/greet.mf index 84d901792..8582c868f 100644 --- a/scripts/simulation/unreal/greet/greet.mf +++ b/scripts/simulation/unreal/greet/greet.mf @@ -8,7 +8,7 @@ {.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=.guard; + {.prefix}.algorithm.args.locations.1=.origin; {.prefix}.algorithm.args.repeat=5; ); diff --git a/scripts/simulation/unreal/greet/greet_and_follow.mf b/scripts/simulation/unreal/greet/greet_and_follow.mf index afd582a53..304205b8f 100644 --- a/scripts/simulation/unreal/greet/greet_and_follow.mf +++ b/scripts/simulation/unreal/greet/greet_and_follow.mf @@ -8,7 +8,7 @@ {.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=.guard; + {.prefix}.algorithm.args.locations.1=.origin; {.prefix}.algorithm.args.repeat=5; ); diff --git a/src/gams/groups/GroupFixedList.cpp b/src/gams/groups/GroupFixedList.cpp index be17a1edc..d5121308e 100644 --- a/src/gams/groups/GroupFixedList.cpp +++ b/src/gams/groups/GroupFixedList.cpp @@ -106,6 +106,7 @@ gams::groups::GroupFixedList::add_members(const AgentVector & members) fast_members_.insert( fast_members_.end(), members.begin(), members.end()); + if (knowledge_) { knowledge::ContextGuard guard(*knowledge_); @@ -185,6 +186,7 @@ gams::groups::GroupFixedList::remove_members(const AgentVector & members) } } + if (knowledge_) { knowledge::ContextGuard guard(*knowledge_); diff --git a/tests/test_auctions.cpp b/tests/test_auctions.cpp index 4d2f6b875..339c13f38 100644 --- a/tests/test_auctions.cpp +++ b/tests/test_auctions.cpp @@ -244,7 +244,6 @@ void test_minimum_distance_auction(knowledge::KnowledgeBase & knowledge) loggers::global_logger->log( loggers::LOG_ALWAYS, "Testing AuctionMinimumDistance\n"); -// knowledge::KnowledgeBase knowledge; knowledge.clear(true); gams::groups::GroupFixedList group; @@ -255,6 +254,9 @@ void test_minimum_distance_auction(knowledge::KnowledgeBase & knowledge) gams::pose::Position target; gams::platforms::NullPlatform platform(&knowledge, 0, &platforms, 0); + loggers::global_logger->log( + loggers::LOG_ALWAYS, " Adding members to the group\n"); + // add some members to the group members.push_back("agent.0"); members.push_back("agent.1"); @@ -263,9 +265,15 @@ void test_minimum_distance_auction(knowledge::KnowledgeBase & knowledge) members.push_back("agent.4"); group.add_members(members); + loggers::global_logger->log( + loggers::LOG_ALWAYS, " Initializing group variables in KB\n"); + // initialize agent variables so we can manipulate them directly gams::variables::init_vars(agents, knowledge, group); + loggers::global_logger->log( + loggers::LOG_ALWAYS, " Creating bids\n"); + // setup some handy references for referring to individual bids containers::Double agent0bid("auction.guard_duty.0.agent.0", knowledge); containers::Double agent1bid("auction.guard_duty.0.agent.1", knowledge); @@ -273,6 +281,9 @@ void test_minimum_distance_auction(knowledge::KnowledgeBase & knowledge) containers::Double agent3bid("auction.guard_duty.0.agent.3", knowledge); containers::Double agent4bid("auction.guard_duty.0.agent.4", knowledge); + loggers::global_logger->log( + loggers::LOG_ALWAYS, " Mimicking agent locations\n"); + // create some GPS locations position.latitude(42.0600); position.longitude(-72.0600); @@ -294,16 +305,28 @@ void test_minimum_distance_auction(knowledge::KnowledgeBase & knowledge) position.longitude(-72.1000); position.to_container(agents[4].location); + loggers::global_logger->log( + loggers::LOG_ALWAYS, " Initializing auction\n"); + auctions::AuctionMinimumDistance auction( "auction.guard_duty", "agent.0", &knowledge, &platform); + loggers::global_logger->log( + loggers::LOG_ALWAYS, " Adding group\n"); + auction.add_group(&group); // set the target position + loggers::global_logger->log( + loggers::LOG_ALWAYS, " Setting target and calculating bids\n"); + auction.set_target(position); auction.calculate_bids(); + loggers::global_logger->log( + loggers::LOG_ALWAYS, " Electing leader based on proximity\n"); + std::string closest = auction.get_leader(); if (closest == "agent.0")