Permalink
Browse files

Minor fixes on unreal integration (#70)

Fixed gpc.pl to set unreal quad controller to AirLibQuadcopter
Added setting multicast as default to kb in airlib quadcopter
  • Loading branch information...
sedrakGR authored and jredmondson committed Feb 9, 2019
1 parent 1af2d5d commit a82e0c7a71b35626350aa8f4979d5644156615ad
Showing with 51 additions and 5 deletions.
  1. +2 −2 scripts/projects/gpc.pl
  2. +49 −3 src/gams/platforms/airlib/AirLibQuadcopter.cpp
@@ -425,11 +425,11 @@

if ($platform eq 'unreal-quad')
{
$platform_base_class = 'AirLibQuadcopterBase';
$platform_base_class = 'AirLibQuadcopter';
$subclass_provided = 1;
$subclass_header_path = '$gams_root/src/gams/platforms/airlib/$platform_base_class\.cpp';
$subclass_cpp_path = '$gams_root/src/gams/platforms/airlib/$platform_base_class\.h';
print("Setting platform base class to $platform_base_class (AirLibQuadcopterBase)\n");
print("Setting platform base class to $platform_base_class (AirLibQuadcopter)\n");

# generate settings.json script if unreal-quad is enabled given the number of agents
my $output = `$gams_root/scripts/projects/airsim_json_generator.py json $agents`;
@@ -35,7 +35,54 @@ gams::platforms::AirLibQuadcopterFactory::create (
variables::Platforms * platforms,
variables::Self * self)
{
return new AirLibQuadcopter(knowledge, sensors, self);
madara_logger_ptr_log (gams::loggers::global_logger.get (),
gams::loggers::LOG_MINOR,
"entering gams::platforms::AirLibQuadcopterFactory::create\n");

BasePlatform * result (0);

if (knowledge && sensors && platforms && self)
{
if (knowledge->get_num_transports () == 0)
{
madara::transport::QoSTransportSettings settings;

settings.type = madara::transport::MULTICAST;
settings.hosts.push_back ("239.255.0.1:4150");

knowledge_->attach_transport ("", settings);
knowledge_->activate_transport ();

madara_logger_ptr_log (gams::loggers::global_logger.get (),
gams::loggers::LOG_MINOR,
"gams::platforms::AirLibQuadcopterFactory::create:" \
" no transports found, attaching multicast\n");
}

madara_logger_ptr_log (gams::loggers::global_logger.get (),
gams::loggers::LOG_MAJOR,
"gams::platforms::AirLibQuadcopterFactory::create:" \
" creating AirLibQuadcopter object\n");

result = new AirLibQuadcopter(knowledge, sensors, self);
}
else
{
madara_logger_ptr_log (gams::loggers::global_logger.get (),
gams::loggers::LOG_ERROR,
"gams::platforms::AirLibQuadcopterFactory:::create:" \
" invalid knowledge, sensors, platforms, or self\n");
}

if (result == 0)
{
madara_logger_ptr_log (gams::loggers::global_logger.get (),
gams::loggers::LOG_MAJOR,
"gams::platforms::AirLibQuadcopterFactory:::create:" \
" error creating AirLibQuadcopter object\n");
}

return result;
}

gams::platforms::AirLibQuadcopter::AirLibQuadcopter (
@@ -89,7 +136,6 @@ gams::platforms::AirLibQuadcopter::AirLibQuadcopter (
status_.movement_available = 1;

}

std::cout << "AirLibQuadcopter active!" << std::endl;
}
catch (rpc::rpc_error& e) {
@@ -107,7 +153,7 @@ gams::platforms::AirLibQuadcopter::~AirLibQuadcopter()
std::string
gams::platforms::AirLibQuadcopter::get_id () const
{
return "airlib_quad";
return "unreal_quad";
}

std::string

0 comments on commit a82e0c7

Please sign in to comment.