More fixing for windows

This commit is contained in:
bernatx 2019-06-13 12:30:21 +02:00 committed by Néstor Subirón
parent ced914a653
commit 8e4f7a7248
6 changed files with 15 additions and 168 deletions

View File

@ -31,13 +31,6 @@ if (WIN32)
# Install zlib lib.
file(GLOB libpng_libraries "${LIBPNG_LIB_PATH}/*")
install(FILES ${libpng_libraries} DESTINATION lib)
# Install recast headers.
file(GLOB recast_includes "${RECAST_INCLUDE_PATH}/*")
install(FILES ${recast_includes} DESTINATION include)
# Install recast lib.
file(GLOB recast_libraries "${RECAST_LIB_PATH}/*")
install(FILES ${recast_libraries} DESTINATION lib)
endif (WIN32)
# Add sources.

View File

@ -4,7 +4,7 @@
// This work is licensed under the terms of the MIT license.
// For a copy, see <https://opensource.org/licenses/MIT>.
#define _USE_MATH_DEFINES // to avoid undefined error (bug in Visual Studio 2015 and 2017)
#define _USE_MATH_DEFINES // to avoid undefined error of M_PI (bug in Visual Studio 2015 and 2017)
#include <cmath>
#include "carla/Logging.h"
@ -30,6 +30,10 @@ namespace nav {
}
Navigation::~Navigation() {
_mappedId.clear();
_baseHeight.clear();
_yaw_walkers.clear();
_binaryMesh.clear();
dtFreeCrowd(_crowd);
dtFreeNavMeshQuery(_navQuery);
dtFreeNavMesh(_navMesh);
@ -300,7 +304,7 @@ namespace nav {
// save the base offset of this walker
_baseHeight[id] = base_offset;
yaw_walkers[id] = 0.0f;
_yaw_walkers[id] = 0.0f;
return true;
}
@ -395,15 +399,16 @@ namespace nav {
// set its position in Unreal coordinates
trans.location.x = agent->npos[0];
trans.location.y = agent->npos[2];
trans.location.z = agent->npos[1] + baseOffset - 0.08f; // 0.08f is a hardcoded value to get rid of some empty space
// trans.location.z = agent->npos[1] + baseOffset - 0.08f; // 0.08f is a hardcoded value to get rid of some empty space
trans.location.z = agent->npos[1] + baseOffset;
// set its rotation
float yaw = atan2f(agent->dvel[2] , agent->dvel[0]) * (180.0f / static_cast<float>(M_PI));
float shortest_angle = fmod(yaw - yaw_walkers[id] + 540.0f, 360.0f) - 180.0f;
float shortest_angle = fmod(yaw - _yaw_walkers[id] + 540.0f, 360.0f) - 180.0f;
float rotation_speed = 4.0f;
trans.rotation.yaw = yaw_walkers[id] + (shortest_angle * rotation_speed * static_cast<float>(_delta_seconds));
trans.rotation.yaw = _yaw_walkers[id] + (shortest_angle * rotation_speed * static_cast<float>(_delta_seconds));
yaw_walkers[id] = trans.rotation.yaw;
_yaw_walkers[id] = trans.rotation.yaw;
return true;
}

View File

@ -91,7 +91,7 @@ namespace nav {
// base height of each walker
std::unordered_map<ActorId, float> _baseHeight;
// Store walkers yaw angle from previous tick
std::unordered_map<ActorId, float> yaw_walkers;
std::unordered_map<ActorId, float> _yaw_walkers;
std::mutex _mutex;

View File

@ -1,153 +0,0 @@
#! /bin/bash
# ==============================================================================
# -- Set up environment --------------------------------------------------------
# ==============================================================================
source $(dirname "$0")/Environment.sh
if [ ! -d "${UE4_ROOT}" ]; then
fatal_error "UE4_ROOT is not defined, or points to a non-existant directory, please set this environment variable."
else
log "Using Unreal Engine at '$UE4_ROOT'"
fi
# ==============================================================================
# -- Parse arguments -----------------------------------------------------------
# ==============================================================================
DOC_STRING="Build and launch CarlaUE4."
USAGE_STRING="Usage: $0 [-h|--help] [--build] [--rebuild] [--launch] [--clean] [--hard-clean]"
REMOVE_INTERMEDIATE=false
HARD_CLEAN=false
BUILD_CARLAUE4=false
LAUNCH_UE4_EDITOR=false
GDB=
OPTS=`getopt -o h --long help,build,rebuild,launch,clean,hard-clean,gdb -n 'parse-options' -- "$@"`
if [ $? != 0 ] ; then echo "$USAGE_STRING" ; exit 2 ; fi
eval set -- "$OPTS"
while true; do
case "$1" in
--gdb )
GDB="gdb --args";
shift ;;
--build )
BUILD_CARLAUE4=true;
shift ;;
--rebuild )
REMOVE_INTERMEDIATE=true;
BUILD_CARLAUE4=true;
shift ;;
--launch )
LAUNCH_UE4_EDITOR=true;
shift ;;
--clean )
REMOVE_INTERMEDIATE=true;
shift ;;
--hard-clean )
REMOVE_INTERMEDIATE=true;
HARD_CLEAN=true;
shift ;;
-h | --help )
echo "$DOC_STRING"
echo "$USAGE_STRING"
exit 1
;;
* )
break ;;
esac
done
if ! { ${REMOVE_INTERMEDIATE} || ${BUILD_CARLAUE4} || ${LAUNCH_UE4_EDITOR}; }; then
fatal_error "Nothing selected to be done."
fi
pushd "${CARLAUE4_ROOT_FOLDER}" >/dev/null
# ==============================================================================
# -- Clean CarlaUE4 ------------------------------------------------------------
# ==============================================================================
if ${HARD_CLEAN} ; then
if [ ! -f Makefile ]; then
fatal_error "The project wasn't built before!"
fi
log "Doing a \"hard\" clean of the Unreal Engine project."
make CarlaUE4Editor ARGS=-clean
fi
if ${REMOVE_INTERMEDIATE} ; then
log "Cleaning intermediate files and folders."
UE4_INTERMEDIATE_FOLDERS="Binaries Build Intermediate DerivedDataCache"
rm -Rf ${UE4_INTERMEDIATE_FOLDERS}
rm -f Makefile
pushd "${CARLAUE4_PLUGIN_ROOT_FOLDER}" >/dev/null
rm -Rf ${UE4_INTERMEDIATE_FOLDERS}
popd >/dev/null
fi
# ==============================================================================
# -- Build CarlaUE4 ------------------------------------------------------------
# ==============================================================================
if ${BUILD_CARLAUE4} ; then
if [ ! -f Makefile ]; then
# This command fails sometimes but normally we can continue anyway.
set +e
log "Generate Unreal project files."
${UE4_ROOT}/GenerateProjectFiles.sh -project="${PWD}/CarlaUE4.uproject" -game -engine -makefiles
set -e
fi
log "Build CarlaUE4 project."
make CarlaUE4Editor
#Providing the user with the ExportedMaps folder
EXPORTED_MAPS="${CARLAUE4_ROOT_FOLDER}/Content/Carla/ExportedMaps"
mkdir -p "${EXPORTED_MAPS}"
fi
# ==============================================================================
# -- Launch UE4Editor ----------------------------------------------------------
# ==============================================================================
if ${LAUNCH_UE4_EDITOR} ; then
log "Launching UE4Editor..."
${GDB} ${UE4_ROOT}/Engine/Binaries/Linux/UE4Editor "${PWD}/CarlaUE4.uproject"
else
log "Success!"
fi
# ==============================================================================
# -- ...and we are done --------------------------------------------------------
# ==============================================================================
popd >/dev/null

View File

@ -153,6 +153,8 @@ if not defined install_recast (
echo %FILE_N% Failed while installing "Recast & Detour".
goto failed
) else (
set RECAST_INSTALL_DIR=%install_recast:\=/%
)
rem ============================================================================

View File

@ -131,7 +131,7 @@ rem ============================================================================
:good_exit
echo %FILE_N% Exiting...
endlocal
set install_recast=done
endlocal & set install_recast=%RECAST_INSTALL_DIR%
exit /b 0
:bad_exit