Skip to content

Commit

Permalink
Merge branch 'gazebo11' into replace_deprecated_tbb_task
Browse files Browse the repository at this point in the history
  • Loading branch information
traversaro committed Mar 6, 2022
2 parents 8111c4f + 34ebf4e commit 4fff786
Show file tree
Hide file tree
Showing 4 changed files with 176 additions and 50 deletions.
104 changes: 104 additions & 0 deletions .github/workflows/conda-forge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: C++ CI Workflow with conda-forge dependencies

on:
push:
branches:
- gazebo11
pull_request:
schedule:
# * is a special character in YAML so you have to quote this string
# Execute a "nightly" build at 2 AM UTC
- cron: '0 2 * * *'

jobs:
build:
name: '[${{ matrix.os }}@${{ matrix.build_type }}@conda]'
runs-on: ${{ matrix.os }}
strategy:
matrix:
build_type: [Release]
os: [ubuntu-latest, windows-2019, macos-latest]
fail-fast: false

steps:
- uses: actions/checkout@v2

- uses: conda-incubator/setup-miniconda@v2
with:
mamba-version: "*"
channels: conda-forge
channel-priority: true

- name: Dependencies
shell: bash -l {0}
run: |
# Workaround for https://github.com/conda-incubator/setup-miniconda/issues/186
conda config --remove channels defaults
# Compilation related dependencies
mamba install cmake compilers make ninja pkg-config
# Actual dependencies
mamba install libprotobuf libsdformat libignition-cmake2 libignition-math6 libignition-transport8 libignition-common3 libignition-fuel-tools4 qt=5.12.9=*_4 ogre=1.10 freeimage curl tbb-devel=2020 qwt tinyxml2 libccd boost-cpp libcurl tinyxml bzip2 zlib ffmpeg graphviz libgdal libusb bullet-cpp dartsim simbody hdf5 openal-soft glib gts
- name: Linux-only Dependencies [Linux]
if: contains(matrix.os, 'ubuntu')
shell: bash -l {0}
run: |
# See https://github.com/robotology/robotology-superbuild/issues/477
mamba install expat-cos6-x86_64 libselinux-cos6-x86_64 libxau-cos6-x86_64 libxcb-cos6-x86_64 libxdamage-cos6-x86_64 libxext-cos6-x86_64 libxfixes-cos6-x86_64 libxxf86vm-cos6-x86_64 mesalib mesa-libgl-cos6-x86_64 mesa-libgl-devel-cos6-x86_64 libuuid
- name: Unix-only Dependencies [Linux&macOS]
if: contains(matrix.os, 'ubuntu') || contains(matrix.os, 'macos')
shell: bash -l {0}
run: |
mamba install libtar
- name: Windows-only Dependencies [Windows]
if: contains(matrix.os, 'windows')
shell: bash -l {0}
run: |
# Compilation related dependencies
mamba install vs2019_win-64 dlfcn-win32 tiny-process-library
- name: Configure [Linux&macOS]
if: contains(matrix.os, 'macos') || contains(matrix.os, 'ubuntu')
shell: bash -l {0}
run: |
mkdir -p build
cd build
cmake -GNinja -DBUILD_TESTING:BOOL=OFF -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ..
- name: Build [Linux&macOS]
if: contains(matrix.os, 'macos') || contains(matrix.os, 'ubuntu')
shell: bash -l {0}
run: |
cd build
cmake --build . --config ${{ matrix.build_type }}
# - name: Test [Linux&macOS]
# if: contains(matrix.os, 'macos') || contains(matrix.os, 'ubuntu')
# shell: bash -l {0}
# run: |
# cd build
# ctest --output-on-failure -C ${{ matrix.build_type }}

- name: Configure [Windows]
if: contains(matrix.os, 'windows')
shell: cmd /C call {0}
run: |
mkdir -p build
cd build
cmake -GNinja -DBUILD_TESTING:BOOL=OFF -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ..
- name: Build [Windows]
if: contains(matrix.os, 'windows')
shell: cmd /C call {0}
run: |
cd build
cmake --build . --config ${{ matrix.build_type }} --parallel 2
# - name: Test [Windows]
# if: contains(matrix.os, 'windows')
# shell: cmd /C call {0}
# run: |
# cd build
# ctest --output-on-failure -C ${{ matrix.build_type }}
1 change: 0 additions & 1 deletion cmake/SearchForStuff.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,6 @@ find_path(QWT_INCLUDE_DIR NAMES qwt.h PATHS
)

find_library(QWT_LIBRARY NAMES qwt-qt5 qwt PATHS
/usr/lib
/usr/local/lib
/usr/local/lib/qwt.framework
${QWT_WIN_LIBRARY_DIR}
Expand Down
117 changes: 68 additions & 49 deletions gazebo/rendering/Scene.cc
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ void Scene::Clear()

delete this->dataPtr->terrain;
this->dataPtr->terrain = NULL;
this->dataPtr->terrainVisualId.reset();

while (!this->dataPtr->visuals.empty())
this->RemoveVisual(this->dataPtr->visuals.begin()->first);
Expand Down Expand Up @@ -2825,54 +2826,6 @@ bool Scene::ProcessVisualMsg(ConstVisualPtr &_msg, Visual::VisualType _type)
return true;
}

