-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #856 from ignitionrobotics/azeey/12_to_main_20220218
12 ➡️ main
- Loading branch information
Showing
73 changed files
with
4,913 additions
and
134 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/bin/sh -l | ||
|
||
set -x | ||
|
||
BUILD_DIR=`pwd` | ||
|
||
cd /tmp | ||
|
||
# check that we can compile USD from sources (only Focal) | ||
mkdir cmake_test | ||
cd cmake_test | ||
|
||
echo "cmake_minimum_required(VERSION 3.12)" > CMakeLists.txt | ||
|
||
return_code=0 | ||
cmake . || return_code=$(($return_code + $?)) | ||
if [ $return_code -eq 0 ] | ||
then | ||
# compile USD from sources | ||
cd /tmp | ||
mkdir usd_binaries | ||
cd usd_binaries | ||
|
||
apt-get install libboost-all-dev libtbb-dev p7zip-full -y | ||
|
||
wget https://github.com/PixarAnimationStudios/USD/archive/refs/tags/v21.11.zip | ||
unzip v21.11.zip | ||
cd USD-21.11 | ||
mkdir build | ||
cd build | ||
|
||
cmake -DCMAKE_INSTALL_PREFIX="/tmp/USD" -DCMAKE_PREFIX_PATH="/tmp/USD" \ | ||
-DCMAKE_BUILD_TYPE=Release \ | ||
-DPXR_PREFER_SAFETY_OVER_SPEED=ON \ | ||
-DPXR_ENABLE_PYTHON_SUPPORT=OFF \ | ||
-DBUILD_SHARED_LIBS=ON \ | ||
-DTBB_USE_DEBUG_BUILD=OFF \ | ||
-DPXR_BUILD_DOCUMENTATION=OFF \ | ||
-DPXR_BUILD_TESTS=OFF \ | ||
-DPXR_BUILD_EXAMPLES=OFF \ | ||
-DPXR_BUILD_TUTORIALS=OFF \ | ||
-DPXR_BUILD_USD_TOOLS=OFF \ | ||
-DPXR_BUILD_IMAGING=OFF \ | ||
-DPXR_BUILD_USD_IMAGING=OFF \ | ||
-DPXR_BUILD_USDVIEW=OFF \ | ||
-DPXR_BUILD_ALEMBIC_PLUGIN=OFF \ | ||
-DPXR_BUILD_DRACO_PLUGIN=OFF \ | ||
-DPXR_ENABLE_MATERIALX_SUPPORT=OFF \ | ||
-DBoost_INCLUDE_DIR=/usr/include \ | ||
-DBoost_NO_BOOST_CMAKE=FALSE \ | ||
.. | ||
|
||
make -j$(nproc) install | ||
fi | ||
|
||
cd $BUILD_DIR |
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,63 @@ | ||
# Converting between SDF and USD | ||
|
||
This example shows how a world in a SDF file can be converted to [USD](https://graphics.pixar.com/usd/release/index.html). | ||
|
||
## Requirements | ||
|
||
You will need all of the dependencies for sdformat, along with the following additional dependencies: | ||
* USD: [installation instructions](https://github.com/PixarAnimationStudios/USD/blob/release/README.md#getting-and-building-the-code) | ||
* [ignition-common5](https://github.com/ignitionrobotics/ign-common) | ||
* [ignition-utils1 (including the CLI component)](https://github.com/ignitionrobotics/ign-utils) | ||
|
||
## Setup | ||
|
||
Build sdformat. The steps below follow a traditional cmake build, but sdformat | ||
can also be built with [colcon](https://colcon.readthedocs.io/en/released/index.html): | ||
```bash | ||
git clone https://github.com/ignitionrobotics/sdformat.git | ||
cd sdformat | ||
mkdir build | ||
cd build | ||
cmake .. | ||
make | ||
``` | ||
|
||
You should now have an executable named `sdf2usd` in the `sdformat/build/bin` directory. | ||
This executable can be used to convert a SDF world file to a USD file. | ||
To see how the executable works, run the following command from the `sdformat/build/bin` directory: | ||
```bash | ||
./sdf2usd -h | ||
``` | ||
|
||
To convert [shapes_world.sdf](https://github.com/ignitionrobotics/sdformat/blob/sdf12/test/sdf/shapes_world.sdf) to its USD representation as a file called `shapes.usd`, run the following commands: | ||
|
||
```bash | ||
wget https://raw.githubusercontent.com/ignitionrobotics/sdformat/sdf12/test/sdf/shapes_world.sdf | ||
./sdf2usd shapes_world.sdf shapes.usd | ||
``` | ||
|
||
You can now view the contents of the generated USD file with `usdcat` (this should have been installed when setting up the USD dependency): | ||
```bash | ||
usdcat shapes.usd | ||
``` | ||
|
||
To see the visual representation of the USD world, run `usdview` (this should have also been installed when setting up the USD dependency): | ||
```bash | ||
usdview shapes.usd | ||
``` | ||
|
||
### Note about building with colcon | ||
You may need to add the USD library path to your `LD_LIBRARY_PATH` environment variable after sourcing the colcon workspace. | ||
If the USD library path is not a part of `LD_LIBRARY_PATH`, you will probably see the following error when running the `sdf2usd` executable: | ||
```bash | ||
sdf2usd: error while loading shared libraries: libusd_usd.so: cannot open shared object file: No such file or directory | ||
``` | ||
The typical USD library path is `<usd_installation_path>/lib`. | ||
So, if you installed USD at `/usr/local/USD`, the following command on Linux properly updates the `LD_LIBRARY_PATH` environment variable: | ||
```bash | ||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/USD/lib | ||
``` | ||
Another thing to note if building with colcon is that after sourcing the workspace with sdformat, | ||
the `sdf2usd` executable can be run without having to go to the `sdformat/build/bin` directory. | ||
So, instead of going to that directory and running `./sdf2usd ...`, you should be able to run `sdf2usd ...` from anywhere. |
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
Oops, something went wrong.