forked from MengeCrowdSim/Menge
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This plugin allows to use "Menge" to control humans in the robot simulator Webots. Vice versa, robots from Webots can be perceived by the agents in Menge as an agent, so that Menge humans can avoid the robot.
- Loading branch information
Showing
12 changed files
with
709 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
cmake_minimum_required(VERSION 2.8) | ||
|
||
project(WebotsControllerPlugin) | ||
|
||
add_definitions( -DWEBOTS_EXPORT ) | ||
|
||
# Link with the Webots controller library. | ||
link_directories($ENV{WEBOTS_HOME}/lib/controller) | ||
set (WEBOTS_LIBRARIES ${CMAKE_SHARED_LIBRARY_PREFIX}Controller${CMAKE_SHARED_LIBRARY_SUFFIX} ${CMAKE_SHARED_LIBRARY_PREFIX}CppController${CMAKE_SHARED_LIBRARY_SUFFIX}) | ||
include_directories($ENV{WEBOTS_HOME}/include/controller/c $ENV{WEBOTS_HOME}/include/controller/cpp) | ||
|
||
|
||
file( | ||
GLOB_RECURSE | ||
source_files | ||
${PLUGIN_SOURCE_DIR}/WebotsController/*.cpp | ||
${PLUGIN_SOURCE_DIR}/WebotsController/*.h | ||
) | ||
|
||
add_library( | ||
webotsController | ||
SHARED | ||
${source_files} | ||
) | ||
|
||
target_link_libraries (webotsController mengeCore ${WEBOTS_LIBRARIES} ) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
Menge Crowd Simulation Framework | ||
Copyright and trademark 2012-17 University of North Carolina at Chapel Hill | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
or | ||
LICENSE.txt in the root of the Menge repository. | ||
Any questions or comments should be sent to the authors menge@cs.unc.edu | ||
<http://gamma.cs.unc.edu/Menge/> | ||
*/ | ||
|
||
/*! | ||
@file WebotsControllerConfig.h | ||
@brief Configures the shared library aspect of the includes. | ||
*/ | ||
|
||
#ifndef __WEBOTS_CONTROLLER_CONFIG_H__ | ||
#define __WEBOTS_CONTROLLER_CONFIG_H__ | ||
|
||
|
||
// Now set up compiler-dependent export/import symbols | ||
|
||
#if defined(_MSC_VER) | ||
|
||
#if defined(WEBOTS_STATICLIB ) | ||
#define WEBOTS_API | ||
#else | ||
#if defined( WEBOTS_EXPORT ) | ||
// We are building the DLL, export the symbols tagged like this | ||
#define WEBOTS_API __declspec(dllexport) | ||
#else | ||
// If we are consuming the DLL, import the symbols tagged like this | ||
#define WEBOTS_API __declspec(dllimport) | ||
#endif | ||
#endif | ||
|
||
#elif defined(__GNUC__) | ||
|
||
#if defined( WEBOTS_STATICLIB ) | ||
#define WEBOTS_API | ||
#else | ||
#if defined( WEBOTS_EXPORT ) | ||
#define WEBOTS_API __attribute__ ((visibility ("default"))) | ||
#else | ||
// If you use -fvisibility=hidden in GCC, exception handling and RTTI | ||
// would break if visibility wasn't set during export _and_ import | ||
// because GCC would immediately forget all type infos encountered. | ||
// See http://gcc.gnu.org/wiki/Visibility | ||
#define WEBOTS_API __attribute__ ((visibility ("default"))) | ||
#endif | ||
#endif | ||
|
||
#else | ||
|
||
#error Unknown compiler, please implement shared library macros | ||
|
||
#endif // Compiler-detection | ||
|
||
#endif // __SAMPLE_CONFIG_H__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
License | ||
Menge | ||
Copyright � and trademark � 2012-14 University of North Carolina at Chapel Hill. | ||
All rights reserved. | ||
Permission to use, copy, modify, and distribute this software and its documentation | ||
for educational, research, and non-profit purposes, without fee, and without a | ||
written agreement is hereby granted, provided that the above copyright notice, | ||
this paragraph, and the following four paragraphs appear in all copies. | ||
This software program and documentation are copyrighted by the University of North | ||
Carolina at Chapel Hill. The software program and documentation are supplied "as is," | ||
without any accompanying services from the University of North Carolina at Chapel | ||
Hill or the authors. The University of North Carolina at Chapel Hill and the | ||
authors do not warrant that the operation of the program will be uninterrupted | ||
or error-free. The end-user understands that the program was developed for research | ||
purposes and is advised not to rely exclusively on the program for any reason. | ||
IN NO EVENT SHALL THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL OR THE AUTHORS | ||
BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL | ||
DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS | ||
DOCUMENTATION, EVEN IF THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL OR THE | ||
AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL AND THE AUTHORS SPECIFICALLY | ||
DISCLAIM ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE AND ANY STATUTORY WARRANTY | ||
OF NON-INFRINGEMENT. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND | ||
THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL AND THE AUTHORS HAVE NO OBLIGATIONS | ||
TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | ||
Any questions or comments should be sent to the authors {menge,geom}@cs.unc.edu | ||
*/ | ||
|
||
/*! | ||
* @file SamplePlugin.cpp | ||
* @brief Plugin for extended elements. | ||
*/ | ||
|
||
#include "WebotsControllerConfig.h" | ||
#include "WebotsControllerTask.h" | ||
|
||
|
||
#include "MengeCore/PluginEngine/CorePluginEngine.h" | ||
|
||
using Menge::PluginEngine::CorePluginEngine; | ||
|
||
extern "C" { | ||
/*! | ||
* @brief Retrieves the name of the plug-in. | ||
* | ||
* @returns The name of the plug in. | ||
*/ | ||
WEBOTS_API const char * getName() {return "webots controller";} | ||
|
||
/*! | ||
* @brief Description of the plug-in. | ||
* | ||
* @returns A description of the plugin. | ||
*/ | ||
WEBOTS_API const char * getDescription() { | ||
return "Webots controller:\n"\ | ||
"\tToDO\n" | ||
"\tToDO\n"; | ||
} | ||
|
||
/*! | ||
* @brief Registers the plug-in with the PluginEngine | ||
* | ||
* @param engine A pointer to the plugin engine. | ||
*/ | ||
WEBOTS_API void registerCorePlugin(CorePluginEngine* engine) { | ||
engine->registerTaskFactory(new WebotsController::WebotsControllerTaskFactory()); | ||
} | ||
} |
Oops, something went wrong.