// Creating heightmap
// FIXME: A bit of a hack.
if (_msg->has_geometry() &&
_msg->geometry().type() == msgs::Geometry::HEIGHTMAP &&
_type != Visual::VT_COLLISION)
{
if (this->dataPtr->terrain)
{
// Only one Heightmap can be created per Scene
return true;
}
else
{
if (!this->dataPtr->terrain)
{
// create a dummy visual for loading heightmap visual plugin
// TODO make heightmap a visual to avoid special treatment here?
VisualPtr visual(new Visual(_msg->name(), this->dataPtr->worldVisual));
auto m = *_msg.get();
m.clear_material();
visual->Load(msgs::VisualToSDF(m));

this->dataPtr->terrain = new Heightmap(shared_from_this());
// check the material fields and set material if it is specified
if (_msg->has_material())
{
auto matMsg = _msg->material();
if (matMsg.has_script())
{
auto scriptMsg = matMsg.script();
for (auto const &uri : scriptMsg.uri())
{
if (!uri.empty())
RenderEngine::Instance()->AddResourcePath(uri);
}
std::string matName = scriptMsg.name();
this->dataPtr->terrain->SetMaterial(matName);
}
}
this->dataPtr->terrain->SetLOD(this->dataPtr->heightmapLOD);
const double skirtLen = this->dataPtr->heightmapSkirtLength;
this->dataPtr->terrain->SetSkirtLength(skirtLen);
this->dataPtr->terrain->LoadFromMsg(_msg);
}
}
return true;
}

// Creating collision
if (_type == Visual::VT_COLLISION)
{
Expand All @@ -2897,6 +2850,20 @@ bool Scene::ProcessVisualMsg(ConstVisualPtr &_msg, Visual::VisualType _type)
return true;
}

// Exit early if a heightmap already exists
bool hasHeightmap = false;
if (_msg->has_geometry() &&
_msg->geometry().type() == msgs::Geometry::HEIGHTMAP)
{
hasHeightmap = true;
if (this->dataPtr->terrain)
{
// Only one Heightmap can be created per Scene
return true;
}
}


// All other visuals
VisualPtr visual;

Expand Down Expand Up @@ -2924,7 +2891,51 @@ bool Scene::ProcessVisualMsg(ConstVisualPtr &_msg, Visual::VisualType _type)
if (_msg->has_id())
visual->SetId(_msg->id());

visual->LoadFromMsg(_msg);
if (!hasHeightmap)
{
visual->LoadFromMsg(_msg);
}
else
// Creating heightmap
// FIXME: A bit of a hack.
{
{
// Copy the const _msg so that we can clear materials before
// loading from message
msgs::Visual *msgMutable = new msgs::Visual(*_msg.get());
msgMutable->clear_material();

// assign ownership of the copy to a const shared_ptr so it will be
// deleted when exiting this scope
ConstVisualPtr msgShared(static_cast<const msgs::Visual*>(msgMutable));
visual->LoadFromMsg(msgShared);
}

// Store VisualId corresponding to terrain
this->dataPtr->terrainVisualId.emplace(visual->GetId());

this->dataPtr->terrain = new Heightmap(shared_from_this());
// check the material fields and set material if it is specified
if (_msg->has_material())
{
auto matMsg = _msg->material();
if (matMsg.has_script())
{
auto scriptMsg = matMsg.script();
for (auto const &uri : scriptMsg.uri())
{
if (!uri.empty())
RenderEngine::Instance()->AddResourcePath(uri);
}
std::string matName = scriptMsg.name();
this->dataPtr->terrain->SetMaterial(matName);
}
}
this->dataPtr->terrain->SetLOD(this->dataPtr->heightmapLOD);
const double skirtLen = this->dataPtr->heightmapSkirtLength;
this->dataPtr->terrain->SetSkirtLength(skirtLen);
this->dataPtr->terrain->LoadFromMsg(_msg);
}
visual->SetType(_type);

this->dataPtr->visuals[visual->GetId()] = visual;
Expand Down Expand Up @@ -3407,6 +3418,14 @@ void Scene::RemoveVisual(uint32_t _id)
if (iter != this->dataPtr->visuals.end())
{
VisualPtr vis = iter->second;
// Remove the terrain object if this is the heightmap visual
if (this->dataPtr->terrainVisualId &&
*this->dataPtr->terrainVisualId == _id)
{
delete this->dataPtr->terrain;
this->dataPtr->terrain = NULL;
this->dataPtr->terrainVisualId.reset();
}
// Remove all projectors attached to the visual
auto piter = this->dataPtr->projectors.begin();
while (piter != this->dataPtr->projectors.end())
Expand Down
4 changes: 4 additions & 0 deletions gazebo/rendering/ScenePrivate.hh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <map>
#include <memory>
#include <mutex>
#include <optional>
#include <string>
#include <vector>

Expand Down Expand Up @@ -309,6 +310,9 @@ namespace gazebo
/// \brief True if this scene is running on the server.
public: bool isServer;

/// \brief Terrain Visual Id.
public: std::optional<uint32_t> terrainVisualId;

/// \brief The heightmap, if any.
public: Heightmap *terrain = nullptr;

Expand Down

0 comments on commit 4fff786

Please sign in to comment.