Skip to content

Commit

Permalink
Merge branch 'ign-gazebo6' into azulradio/FOV-gui
Browse files Browse the repository at this point in the history
  • Loading branch information
jennuine authored Jul 11, 2022
2 parents 716a92f + f39bc25 commit 0ce21a7
Show file tree
Hide file tree
Showing 6 changed files with 189 additions and 125 deletions.
1 change: 1 addition & 0 deletions .github/ci/packages.apt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ libxi-dev
libxmu-dev
python3-distutils
python3-pybind11
python3-pytest
qml-module-qt-labs-folderlistmodel
qml-module-qt-labs-settings
qml-module-qtqml-models2
Expand Down
14 changes: 14 additions & 0 deletions include/ignition/gazebo/rendering/SceneManager.hh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <map>
#include <memory>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

Expand Down Expand Up @@ -200,6 +201,19 @@ inline namespace IGNITION_GAZEBO_VERSION_NAMESPACE {
/// \return Pointer to requested visual
public: rendering::VisualPtr VisualById(Entity _id);

/// \brief Load Actor animations
/// \param[in] _actor Actor
/// \return Animation name to ID map
public: std::unordered_map<std::string, unsigned int>
LoadAnimations(const sdf::Actor &_actor);

/// \brief Sequences Trajectories
/// \param[in] _trajectories Actor trajectories
/// \param[in] _time Actor trajectory delay start time (miliseconds)
public: void SequenceTrajectories(
std::vector<common::TrajectoryInfo>& _trajectories,
std::chrono::steady_clock::time_point _time);

/// \brief Create an actor
/// \param[in] _id Unique actor id
/// \param[in] _actor Actor sdf dom
Expand Down
20 changes: 18 additions & 2 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,25 @@ if (BUILD_TESTING)
testFixture_TEST
)

execute_process(COMMAND "${PYTHON_EXECUTABLE}" -m pytest --version
OUTPUT_VARIABLE PYTEST_output
ERROR_VARIABLE PYTEST_error
RESULT_VARIABLE PYTEST_result)
if(${PYTEST_result} EQUAL 0)
set(pytest_FOUND TRUE)
else()
message("")
message(WARNING "Pytest package not available: ${PYTEST_error}")
endif()

foreach (test ${python_tests})
add_test(NAME ${test}.py COMMAND
"${PYTHON_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/python/test/${test}.py")
if (pytest_FOUND)
add_test(NAME ${test}.py COMMAND
"${PYTHON_EXECUTABLE}" -m pytest "${CMAKE_SOURCE_DIR}/python/test/${test}.py" --junitxml "${CMAKE_BINARY_DIR}/test_results/UNIT_${test}.xml")
else()
add_test(NAME ${test}.py COMMAND
"${PYTHON_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/python/test/${test}.py")
endif()

set(_env_vars)
list(APPEND _env_vars "PYTHONPATH=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/python/")
Expand Down
14 changes: 10 additions & 4 deletions src/Server_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1004,7 +1004,9 @@ TEST_P(ServerFixture, IGN_UTILS_TEST_DISABLED_ON_WIN32(ResourcePath))
TEST_P(ServerFixture, GetResourcePaths)
{
ignition::common::setenv("IGN_GAZEBO_RESOURCE_PATH",
"/tmp/some/path:/home/user/another_path");
std::string("/tmp/some/path") +
common::SystemPaths::Delimiter() +
std::string("/home/user/another_path"));

ServerConfig serverConfig;
gazebo::Server server(serverConfig);
Expand Down Expand Up @@ -1034,7 +1036,9 @@ TEST_P(ServerFixture, GetResourcePaths)
TEST_P(ServerFixture, AddResourcePaths)
{
ignition::common::setenv("IGN_GAZEBO_RESOURCE_PATH",
"/tmp/some/path:/home/user/another_path");
std::string("/tmp/some/path") +
common::SystemPaths::Delimiter() +
std::string("/home/user/another_path"));
ignition::common::setenv("SDF_PATH", "");
ignition::common::setenv("IGN_FILE_PATH", "");

Expand Down Expand Up @@ -1063,7 +1067,9 @@ TEST_P(ServerFixture, AddResourcePaths)
// Add path
msgs::StringMsg_V req;
req.add_data("/tmp/new_path");
req.add_data("/tmp/more:/tmp/even_more");
req.add_data(std::string("/tmp/more") +
common::SystemPaths::Delimiter() +
std::string("/tmp/even_more"));
req.add_data("/tmp/some/path");
bool executed = node.Request("/gazebo/resource_paths/add", req);
EXPECT_TRUE(executed);
Expand All @@ -1082,7 +1088,7 @@ TEST_P(ServerFixture, AddResourcePaths)
{
char *pathCStr = std::getenv(env);

auto paths = common::Split(pathCStr, ':');
auto paths = common::Split(pathCStr, common::SystemPaths::Delimiter());
paths.erase(std::remove_if(paths.begin(), paths.end(),
[](std::string const &_path)
{
Expand Down
14 changes: 7 additions & 7 deletions src/Util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ std::vector<std::string> resourcePaths()
char *gzPathCStr = std::getenv(kResourcePathEnv.c_str());
if (gzPathCStr && *gzPathCStr != '\0')
{
gzPaths = common::Split(gzPathCStr, ':');
gzPaths = common::Split(gzPathCStr, common::SystemPaths::Delimiter());
}

gzPaths.erase(std::remove_if(gzPaths.begin(), gzPaths.end(),
Expand All @@ -428,7 +428,7 @@ void addResourcePaths(const std::vector<std::string> &_paths)
char *sdfPathCStr = std::getenv(kSdfPathEnv.c_str());
if (sdfPathCStr && *sdfPathCStr != '\0')
{
sdfPaths = common::Split(sdfPathCStr, ':');
sdfPaths = common::Split(sdfPathCStr, common::SystemPaths::Delimiter());
}

// Ignition file paths (for <uri>s)
Expand All @@ -437,15 +437,15 @@ void addResourcePaths(const std::vector<std::string> &_paths)
char *ignPathCStr = std::getenv(systemPaths->FilePathEnv().c_str());
if (ignPathCStr && *ignPathCStr != '\0')
{
ignPaths = common::Split(ignPathCStr, ':');
ignPaths = common::Split(ignPathCStr, common::SystemPaths::Delimiter());
}

// Gazebo resource paths
std::vector<std::string> gzPaths;
char *gzPathCStr = std::getenv(kResourcePathEnv.c_str());
if (gzPathCStr && *gzPathCStr != '\0')
{
gzPaths = common::Split(gzPathCStr, ':');
gzPaths = common::Split(gzPathCStr, common::SystemPaths::Delimiter());
}

// Add new paths to gzPaths
Expand Down Expand Up @@ -474,20 +474,20 @@ void addResourcePaths(const std::vector<std::string> &_paths)
// Update the vars
std::string sdfPathsStr;
for (const auto &path : sdfPaths)
sdfPathsStr += ':' + path;
sdfPathsStr += common::SystemPaths::Delimiter() + path;

ignition::common::setenv(kSdfPathEnv.c_str(), sdfPathsStr.c_str());

std::string ignPathsStr;
for (const auto &path : ignPaths)
ignPathsStr += ':' + path;
ignPathsStr += common::SystemPaths::Delimiter() + path;

ignition::common::setenv(
systemPaths->FilePathEnv().c_str(), ignPathsStr.c_str());

std::string gzPathsStr;
for (const auto &path : gzPaths)
gzPathsStr += ':' + path;
gzPathsStr += common::SystemPaths::Delimiter() + path;

ignition::common::setenv(kResourcePathEnv.c_str(), gzPathsStr.c_str());

Expand Down
Loading

0 comments on commit 0ce21a7

Please sign in to comment.