diff --git a/.gitignore b/.gitignore index fb7dd6a..bc6397c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,60 @@ -_build -_compiler -cross_compile -__pycache__/ +# editor files +*.swp +/.vscode/ +*/.vs/ + +# generated files +_*/ +/packages/ +VERSION +version.rc +Version.h + +# byte-compiled python files +*.py[cod] + +# packman package files +*@*.7z +*@*.zip + +# user files +*.user +user.repo.toml + +# binaries +*.ico +*.bmp +*.png +*.gif +*.jpg +*.jpeg +*.tga +*.psd +*.raw +*.exr +*.hdr +*.dds +*.ktx +*.spv +*.dxbc +*.dxil +*.gltf +*.glb +*.fbx +*.usd +*.usda +*.usdz +*.obj +*.mat +/.lastformat + +# allow files in resources +!/resources/ +!/resources/* +!/resources/**/* + +# python logging file +pyLogging.log + +# packman packaging file +PACKAGE-DEPS.yaml diff --git a/CHANGELOG.md b/CHANGELOG.md index e69de29..a8f4ed2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -0,0 +1,380 @@ +205.0 +----- +Release: May 2024 + +Connect SDK 1.0.0 release + +* Samples + * These samples were changed to use Connect SDK functions to create consistent and correct USD and to use the SDK to interact with the Omniverse platform: + * HelloWorld + * LiveSession + * SimpleSensor + * The OmniUsdReader was renamed to UsdTraverse and now uses the Connect SDK and has a new "Getting Started" walkthrough in the SDK docs + * The build and runtime configuration was revamped to use the Connect SDK premake dependencies +* Omniverse Connect SDK + * [Version 1.0.0](https://docs.omniverse.nvidia.com/kit/docs/connect-sdk/1.0.0/index.html) +* Omniverse Carbonite SDK + * [167.3 Changes](https://docs.omniverse.nvidia.com/kit/docs/carbonite/167.3/CHANGES.html) +* Omniverse USD Resolver + * [1.42.3 Changes](https://docs.omniverse.nvidia.com/kit/docs/usd_resolver/1.42.3/docs/changes.html) +* Omniverse Client Library + * [2.47.1 Changes](https://docs.omniverse.nvidia.com/kit/docs/client_library/2.47.1/docs/changes.html) +* Omniverse Asset Validator + * [0.11.1 Changes](https://docs.omniverse.nvidia.com/kit/docs/asset-validator/0.11.1/source/extensions/omni.asset_validator.core/docs/CHANGELOG.html) +* Omniverse Transcoding + * [0.1.0 About](https://docs.omniverse.nvidia.com/kit/docs/omni-transcoding/0.1.0/index.html) + +204.2 +----- +Release: February 2024 + +Connect SDK Alpha 0.7.0 release + +* Samples + * Switch OpenUSD version to 23.11 + * Use the new OMNICONNECTCORE_INIT macro to initialize a Connector that uses OMNI logging [OM-119286] + * Prune xform and prim utilities from Samples [OM-109464] + * Use Connect SDK to define PBR materials and textures [OM-109462] +* Omniverse Connect SDK + * [Version 0.7.0](http://omniverse-docs.s3-website-us-east-1.amazonaws.com/connect-sdk/0.7.0/index.html) +* Omniverse Carbonite SDK + * [160.8 Changes](http://omniverse-docs.s3-website-us-east-1.amazonaws.com/carbonite/160.8/CHANGES.html) +* Omniverse USD Resolver + * [1.42.1 Changes](http://omniverse-docs.s3-website-us-east-1.amazonaws.com/usd_resolver/1.42.1/docs/changes.html) +* Omniverse Client Library + * [2.45.0 Changes](http://omniverse-docs.s3-website-us-east-1.amazonaws.com/client_library/2.45.0/docs/changes.html) +* Omniverse Asset Validator + * [0.11.0 Changes](http://omniverse-docs.s3-website-us-east-1.amazonaws.com/asset-validator/0.11.0/source/extensions/omni.asset_validator.core/docs/CHANGELOG.html) + +204.1 +----- +Release: December 2023 + +Connect SDK Alpha 0.6.0 release + +* Samples + * Switch OpenUSD version to 23.08 + * Add display name and valid prim name examples [OM-106962] + * Update live samples with the SDK's LiveSession interface [OM-62756] + * Use the SDK's defineXform function [OM-109461] + * Use the SDK's definePolyMesh function [OM-OM-109460] + * Add calls to the SDK's isUriWritable function [OM-109463] + * Add version resource information to the generated executable files on Windows [OM-108758] + * Import the SDK's connect-defaults.toml for common repo configuration [OM-113276] + * Adjust packaging by removing prebuild samples for distribution +* Connect SDK + * [Version 0.6.0](http://omniverse-docs.s3-website-us-east-1.amazonaws.com/connect-sdk/0.6.0/index.html) +* Omniverse USD Resolver + * [1.40.0 Changes](http://omniverse-docs.s3-website-us-east-1.amazonaws.com/usd_resolver/1.40.0/docs/changes.html) +* Omniverse Client Library + * [2.38.12 Changes](http://omniverse-docs.s3-website-us-east-1.amazonaws.com/client_library/2.38.12/docs/changes.html) +* Omniverse Asset Validator + * [0.10.1 Changes](http://omniverse-docs.s3-website-us-east-1.amazonaws.com/asset-validator/0.10.1/source/extensions/omni.asset_validator.core/docs/CHANGELOG.html) + +204.0 +----- +Release: September 2023 + +Connect SDK Alpha 0.5.0 release + +* Samples + * HelloWorld (c++) : Added an optional UI to select the export folder (enabled via --gui or -g) +* Connect SDK + * [Version 0.5.0](http://omniverse-docs.s3-website-us-east-1.amazonaws.com/connect-sdk/0.5.0/index.html) + +203.1 +----- +Released: November 2023 + +* Samples + * Add a Linux Makefile for OmniUsdReader + * Find a new prim to move when the prim being moved by 't' is no longer valid [OMFP-2976] + * Set the client retry count lower so accessing an invalid server returns faster [OMFP-2975] + * Modify the client connection status callback to handle the multiple possible successful enums + * Build the packaged binaries on Linux with an older version of GCC to support more versions [OMFP-2974] + * Add a check in HelloWorld to exit early if it can't find the "resources" folder [OMPM-913] + * Set the Visual Studio working directory debug settings from premake [OMPM-913] + * Print the live session options before asking for user input the first time [OMPM-913] + * Build both release and debug configs by default with `repo build`, `-r` or `-d` may be used to modify this [OMPM-913] + +* Omniverse USD Resolver + * [1.34.3 Changes](http://omniverse-docs.s3-website-us-east-1.amazonaws.com/usd_resolver/1.34.3/docs/changes.html) +* Omniverse Client Library + * [2.38.9 Changes](http://omniverse-docs.s3-website-us-east-1.amazonaws.com/client_library/2.38.9/docs/changes.html) +* Omniverse Asset Validator + * [0.8.1 Changes](http://omniverse-docs.s3-website-us-east-1.amazonaws.com/asset-validator/0.8.1/source/extensions/omni.asset_validator.core/docs/CHANGELOG.html) + + +203.0 +----- + +* Samples + * Update USD version to 22.11 + * Update Python version to 3.10 + * Add a skinned skeletal mesh example with live updates + * Fix 21.08 include guard for UsdPhysics + * Add channel join/send/leave commands to OmniCLI + * Use a mesh rather than a cube to test the invalid extents since a cube always returns an extents attribute + * Set the correct render type for the shader output attributes + * Use an installed OmniPBR rather than including a very old version +* Omniverse USD Resolver + * [1.27.0 Changes](http://omniverse-docs.s3-website-us-east-1.amazonaws.com/usd_resolver/1.27.0/docs/changes.html) +* Omniverse Client Library + * [2.32.0 Changes](http://omniverse-docs.s3-website-us-east-1.amazonaws.com/client_library/2.32.0/docs/changes.html) +* Omniverse Asset Validator + * [0.6.1 Changes](http://omniverse-docs.s3-website-us-east-1.amazonaws.com/asset-validator/0.6.1/source/extensions/omni.asset_validator.core/docs/CHANGELOG.html) + + +202.0 +----- + +* Samples + * Update the repo build tools to modern versions (OM-77486) + * Add a test script for all programs ("repo test" or tests/test_all.[bat,sh]) + * Allow Windows users to use their installed build tools with "repo build --use-devenv" (OM-74840) + * Change defaultPrim handling to be less hardcoded and more correct + * Add a function to determine if any prims exist in the root layer before merging (OM-64707) + * Add a note in README.md about Visual Studio failing to iterate on builds (OM-78756) + * Add a prop payload and reference to a HelloWorld (OM-35218) + * Modify an OmniPBR MDL parameter for a referenced prop + * Set the defaultPrim to kind=assembly, all others to kind=component + * Correctly set the USD Preview Surface bias, scale, and sourceColorSpace + * Correctly apply the MaterialBindingAPI to the box mesh prim + * Change OmniCLI to overwrite destination folders for copy and move (OM-80541) +* Omniverse USD Resolver + * [1.20.0 Changes](http://omniverse-docs.s3-website-us-east-1.amazonaws.com/usd_resolver/1.20.0/docs/changes.html) +* Omniverse Client Library + * [2.23.0 Changes](http://omniverse-docs.s3-website-us-east-1.amazonaws.com/client_library/2.23.0/docs/changes.html) +* Omniverse Asset Validator + * [0.2.2 Changes](http://omniverse-docs.s3-website-us-east-1.amazonaws.com/asset-validator/0.2.2/source/extensions/omni.asset_validator.core/docs/CHANGELOG.html) + + +201.0 +----- + +* Samples + * Added omni_asset_validator.bat|sh which uses the [Asset Validator](http://omniverse-docs.s3-website-us-east-1.amazonaws.com/asset-validator) to find issues in USD layer file URIs + * Added 'v' validate option for pyLiveSession to demonstrate the Asset Validator on an in-memory stage. + * Add a C++ UsdLuxLight compatibility class to help with schema and API upgrade issues (OM-71861) + * Rename `omniLiveSessionLib` to `omniUtilsLib`, move `cppUtils` to `omniUtilsLib/include` + * Adjust light values from the samples + * Cleanup the #includes in some files and remove some cruft from copy/paste + * Create extents attributes on all meshes in HelloWorld (so we don't fail the asset validation checks) + * Add example usage of TfMakeValidIdentifier() so prim names are valid (OM-66072) + * Modify the build config and source to support 2022-era USD versions (OM-53579) + * Don't throw an exception when the user name is not valid in the Python sample + * Update msvc (OM-42026) + * Prevent "Core::unregister callback called after shutdown" in samples by clearing the client log callback + * Report the update frequency and run duration in the simple sensor example + * Support reusing the live stage in the simple sensor example rather than deleting it every run + * Make the Materials parent prim a Scope + * Make Fieldstone.mdl use the OmniPBR.mdl that ships with the sample (OM-73976) + * Handle the 22.08 UsdGeomPrimvarsAPI changes +* Omniverse USD Resolver + * [1.18.0 Changes](http://omniverse-docs.s3-website-us-east-1.amazonaws.com/usd_resolver/1.18.0/docs/changes.html) +* Omniverse Client Library + * [2.21.0 Changes](http://omniverse-docs.s3-website-us-east-1.amazonaws.com/client_library/2.21.0/docs/changes.html) +* Omniverse Asset Validator + * [0.2.1 Changes](http://omniverse-docs.s3-website-us-east-1.amazonaws.com/asset-validator/0.2.1/source/extensions/omni.asset_validator.core/docs/CHANGELOG.html) + +200.1 +----- + +* Samples + * Fix the "MESSAGE" message type and custom "message" key to be case correct + * Ensure that we flush live layer clears with omniClientLiveProcess + * Fix the usd_resolver post build copy step in UsdReader example +* Omniverse USD Resolver + * [1.11.0 Changes](http://omniverse-docs.s3-website-us-east-1.amazonaws.com/usd_resolver/1.11.0/docs/changes.html) + +* Omniverse Client Library + * [2.15.0 Changes](http://omniverse-docs.s3-website-us-east-1.amazonaws.com/client_library/2.15.0/docs/changes.html) + + +200.0 +----- + +* Samples + * Modify live editing behavior to use a ".live" extension + * Add a text communication mode between clients using message channels in HelloWorld + * Added thorough C++ USD transform handling with the xformUtils namespace + * Change the default stage path from /localhost/Users/test to /localhost/Users/_connected_user_name (OM-53886) +* Omniverse USD Resolver + * [1.9.0 Changes](http://omniverse-docs.s3-website-us-east-1.amazonaws.com/usd_resolver/1.9.0/docs/changes.html) + +* Omniverse Client Library + * [2.13.0 Changes](http://omniverse-docs.s3-website-us-east-1.amazonaws.com/client_library/2.13.0/docs/changes.html) + +104.1 +----- + +* Samples + * Added thorough Python USD transform handling with the xform_utils.py module + * Added a better logging system in the Python hello world example + * Formatted the help text in OmniCLI to be spaced properly and to include arguments + * Added omniSimpleSensor, a simple example of simulating sensor data pushed into a USD + * Added omniSensorThread, this is the separate working thread to change a USD + * Added physics to HelloWorld sample to showcase UsdPhysics usage. + * Added the file hash to the stat output in OmniCLI + * Added "cver" command to print client version +* Omniverse Client Library + * 1.17.4 + * OM-47554: Downgrade some "Error" messages during auth to "Verbose" + * We attempt to connect using 3 different methods, and it's normal for 2 of them to fail. This avoids confusing users with error messages for a connection that ultimately succeeds. + * OM-48252: Lower required "list2" version, to allow connecting to servers running Nucleus 112.0. + * 1.17.3 + * CC-357: Fixed a deadlock that could occur when a python file status callback is being unregistered on one thread while another thread is simultaneously trying to call that file status callback + * CC-367: Allow stat & list using cloudfront.net URLs + * OM-45178: Print extended error message when Token.subscribe fails + * OM-45887: Enable extra connection logging + * CC-384: Remove support for Nucleus 107, 109, and 110 + * CC-366: Update OpenSSL to avoid a security vulnerability + * 1.17.2 + * CC-32: Fixed a crash that could happen on disconnect + * OM-43009: Removed "stop" from list of required capabilities, to discover newer servers which don't advertise that capability + * CC-236: Add support for checkpoint change notification + * CC-245: Fixed a deadlock that could occur rarely when connection failed. + * 1.17.1 + * CC-228: subscription based authentication using 'nonce' + * CC-231: Discover API server using minimum required capabilities rather than all capabilites + * CC-229: Fixed a case where the client library would not connect to Nucleus securely + * 1.17.0 + * CC-7: Add shutdown guard to omniclient::Core + + +103.2 +----- +* Samples + * Change the live rotations from ZYX to XYZ and all xform ops to double3 +* Omniverse Client Library + * 1.16.0 + * OM-39826: Prevent copying of channels from nucleus servers to other providers + * OM-38687: Fix crash when shutdown with an outstanding stat subscription + * OM-37095: Use omniClientWait in blocking python binding functions + * OM-38761: Fix ResolveSubscribe to handle more invalid search paths + * OM-39746: Support stat('/') on S3 buckets. S3 API does not support stat() on root, but we can fill in the gaps + * 1.15.0 + * OM-39614: Fixed a case where pings would not report a connection error + * OM-36524: update connection library to prevent using Nucleus Cache when accessing localhost servers + * OM-37061: Fix crash if a request is started after it is stopped + * OM-34916: Map MountExistsUnderPath error to ErrorNotSupported + * OM-38761: Fixed StatImpl::beginWatch to always call the provided callback, even when the uri to watch is invalid. + * OM-39367: Removed "fast locked updates" because it's fundamentally broken. + * Removes omniUsdLiveLock & omniUsdLiveUnlock + * OM-23042: If the relativePath starts with "./" then don't use search paths + * 1.14.0 + * OM-38721: Added function omniClientGetLocalFile which returns the local filename for a URL + * If the input URL is already a local file, it is returned without error + * If the remote file has not yet been downloaded to cache, it is downloaded before returning + * Python bindings are "get_local_file" "get_local_file_async" and "get_local_file_with_callback" + * OM-38816: Added environment variable OMNI_DEPLOYMENT which can override the deployment sent to discovery + * OM-37061: Early exit from callback if cacheEntry weak_ptr is expired, correct creation of cacheEntry ownership + * 1.13.25 + * OM-34145: Fix omniClientCopy to not infinitely copy when copying a directory into a subdirectory of itself. + * 1.13.24 + * OM-38028: Update Brotli, OpenSSL, and libcurl versions + * 1.13.23 + * OM-37701: Fix FetchToLocalResolvedPath to work with SdfFileFormat arguments + * 1.13.22 + * OM-37276: Use latest idl.cpp to pickup SSL cert directory location fixes + * 1.13.21 + * OM-36064 & OM-36306: Fix crash in listSubscribe on disconnect + * 1.13.20 + * OM-37054: Fix incorrect search order according to PBR specification + * OM-36511: Add python bindings set_authentication_message_box_callback & authentication_cancel + + +103.1 +----- +* Samples + * Added omniUsdReader, a very very simple program for build config demonstration that opens a stage and traverses it, printing all of the prims + * Added omniUsdaWatcher, a live USD watcher that outputs a constantly updating USDA file on disk + * Updated the nv-usd library to one with symbols so the Visual Studio Debug Visualizers work properly +* Omniverse Client Library + * Still using 1.13.19 + +102.1 +----- +* Samples + * OM-31648: Add a windows build tool configuration utility if the user wants to use an installed MSVC and the Windows SDK + * Add a dome light with texture to the stage + * OM-35991: Modify the MDL names and paths to reduce some code redundancy based on a forum post + * Add Nucleus checkpoints to the Python sample + * Avoid writing Nucleus checkpoints when live mode is enabled, this isn't supported properly + * OM-37005: Fix a bug in the Python sample batch file if the sample was installed in a path with spaces + * Make the /Root prim the `defaultPrim` + * Update Omniverse Client Library to 1.13.19 +* Omniverse Client Library + * 1.13.19 + * OM-36925: Fix omniClientMakeRelative("omni://host/path/", "omni://host/path/"); + * 1.13.18 + * OM-25931: Fixed some issues around changing and calling the log callback to reduce hangs. + * OM-36755: Fixed possible use-after-delete issue with set_log_callback (Python). + * 1.13.17 + * OM-34879: Hard-code "mdl" as "not a layer" to work around a problem that happens if the "usdMdl" plugin is loaded + * 1.13.16 + * OM-36756: Fix crash that could happen if two threads read a layer at the exact same time. + * 1.13.15 + * OM-35235: Fix various hangs by changing all bindings to release the GIL except in very specific cases. + * 1.13.14 + * OM-34879: Fix hang in some circumstances by delaying USD plugin registration until later + * OM-33732: Remove USD diagnostic delegate + * 1.13.13 + * OM-36256: Fixed S3 provider from generating a bad AWS signature when Omni Cache is enabled + * 1.13.12 + * OM-20572: Fixed setAcls + * 1.13.11 + * OM-35397: Fixed a bug that caused Linux's File Watcher Thread to peg the CPU in some cases. + * 1.13.10 + * OM-32244: Fixed a very rare crash that could occur when reading a local file that another process has locked + * 1.13.9 + * OM-35050: Fixed problem reloading a non-live layer after it's been modified. + * 1.13.8 + * OM-34739: Fix regression loading MDLs introduced in * 1.13.3 + * OM-33949: makeRelativeUrl prepends "./" to relative paths + * OM-34752: Make sure local paths are always using "" inside USD on Windows + * 1.13.7 + * OM-34696: Fixed bug when S3 + cloudfront + omni cache are all used + * 1.13.6 + * OM-33914: Fixed crash when accessing http provider from mulitple threads simultaneously + * 1.13.5 + * OM-26039: Fixed "Restoring checkpoint while USD stage is opened live wipes the content" + * OM-33753: Fixed "running massive amounts of live edits together causes massive amounts of checkpoints" + * OM-34432: Fixed "[Create] It will lose all data or hang Create in live session" + * These were all the same underlying issue: When a layer is overwritten in live mode it was cleared and set as 'dirty' which would cause the next "Save()" (which happens every frame in live mode) to save the cleared layer back to the Omniverse server. + * 1.13.4 + * OM-31830: omniClientCopy() with HTTP/S3 provider as source + * OM-33321: Use Omni Cache 2.4.1+ new reverse proxy feature for HTTPS caching + * 1.13.3 + * OM-33483: Don't crash when trying to save a layer that came from a mount + * OM-27233: Support loading non-USD files (abc, drc, etc) + * OM-4613 & OM-34150: Support saving usda files as ascii + * Note this change means live updates no longer work with usda files (though they technically never did -- it would silently convert them to usdc files). + +101.1 +----- +* Add Linux package for the Omniverse Launcher +* Add a python 3 Hello World sample +* Update the Omniverse Client Library to 1.13.2 +* Update to Python 3.7 +* Add a Nucleus Checkpoint example +* Add the ability to create/access a USD stage on local disk in the Hello World sample + +100.2 +----- +* Update the Omniverse Client Library fix an issue with overlapping file writes + +100.1 +----- +* First release +* HelloWorld sample that demonstrates how to: + * connect to an Omniverse server + * create a USD stage + * create a polygonal box and add it to the stage + * upload an MDL material and its textures to an Omniverse server + * bind an MDL and USD Preview Surface material to the box + * add a light to the stage + * move and rotate the box with live updates + * print verbose Omniverse logs + * open an existing stage and find a mesh to do live edits +* OmniCLI sample that exercises most of the Omniverse Client Library API diff --git a/CMakeLists.txt b/CMakeLists.txt index c55176c..20e0121 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,8 @@ cmake_minimum_required(VERSION 3.16) -project(ignition-omniverse1 NONE) +project(gazebo-omniverse1 NONE) # FIXME: This always builds debug mode add_custom_target(build ALL - ${CMAKE_CURRENT_SOURCE_DIR}/build.sh -d + ${CMAKE_CURRENT_SOURCE_DIR}/repo.sh build WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) diff --git a/PACKAGE-INFO.yaml b/PACKAGE-INFO.yaml index aeaf4ff..50af4b9 100644 --- a/PACKAGE-INFO.yaml +++ b/PACKAGE-INFO.yaml @@ -1,6 +1,6 @@ -Package : ignition-conection +Package : gazebo-conection Version : 000-linux-x86_64 Maintainers : N/A Description : N/A -Repository : https://github.com/ignitionrobotics/ign-omni +Repository : https://github.com/gazebosim/gz-omni Branch : main diff --git a/README.md b/README.md index 488a10a..24a6e8b 100644 --- a/README.md +++ b/README.md @@ -1,34 +1,299 @@ -# ign-omni - -![](./tutorials/hybrid_diagram.png) - -**NOTES**: - - This repository is under development, you might find compilation errors, -malfunctions or some undocumented features. - - This code will only run on Linux (for now). - - You should [install Ignition Fortress](https://ignitionrobotics.org/docs/fortress) (from source). - -**Requirements**: - - ROS 2 Galactic. - - Ignition Gazebo Fortress - - ubuntu 20.04 - -**Features**: - - Ignition -> IsaacSim - - Move/rotate models - - Create/remove models - - Joints - - Sensors (lidar, cameras) - - IsaacSim -> Ignition - - Create/remove models - -## Tutorials - - [How to compile it](tutorials/01_compile.md) - - [Quickstart](tutorials/02_quickstart.md) - - [Mobile base simulation (turtlebot3) (Nav2)](tutorials/03_ROS_simulation.md) - - [Articulated arm Isaac Sim -> Ignition (Moveit 2)](tutorials/04_articulated_arm_issacsim_to_ignition.md) - - [Hybrid simulation (Nav2)](tutorials/05_hybrid_simulation.md) - -## ROSCon 2022 - -[![](img/video_img.png)](https://vimeo.com/767140085) +# Connect Samples for the Omniverse Connect SDK + +These samples demonstrate some key concepts for writing Omniverse Connectors and Converters. The samples use the OpenUSD and [Omniverse Connect SDK](https://docs.omniverse.nvidia.com/kit/docs/connect-sdk) to demonstrate how to author consistent and correct USD: + +- [`Omni Asset Validator`](#omni-asset-validator) - A command line validation tool. +- [`Omni CLI`](#omni-cli) - A command line utility to manage files on a Nucleus server. +- [`HelloWorld (C++ and Python)`](#helloworld-c-and-python) - A sample program that shows how to connect to an Omniverse Nucleus server, create a USD stage, create a polygonal box, bind a material, add a light, save data to .usd file, create and edit a .live layer, and send/receive messages over a channel on Nucleus. This sample is provided in both C++ and Python to demonstrate the Omniverse APIs for each language. +- [`LiveSession (C++ and Python)`](#livesession-c-and-python) - A sample program that demonstrates how to create, join, merge, and participate in live sessions. This sample is provided in both C++ and Python to demonstrate the Omniverse APIs for each language. +- [`OmniUsdaWatcher (C++)`](#omniusdawatcher-c) - A live USD watcher that outputs a constantly updating USDA file on disk. +- [`OmniSimpleSensor (C++)`](#omnisimplesensor-c) - A C++ program that demonstrates how to connect external input (e.g sensor data) to a USD layer in Nucleus. + +## How to Build + +### Build and CI/CD Tools +The Samples repository uses the [Repo Tools Framework (`repo_man`)](https://docs.omniverse.nvidia.com/kit/docs/repo_man) to configure premake, packman, build and runtime dependencies, testing, formatting, and other tools. Packman is used as a dependency manager for packages like OpenUSD, the Omniverse Client Library, the Omniverse USD Resolver, the Omniverse Asset Validator, and other items. The Samples use the [Connect SDK's standard repoman and packman tooling](https://docs.omniverse.nvidia.com/kit/docs/connect-sdk/1.0.0/docs/details.html#repoman-and-packman) as templates for including and linking against USD, Omniverse Client, etc. These can serve as an example for the build and runtime configuration that a customer's application might require. Here's a list of interesting files: + +- [premake5.lua](./premake5.lua) - the build configuration file for the samples +- [prebuild.toml](./prebuild.toml) - consumed by the repo build tools to specify where runtime dependencies should be copied +- _build/target-deps/omni_connect_sdk/release/dev/tools/premake/connect-sdk-public.lua - the Connect SDK's build configuration template file for including USD, Omniverse Client, the Connect SDK itself, and other libraries. + - this file isn't available until dependencies are fetched +- [source/config/omni.connect.client.toml](./source/config/omni.connect.client.toml) - A configuration file for overriding settings for logging, crash reporting, etc. Details for how to configure this file are documented in the [Connect SDK's Core and Client Settings](https://docs.omniverse.nvidia.com/kit/docs/connect-sdk/1.0.0/docs/settings-config.html#core-and-client-settings). + +For details on choosing and installing Connect SDK build flavors, features, or versions, see the [install_sdk](https://docs.omniverse.nvidia.com/kit/docs/connect-sdk/1.0.0/docs/devtools.html#repo-install-sdk) tool documentation. + +### Linux +This project requires "make" and "g++". + +- Open a terminal. +- To obtain "make" type `sudo apt install make` (Ubuntu/Debian), or `yum install make` (CentOS/RHEL). +- For "g++" type `sudo apt install g++` (Ubuntu/Debian), or `yum install gcc-c++` (CentOS/RHEL). + +Use the provided build script to download all other dependencies (e.g USD), create the Makefiles, and compile the code. + +```bash +./repo.sh build +``` + +Use any of the `run_*.sh` scripts (e.g. `./run_hello_world.sh`) to execute each program with a pre-configured environment. + +> Tip: If you prefer to manage the environment yourself, add `/_build/linux64-x86_64/release` to your `LD_LIBRARY_PATH`. + +For commandline argument help, use `--help` +```bash +./run_hello_world.sh --help +``` + +### Windows +#### Building +Use the provided build script to download all dependencies (e.g USD), create the projects, and compile the code. +```bash +.\repo.bat build +``` + +Use any of the `run_*.bat` scripts (e.g. `.\run_hello_world.bat`) to execute each program with a pre-configured environment. + +For commandline argument help, use `--help` +```bash +.\run_hello_world.bat --help +``` + +#### Building within the Visual Studio IDE + +To build within the VS IDE, open `_compiler\vs2019\Samples.sln` in Visual Studio 2019. The sample C++ code can then be tweaked, debugged, rebuilt, etc. from there. + +> Note : If the Launcher installs the Connect Samples into the `%LOCALAPPDATA%` folder, Visual Studio will not "Build" properly when changes are made because there is something wrong with picking up source changes. Do one of these things to address the issue: +> - `Rebuild` the project with every source change rather than `Build` +> - Copy the Connect Samples folder into another folder outside of `%LOCALAPPDATA%` +> - Make a junction to a folder outside of %LOCALAPPDATA% and open the solution from there: +> - `mklink /J C:\connect-samples %LOCALAPPDATA%\ov\pkg\connectsample-202.0.0` + +#### Changing the MSVC Compiler [Advanced] + +When `repo.bat build` is run, a version of the Microsoft Visual Studio Compiler and the Windows 10 SDK are downloaded and referenced by the generated Visual Studio projects. If a user wants the projects to use an installed version of Visual Studio 2019 then run `repo.bat build --use-devenv`. Note, the build scripts are configured to tell `premake` to generate VS 2019 project files. Some plumbing is required to support other Visual Studio versions. + + +## Using the Connect SDK in an Application + +See the [Connect SDK Getting Started docs](https://docs.omniverse.nvidia.com/kit/docs/connect-sdk/1.0.0/docs/getting-started.html#integrate-connect-sdk-and-build-a-connector) for a walkthrough of how use the Connect SDK and Open USD in your application. + +## Sample Details + +The samples listed are focused on these key concepts: +- Omniverse + - Asset Validator + - Carbonite + - Connect SDK + - Initialization + - Live Session Workflow + - Logging + - Client Library + - USD Resolver Plugin +- OpenUSD + - USD Cameras + - USD Display Names + - USD Lights + - USD Materials + - USD Meshes + - USD Prim Names + - USD Primvars + - USD Stages + - USD Xforms + +### Omni Asset Validator +A command line USD validation tool (`omni_asset_validator.bat|sh`). + +The Omniverse Asset Validator is a Python framework to provide `Usd.Stage` validation based on the [USD ComplianceChecker](https://github.com/PixarAnimationStudios/OpenUSD/blob/release/pxr/usd/usdUtils/complianceChecker.py) (i.e. the same backend as the usdchecker commandline tool), with an aim to validate assets against Omniverse specific rules to ensure they run smoothly across all Omniverse products. + +[Complete Asset Validator Documentation](https://docs.omniverse.nvidia.com/kit/docs/asset-validator/latest/index.html) + +To get the supported command line arguments, run omni_asset_validator.bat|sh --help. For example, the `--fix` flag will automatically apply fixes to a stage if possible (not all validation failures are automatically repairable): + +```bash +omni_asset_validator.bat|sh --fix omniverse://localhost/Users/test/helloworld.usd +``` + +The asset validator may also be run against stages in-memory. This is demonstrated in the Python version of the LiveSession example with the v option. + +### Omni CLI +A command line utility to manage files on a Nucleus Server (`omnicli.bat|sh`). + +This program was initially created to exercise most of the Omniverse Client Library API, but has grown to be a useful utility to interact with Nucleus servers. Typing `help` will produce a menu that shows the many functions available. Among the most useful are the move/copy functions which can transfer data to and from servers. + +### HelloWorld (C++ and Python) +A sample program that creates a USD stage on a Nucleus server (`run_hello_world.bat|sh` or `run_py_hello_world.bat|sh`). + +The sample demonstrates how to: + +- Initialize the Connect SDK Core +- Connect to a Nucleus server - by default a [`localhost Nucleus Workstation`](https://docs.omniverse.nvidia.com/nucleus/latest/workstation/installation.html) +- Create a USD stage +- Create a physics scene to define simulation parameters +- Create a polygonal box and add it to the stage and make it a dynamic rigid +- Create a cube and add it to the stage and make it a dynamic rigid +- Create a quad and add it to the stage and make it a collider +- Upload an MDL material and its textures to an Omniverse server +- Create and bind a MDL and USD Preview Surface materials to the box +- Add a distant and dome light to the stage +- Add a skinned skeletal mesh quad +- Add a folder in Nucleus - An empty folder will be generated when first creating the `HelloWorld.usd`. +- Create Nucleus checkpoints +- Move and rotate the box with live updates +- Tweak skeletal mesh animation data with live updates +- Print verbose Omniverse logs +- Open an existing stage and find a mesh to do live edits +- Send and receive messages over a channel on an Omniverse server + +### LiveSession (C++ and Python) +A sample program that demonstrates how to create, join, merge, and participate in live sessions (`run_live_session.bat|sh` or `run_py_live_session.bat|sh`). + +A .live layer is used in the stage's session layer to contain the changes. An Omniverse channel is used to broadcast users and merge notifications to all clients, and a session config (TOML) file is used to determine the "owner" of the session. + +The sample demonstrates how to: + +- Initialize the Omniverse Resolver Plugin +- Display existing live sessions for a stage +- Connect to a live session +- Make xform changes to a mesh prim in the .live layer +- Rename a prim in the .live layer +- Display the owner of the live session +- Display the current connected users/peers in the session +- Emit a GetUsers message to the session channel +- Display the contents of the session config +- Validate a stage using the Omniverse Asset Validator (Python example only) +- Merge the changes from the .live session back to the root stage +- Respond (by exiting) when another user merges session changes back to the root stage + +### OmniUSDAWatcher (C++) +The Omniverse USDA Watcher is a command line program that keeps an updated USDA file on local disk that maps to a Live USD layer (.live) resident on a Nucleus server (`run_omniUsdaWatcher.bat|sh`). + +It takes two arguments, the USD layer to watch and the output USDA layer: + +- Acceptable forms: + - URL: `omniverse://localhost/Users/test/helloworld.live` + - URL: `C:\USD\helloworld.usda` + - A local file path using shell variables: `~\helloworld.usda` + - A relative path based on the CWD of the program: `helloworld.usda` + +Note: Since the version 200.0 releases of the Connect Sample (Client Library 2.x) only `.live` layers synchronize through Nucleus. This tool will export any supported USD file format as USDA, but if you intend to watch live file edits it must be a `.live` layer. For more information on where to find the `root.live` layer for Live Sessions, see the [Connect SDK Live Session Configuration File Utilities](https://docs.omniverse.nvidia.com/kit/docs/connect-sdk/1.0.0/api/group__livesessions.html#group__livesessions_1autotoc_md4). + +The "watcher" demonstrates how to: + +- Initialize Omniverse + - Set the Omniverse Client log callback (using a lambda) + - Set the Omniverse Client log level + - Initialize the Omniverse Client library + - Register a connection status callback +- Open the USD stage +- Create and register the Sdf layer reload, layer change, and USD notice listeners +- Subscribe to file changes with omniClientStatSubscribe +- Start a thread that loops, receiving live changes from other clients (if the specified layer is a ``.live`` layer) + - When the stage is modified it's written out to the specified USDA +- The main thread loops on keyboard input, waiting for a 'q' or ESC +- Cleanup the callbacks (unsubscribe and revoke) +- Destroy the stage object +- Shutdown the Omniverse Client library + +For example, to monitor the stage that the HelloWorld sample creates by default in "live" mode: + +```bash +run_omniUsdaWatcher.bat|sh omniverse://localhost/Users/test/helloworld.live C:\USD\helloworld.usda +``` + +### OmniSimpleSensor (C++) +The Omniverse Simple Sensor example demonstrates how to connect external input (e.g sensor data) to a USD layer in Nucleus(`run_omniSimpleSensor.bat|sh`). + +This could effectively be a large number of inputs that report current values for IoT sensors or could be locations from robots and a real-time synchronization of the data in the virtual world is desired. + +It takes three arguments, the Nucleus server path, the number of inputs and a timeout value. + +```bash +run_omniSimpleSensor.bat|sh +``` + +- Acceptable forms + - Server Path: `omniverse://localhost/Users/test` (a location on a Nucleus server) + - Number of Inputs: `4` (integer value of 1 to any number) + - Timeout: `-1 or 20` (-1 is for infinity to run until killed, otherwise a number in seconds) + +For example, `run_omniSimpleSensor.bat omniverse://localhost/Users/test 27 -1` + +There are two parts to this project. + +**OmniSimpleSensor** will build a USD with a number of boxes (meshes) on one layer. + +- Initialize Omniverse +- Check for an existing `SimpleSensorExample.live` stage at the `` location, if it does not exist, create it +- Edit `SimpleSensorExample.live` at `` +- Build a simple array of box meshes, starting with /World/Box_0 then /World/Box_1 and so on +- Save the Live layer +- Destroy the stage object +- Shutdown the Omniverse Client library + +**OmniSensorThread** is then started for each 'input' specified in the command line. + +- Initialize Omniverse +- Open `SimpleSensorExample.live` at `` +- Find the box mesh in USD this process will change +- Create a worker thread to update the box's color every 300ms +- In the main loop, wait until the timeout occurs, then + - Stop the worker thread + - Destroy the stage object + - Shutdown the Omniverse Client library + +For example, if 6 inputs are specified then there will be 6 OmniSensorThread processes running, independently of each other. The OmniSensorThread will launch a thread that will update the color of its assigned box at a given frequency (300ms in the code, but this can be altered). When opening the `SimpleSensorExample.live` stage in USD Composer the boxes will change colors at regular intervals. + +This project can easily be extended to change the transform of the boxes or to add some metadata with a custom string attached to the USD or do change visibility states. + +Some things to note here: + +- Using separate processes for each input allows the USD to be changed independently +- This example could be re-written to have one main process with many worker threads launched for each input. In this case there would need to be a mutex when writing data to same live layer. This will ensure that the writing to USD via the Omniverse Client Library resource is dedicated. Wrapping the mutex around the smallest bit of code writing to USD is recommended in this case to prevent thread starvation (especially when the frequency of input is high). +- Reading USD via Omniverse Client Library does not have this issue and multiple threads in the same process can read from a USD, even the same layer in USD, without a mutex. + +## Issues with Self-Signed Certs +If the scripts from the Connect Sample fail due to self-signed cert issues, a possible workaround would be to do this: + +Install python-certifi-win32 which allows the windows certificate store to be used for TLS/SSL requests: + +```bash +tools\packman\python.bat -m pip install python-certifi-win32 --trusted-host pypi.org --trusted-host files.pythonhosted.org +``` + +## External Support + +First search the existing [GitHub Issues](https://github.com/NVIDIA-Omniverse/connect-samples/issues) and the [Connect Samples Forum](https://forums.developer.nvidia.com/c/omniverse/connectors/sample) to see if anyone has reported something similar. + +If not, create a new [GitHub Issue](https://github.com/NVIDIA-Omniverse/connect-samples/issues/new) or forum topic explaining your bug or feature request. + +- For bugs, please provide clear steps to reproduce the issue, including example failure data as needed. +- For features, please provide user stories and persona details (i.e. who does this feature help and how does it help them). + +Whether adding details to an existing issue or creating a new one, please let us know what companies are impacted. + + +## Licenses + +The license for the samples is located in [LICENSE.md](./LICENSE.md). + +Third party license notices for dependencies used by the samples are located in the [Connect SDK License Notices](https://docs.omniverse.nvidia.com/kit/docs/connect-sdk/1.0.0/docs/licenses.html). + +## Documentation and learning resources for USD and Omniverse + +[OpenUSD Docs - Creating Your First USD Stage](https://openusd.org/docs/Hello-World---Creating-Your-First-USD-Stage.html) + +[OpenUSD API Docs](https://openusd.org/docs/api/index.html) + +[OpenUSD User Docs](https://openusd.org/release/index.html) + +[OpenUSD Tutorials and Examples](https://github.com/NVIDIA-Omniverse/USD-Tutorials-And-Examples) + +[OpenUSD Code Samples](https://github.com/NVIDIA-Omniverse/OpenUSD-Code-Samples) + +[NVIDIA OpenUSD Docs](https://developer.nvidia.com/usd) + +[Omniverse Connect SDK Docs](https://docs.omniverse.nvidia.com/kit/docs/connect-sdk) + +[Omniverse Client Library Docs](https://docs.omniverse.nvidia.com/kit/docs/client_library) + +[Omniverse USD Resolver Docs](https://docs.omniverse.nvidia.com/kit/docs/usd_resolver) diff --git a/build.sh b/build.sh index 0389407..8d7962c 100755 --- a/build.sh +++ b/build.sh @@ -2,39 +2,6 @@ set -e -rebuild () { - "$SCRIPT_DIR/tools/packman/python.sh" "$SCRIPT_DIR/tools/repoman/clean.py" $@ || exit 1 -} - -clean () { - "$SCRIPT_DIR/tools/packman/python.sh" "$SCRIPT_DIR/tools/repoman/clean.py" - exit $? -} - SCRIPT_DIR=$(dirname ${BASH_SOURCE}) -POSITIONAL=() -while [[ $# -gt 0 ]] -do - case $1 in - -c|--clean) - clean - ;; - -x|--rebuild) - rebuild - shift - ;; - *) - POSITIONAL+=("$1") - shift - ;; - esac -done - -set -- "${POSITIONAL[@]}" # restore positional parameters - - -./prebuild.sh "$@" || exit $? - -ARGS_FLATTENED="$@" -source "$SCRIPT_DIR/tools/packman/python.sh" "$SCRIPT_DIR/tools/repoman/build.py" $ARGS_FLATTENED || exit $? +"$SCRIPT_DIR/tools/packman/python.sh" "$SCRIPT_DIR/tools/repoman/repoman.py" build "$@" || exit $? diff --git a/colcon.pkg b/colcon.pkg index ded2967..578d501 100644 --- a/colcon.pkg +++ b/colcon.pkg @@ -1,7 +1,7 @@ -name: ignition-omniverse1 +name: gazebo-omniverse1 type: cmake dependencies: - - ignition-common4 - - ignition-msgs8 - - ignition-transport11 - - sdformat12 + - gazebo-common5 + - gazebo-msgs10 + - gazebo-transport13 + - sdformat14 diff --git a/deps/connect-sdk-deps.packman.xml b/deps/connect-sdk-deps.packman.xml new file mode 100644 index 0000000..7875b42 --- /dev/null +++ b/deps/connect-sdk-deps.packman.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/deps/host-deps.packman.xml b/deps/host-deps.packman.xml index cd43b8f..004404e 100644 --- a/deps/host-deps.packman.xml +++ b/deps/host-deps.packman.xml @@ -1,69 +1,16 @@ - - - - - + + + - + - - - - - + - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/deps/repo-deps.packman.xml b/deps/repo-deps.packman.xml new file mode 100644 index 0000000..6edf267 --- /dev/null +++ b/deps/repo-deps.packman.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/deps/target-deps.packman.xml b/deps/target-deps.packman.xml index 9c756bb..09145cb 100644 --- a/deps/target-deps.packman.xml +++ b/deps/target-deps.packman.xml @@ -1,27 +1,10 @@ - - - - - - - - - - - - - - - - - - + + - - - + + diff --git a/launcher.toml b/launcher.toml index 9bb6c82..372a282 100644 --- a/launcher.toml +++ b/launcher.toml @@ -1,10 +1,10 @@ #displayed application name -name = "Ignition Omni Connector" +name = "Gazebo Omni Connector" #displayed before application name in launcher productArea = "Omniverse" #unique identifier for component, all lower case, persists between versions -slug = "ignitionomni" +slug = "gzomni" ## install and launch instructions by environment # Windows diff --git a/prebuild.sh b/prebuild.sh deleted file mode 100755 index f510ff0..0000000 --- a/prebuild.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -set -e - -SCRIPT_DIR=$(dirname ${BASH_SOURCE}) - -# inject "-p linux-x86_64" as the default if no target platform is specified -for i in "$@" -do - case $i in - -p=*|--platform-target=*|-p|--platform-target) - PLATFORM_TARGET_SET=1 - ;; - esac -done - -ARGS_ARRAY=("$@") -if [ -z "$PLATFORM_TARGET_SET" ]; then - ARGS_ARRAY+=("-p linux-x86_64") -fi - -ARGS_ARRAY_FLATTENED="${ARGS_ARRAY[@]}" -source "$SCRIPT_DIR/tools/packman/python.sh" "$SCRIPT_DIR/tools/repoman/build.py" --generateprojects-only ${ARGS_ARRAY_FLATTENED[@]} || exit $? -source "$SCRIPT_DIR/tools/packman/python.sh" "$SCRIPT_DIR/tools/repoman/filecopy.py" ${ARGS_ARRAY_FLATTENED[@]} "$SCRIPT_DIR/tools/buildscripts/pre_build_copies.json" || exit $? diff --git a/prebuild.toml b/prebuild.toml new file mode 100644 index 0000000..55260a5 --- /dev/null +++ b/prebuild.toml @@ -0,0 +1,91 @@ +######################################################################################################################## +# Memo: +######################################################################################################################## + +# This file is used to configure files/folders to copy and folder links to create (before running premake). + +# Mappings ($ string substitutions). Name and examples: +# |========================================================== +# | $platform | 'windows-x86_64' | 'linux-x86_64' | +# |---------------------------------------------------------- +# | $lib_ext | '.dll' | '.so' | +# | $lib_prefix | '' | 'lib.' | +# | $bindings_ext | '.pyd' | '.so' | +# | $exe_ext | '.exe' | '' | +# | $shell_ext | '.bat' | '.sh' | +# |========================================================== +# +# |========================================================== +# | $config | 'debug' | 'release' | +# |========================================================== + +# Filters. For example, debug config on linux-x86_64 matches all those toml keys: +# [linux-x86_64] +# [debug] +# [linux.debug] +# So you can use those in any order as a keys: ["linux-x86_64", "debug", "linux", "x86_64"] + + +######################################################################################################################## +# NOTE: +# This file is almost empty, we prefer to use the second one: _build/generated/prebuild.toml. It is generated by premake +# configurations. That allows to keep all copy and link configuration together with other project data. +######################################################################################################################## + + +######################################################################################################################## +# Common section: +######################################################################################################################## + +copy = [ + ["_build/intermediate/sdk-runtime/$config/config", "_build/$platform/$config/config"], + ["_build/intermediate/sdk-runtime/$config/plugins", "_build/$platform/$config/plugins"], + ["_build/intermediate/sdk-runtime/$config/python", "_build/$platform/$config/python"], + ["_build/intermediate/sdk-runtime/$config/lib/**", "_build/$platform/$config"], # remap libs & usd plugins to root of build + + # extras not installed by connect-sdk installer + ["_build/target-deps/usd/$config/bin/${lib_prefix}MaterialXCore*${lib_ext}*", "_build/$platform/$config"], + ["_build/target-deps/usd/$config/lib/${lib_prefix}MaterialXCore*${lib_ext}*", "_build/$platform/$config"], + ["_build/target-deps/usd/$config/bin/${lib_prefix}MaterialXFormat*${lib_ext}*", "_build/$platform/$config"], + ["_build/target-deps/usd/$config/lib/${lib_prefix}MaterialXFormat*${lib_ext}*", "_build/$platform/$config"], + ["_build/target-deps/usd/$config/lib/${lib_prefix}*usdHydra${lib_ext}", "_build/$platform/$config"], + ["_build/target-deps/usd/$config/lib/${lib_prefix}*usdMtlx${lib_ext}", "_build/$platform/$config"], + ["_build/target-deps/usd/$config/lib/${lib_prefix}*usdPhysics${lib_ext}", "_build/$platform/$config"], + ["_build/target-deps/usd/$config/lib/${lib_prefix}*usdSkel${lib_ext}", "_build/$platform/$config"], + ["_build/target-deps/usd/$config/lib/${lib_prefix}*usdUI${lib_ext}", "_build/$platform/$config"], + ["_build/target-deps/usd/$config/lib/python/pxr/UsdHydra", "_build/$platform/$config/python/pxr/UsdHydra"], + ["_build/target-deps/usd/$config/lib/python/pxr/UsdMtlx", "_build/$platform/$config/python/pxr/UsdMtlx"], + ["_build/target-deps/usd/$config/lib/python/pxr/UsdPhysics", "_build/$platform/$config/python/pxr/UsdPhysics"], + ["_build/target-deps/usd/$config/lib/python/pxr/UsdSkel", "_build/$platform/$config/python/pxr/UsdSkel"], + ["_build/target-deps/usd/$config/lib/python/pxr/UsdUI", "_build/$platform/$config/python/pxr/UsdUI"], + + ["_build/target-deps/omni_transcoding/$config/python", "_build/$platform/$config/python"], + + ["_build/target-deps/omni_asset_validator/$config/**/*.*", "_build/$platform/$config"], + # used only when source linking for local development of asset validator + ["_build/target-deps/omni_asset_validator/omni", "_build/$platform/$config/python/omni"], + ["_build/target-deps/omni_asset_validator/pip_prebundle/**/*.*", "_build/$platform/$config/python"], + ["_build/target-deps/omni_asset_validator/scripts", "_build/$platform/$config/scripts"], +] +link = [ + ["_build/target-deps/python", "_build/$platform/$config/python-runtime"], +] + +######################################################################################################################## +# Windows platform: +######################################################################################################################## + +[windows-x86_64] +copy = [ + ["_build/host-deps/vc/bin/HostX64/x64/vcruntime*.*", "_build/$platform/release"], +] +link = [] + + +######################################################################################################################## +# Linux x86_64 platform: +######################################################################################################################## + +[linux-x86_64] +copy = [] +link = [] diff --git a/premake5.lua b/premake5.lua old mode 100755 new mode 100644 index a9084a5..2f1fc5b --- a/premake5.lua +++ b/premake5.lua @@ -1,92 +1,53 @@ -newoption { - trigger = "platform-host", - description = "(Optional) Specify host platform for cross-compilation" -} - --- remove /JMC parameter for visual studio -require('vstudio') -premake.override(premake.vstudio.vc2010.elements, "clCompile", function(oldfn, cfg) - local calls = oldfn(cfg) - table.insert(calls, function(cfg) - premake.vstudio.vc2010.element("SupportJustMyCode", nil, "false") - end) - return calls -end) - -function dofile_arg(filename, ...) - local f = assert(loadfile(filename)) - return f(...) -end +-- Shared build scripts from repo_build package +repo_build = require("omni/repo/build") +repo_build.root = os.getcwd() --- Wrapper funcion around path.getabsolute() which makes drive letter lowercase on windows. --- Otherwise drive letter can alter the case depending on environment and cause solution to reload. -function get_abs_path(p) - p = path.getabsolute(p) - if os.target() == "windows" then - p = p:gsub("^%a:", function(c) return c:lower() end) - end - return p -end +-- Shared build scripts for use in client Connectors +connect_build = require(path.replaceextension(os.matchfiles("_build/target-deps/omni_connect_sdk/*/dev/tools/premake/connect-sdk-public.lua")[1], "")) -function copy_to_targetdir(filePath) - local filePathAbs = get_abs_path(filePath) - postbuildcommands {"{COPY} " .. filePathAbs .. " %{cfg.targetdir}/"} -end - -function get_prebuild_files() - return { os.matchfiles("premake5.lua"), os.matchfiles("deps/*"), os.matchfiles("tools/buildscripts/*.*") } -end - -function split(instr, sep) - local substrings = {}; i = 1 - for str in string.gmatch(instr, "([^"..sep.."]+)") do - substrings[i] = str - i = i + 1 - end - return substrings -end - -local hostDepsDir = "_build/host-deps" local targetDepsDir = "_build/target-deps" -local currentAbsPath = get_abs_path("."); --- premake5.lua -workspace "ignition-omniverse1" +workspace "Samples" + connect_build.setup_workspace({ + msvc_version = "14.29.30133", + winsdk_version = "10.0.18362.0", + }) + + -- override some connect_build settings + -- install exeutables and libraries in the main target_build_dir + target_bin_dir = target_build_dir + target_lib_dir = target_build_dir configurations { "debug", "release" } platforms { "x86_64" } architecture "x86_64" - local targetName = _ACTION - local workspaceDir = "_compiler/"..targetName - -- common dir name to store platform specific files local platform = "%{cfg.system}-%{cfg.platform}" - local targetDependencyPlatform = "%{cfg.system}-%{cfg.platform}"; - local hostDependencyPlatform = _OPTIONS["platform-host"] or targetDependencyPlatform; + local targetName = _ACTION + local workspaceDir = "_compiler/"..targetName - --local externalsDir = targetDepsDir.."" - local targetDir = "_build/"..platform.."/%{cfg.buildcfg}" + local gazeboInstallDir = "../../install" - -- ignition deps - local ignitionInstallDir = "../../install" + print('gazeboInstallDir', gazeboInstallDir) + local targetDir = "_build/"..platform.."/%{cfg.buildcfg}" -- adding dependencies filter { "system:linux" } linkoptions { '-Wl,--disable-new-dtags -Wl,-rpath,../../../_build/target-deps/nv_usd/%{cfg.buildcfg}/lib:../../../_build/target-deps/omni_client_library/%{cfg.buildcfg}:../../../_build/target-deps/python/lib:' } includedirs { targetDepsDir.."/nv_usd/%{cfg.buildcfg}/include", targetDepsDir.."/omni_client_library/include", targetDepsDir.."/python/include/python3.7m", - ignitionInstallDir.."/include", - ignitionInstallDir.."/include/ignition/math6", - ignitionInstallDir.."/include/ignition/utils1", - ignitionInstallDir.."/include/ignition/transport11", - ignitionInstallDir.."/include/ignition/msgs8", - ignitionInstallDir.."/include/ignition/cmake2", - ignitionInstallDir.."/include/ignition/common4", - ignitionInstallDir.."/include/ignition/sdformat12" } + gazeboInstallDir.."/include", + gazeboInstallDir.."/include/gz/math7", + gazeboInstallDir.."/include/gz/utils2", + gazeboInstallDir.."/include/gz/transport13", + gazeboInstallDir.."/include/gz/msgs10", + gazeboInstallDir.."/include/gz/cmake3", + gazeboInstallDir.."/include/gz/common5", + gazeboInstallDir.."/include/gz/sdformat14" } libdirs { targetDepsDir.."/nv_usd/%{cfg.buildcfg}/lib", targetDepsDir.."/omni_client_library/%{cfg.buildcfg}", targetDepsDir.."/python/lib", - ignitionInstallDir.."/lib" } + gazeboInstallDir.."/lib" } filter { "configurations:debug" } defines { "DEBUG", "NOMINMAX" } optimize "Off" @@ -109,7 +70,7 @@ workspace "ignition-omniverse1" cppdialect "C++17" filter { "system:linux" } - buildoptions {"-D_GLIBCXX_USE_CXX11_ABI=0 -Wno-deprecated-declarations -Wno-deprecated -Wno-unused-variable -pthread -lstdc++fs"} + buildoptions {"-D_MSC_VER=0 -D_GLIBCXX_USE_CXX11_ABI=0 -Wno-deprecated-declarations -Wno-deprecated -Wno-unused-variable -pthread -lstdc++fs"} filter {} @@ -120,16 +81,45 @@ function sample(projectName, sourceFolder) intrinsics "off" inlining "Explicit" flags { "NoManifest", "NoIncrementalLink", "NoPCH" } + + includedirs { "source/common/include" } + + -- setup all paths, links, and carb dependencies to enable omni_connect_core + connect_build.use_omni_client() + connect_build.use_omni_resolver() + connect_build.use_usd({ + "arch", + "gf", + "kind", + "pcp", + "plug", + "sdf", + "tf", + "usd", + "usdGeom", + "usdLux", + "usdPhysics", + "usdShade", + "usdSkel", + "usdUtils", + "vt", + }) + connect_build.use_connect_core() filter { "system:linux" } links { "ar","arch","gf","js","kind","pcp","plug","sdf","tf","trace","usd","usdGeom", "vt","work","usdShade","usdLux","omniclient","python3.7m","boost_python37", "pthread", "stdc++fs", - "ignition-math6", "ignition-utils1", "ignition-common4", "ignition-common4-graphics", "ignition-transport11", "ignition-msgs8", "protobuf", "protoc", "sdformat12" } + "gz-math7", "gz-utils2", "gz-common5", "gz-common5-graphics", "gz-transport13", "gz-msgs10", "protobuf", "protoc", "sdformat14" } filter {} location (workspaceDir.."/%{prj.name}") files { "source/"..sourceFolder.."/**.*" } filter { "system:windows" } links { "shlwapi" } filter {} + + connect_build.executable({ + name = projectName, + sources = { "source/"..sourceFolder.."/**.*" }, + }) end -sample("ignition-omniverse1", "ignition_live") +sample("gazebo-omniverse1", "gazebo_live") diff --git a/repo.sh b/repo.sh new file mode 100755 index 0000000..39abe97 --- /dev/null +++ b/repo.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +set -e + +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +cd "$SCRIPT_DIR" + +# Set OMNI_REPO_ROOT early so `repo` bootstrapping can target the repository +# root when writing out Python dependencies. +export OMNI_REPO_ROOT="$( pwd -P )" + +exec "tools/packman/python.sh" tools/repoman/repoman.py "$@" diff --git a/repo.toml b/repo.toml new file mode 100644 index 0000000..b3f4916 --- /dev/null +++ b/repo.toml @@ -0,0 +1,86 @@ +[repo] +name = "connect-sample" +import_optional_configs = [ + "_build/target-deps/omni_connect_sdk/debug/dev/tools/repoman/connect-defaults.toml", + "_build/target-deps/omni_connect_sdk/release/dev/tools/repoman/connect-defaults.toml" +] + +[repo.folders] +version_file = "CHANGELOG.md" + +[repo_install_sdk] +enabled = true +usd = "pxr-23_11" +python = "310" +nucleus = "on" + +[repo_build] + +# add Connect SDK deps +fetch.packman_target_files_to_pull."++" = [ + "${root}/deps/connect-sdk-deps.packman.xml", # Most Connectors should define this file +] + +default_build_config = ["debug", "release"] + +# pre_build.commands happens after project generation, this is too late +fetch.after_pull_commands = [ + ["${root}/repo${shell_ext}", "version_header"], + # stages the sdk-runtime for the prebuild step + [ + "$root/repo${shell_ext}", + "install_sdk", + "-c", "$config", + "--staging-dir", "_build", + "--install-dir", "_build/intermediate/sdk-runtime/$config", + ], +] + +msbuild.sln_file = "Samples.sln" +msbuild.vs_version = 'vs2019' +docker.enabled = false +telemetry.enabled = false + +fetch.generated_packman_file = "${root}/_build/${platform}/${config}/dev/deps/all-deps.packman.xml" + +post_build.commands = [ + ["$root/repo${shell_ext}", "connect_client_config", "-c", "$config"], +] + +[repo_connect_client_config] +enabled = true +app_version = "$root/CHANGELOG.md" + +[repo_version_header] +enabled = true +component = "Connect Samples" +namespace = "OMNICONNECTSAMPLES" +target_file = "source/common/include/Version.h" +target_resource_file = "${root}/version.rc" + +[repo_test] +default_config = "release" + +# Example of Python "pytest" +[repo_test.suites.pytest] +kind = "pytest" + +# Record test results to file. Provide a file path ending in .xml extension +# to record a junit compatible report. +log_file = "_testoutput/results.xml" + +# Specify extra paths to include in PYTHONPATH. Supports wildcards. +# Note pythonpath is also supported for backwards compatibility. +python_paths = [ + "${root}/source/pyHelloWorld" +] + +# Specify suite specific environment variables. +module_path = "${root}/tests/test_all.py" + +env_vars = [ +# [ "OMNI_BASE_URL", "" ], +# [ "OMNI_USER", "" ], +# [ "OMNI_PASS", "" ], +] + diff --git a/run_ignition_omni.sh b/run_gazebo_omni.sh similarity index 82% rename from run_ignition_omni.sh rename to run_gazebo_omni.sh index 625c61b..3cd39e3 100755 --- a/run_ignition_omni.sh +++ b/run_gazebo_omni.sh @@ -8,5 +8,5 @@ echo Running script in ${SCRIPT_DIR} export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${SCRIPT_DIR}/_build/linux-x86_64/release" pushd $SCRIPT_DIR > /dev/null -./_build/linux-x86_64/debug/ignition-omniverse1 "$@" +./_build/linux-x86_64/debug/gazebo-omniverse1 "$@" popd > /dev/null diff --git a/run_ignition_omni_db.sh b/run_gazebo_omni_db.sh similarity index 81% rename from run_ignition_omni_db.sh rename to run_gazebo_omni_db.sh index 375237c..26d40b2 100644 --- a/run_ignition_omni_db.sh +++ b/run_gazebo_omni_db.sh @@ -8,5 +8,5 @@ echo Running script in ${SCRIPT_DIR} export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${SCRIPT_DIR}/_build/linux-x86_64/debug" pushd $SCRIPT_DIR > /dev/null -gdb ./_build/linux-x86_64/debug/ignition-omniverse1 "$@" +gdb ./_build/linux-x86_64/debug/gazebo-omniverse1 "$@" popd > /dev/null diff --git a/source/config/omni.connect.client.toml b/source/config/omni.connect.client.toml new file mode 100644 index 0000000..ec7c9a5 --- /dev/null +++ b/source/config/omni.connect.client.toml @@ -0,0 +1,24 @@ +[app] +name = "connect-samples" +version = "%APP_VERSION%" + +["omni.connect.core".client] +name = "HelloWorld" +version = "${app_version}" + +[plugins."carb.scripting-python.plugin"] +pythonHome = "python-runtime" + +[log] + +# most channels should warn or error only +channels."*" = "Warning" + +# mute warnings on specific channels with known issues +channels."carb" = "Error" + +# make sure our own logs are in stdout +outputStreamLevel = "Info" +channels."HelloWorld" = "Info" +channels."LiveSessionSample" = "Info" +channels."Py*" = "Info" diff --git a/source/ignition_live/Error.hpp b/source/gazebo_live/Error.hpp similarity index 92% rename from source/ignition_live/Error.hpp rename to source/gazebo_live/Error.hpp index 6b9fd88..d73a1f9 100644 --- a/source/ignition_live/Error.hpp +++ b/source/gazebo_live/Error.hpp @@ -15,13 +15,13 @@ * */ -#ifndef IGNITION_OMNIVERSE_ERROR_HPP -#define IGNITION_OMNIVERSE_ERROR_HPP +#ifndef GZ_OMNIVERSE_ERROR_HPP +#define GZ_OMNIVERSE_ERROR_HPP #include #include -namespace ignition::omniverse +namespace gz::omniverse { class GenericError { @@ -63,5 +63,5 @@ class MaybeError std::variant data; }; -} // namespace ignition::omniverse +} // namespace gz::omniverse #endif diff --git a/source/ignition_live/FUSDLayerNoticeListener.cpp b/source/gazebo_live/FUSDLayerNoticeListener.cpp similarity index 90% rename from source/ignition_live/FUSDLayerNoticeListener.cpp rename to source/gazebo_live/FUSDLayerNoticeListener.cpp index ad2839c..4027553 100644 --- a/source/ignition_live/FUSDLayerNoticeListener.cpp +++ b/source/gazebo_live/FUSDLayerNoticeListener.cpp @@ -20,9 +20,9 @@ #include #include -#include +#include -namespace ignition +namespace gz { namespace omniverse { @@ -31,13 +31,13 @@ class FUSDLayerNoticeListener::Implementation public: std::shared_ptr> stage; std::string worldName; - ignition::transport::Node node; + gz::transport::Node node; }; FUSDLayerNoticeListener::FUSDLayerNoticeListener( std::shared_ptr> &_stage, const std::string& _worldName) - : dataPtr(ignition::utils::MakeUniqueImpl()) + : dataPtr(gz::utils::MakeUniqueImpl()) { this->dataPtr->stage = _stage; this->dataPtr->worldName = _worldName; @@ -61,11 +61,11 @@ void FUSDLayerNoticeListener::HandleRootOrSubLayerChange( if (changeEntry.second.flags.didRemoveNonInertPrim) { - ignition::msgs::Entity req; + gz::msgs::Entity req; req.set_name(sdfPath.GetName()); - req.set_type(ignition::msgs::Entity::MODEL); + req.set_type(gz::msgs::Entity::MODEL); - ignition::msgs::Boolean rep; + gz::msgs::Boolean rep; bool result; unsigned int timeout = 5000; bool executed = this->dataPtr->node.Request( diff --git a/source/ignition_live/FUSDLayerNoticeListener.hpp b/source/gazebo_live/FUSDLayerNoticeListener.hpp similarity index 85% rename from source/ignition_live/FUSDLayerNoticeListener.hpp rename to source/gazebo_live/FUSDLayerNoticeListener.hpp index 07aaa56..58c8e66 100644 --- a/source/ignition_live/FUSDLayerNoticeListener.hpp +++ b/source/gazebo_live/FUSDLayerNoticeListener.hpp @@ -14,8 +14,8 @@ * limitations under the License. * */ -#ifndef IGNITION_OMNIVERSE_FUSDLAYERNOTICELISTENER_HPP -#define IGNITION_OMNIVERSE_FUSDLAYERNOTICELISTENER_HPP +#ifndef GZ_OMNIVERSE_FUSDLAYERNOTICELISTENER_HPP +#define GZ_OMNIVERSE_FUSDLAYERNOTICELISTENER_HPP #include "Scene.hpp" @@ -23,11 +23,11 @@ #include -#include +#include -#include +#include -namespace ignition +namespace gz { namespace omniverse { @@ -50,6 +50,6 @@ class FUSDLayerNoticeListener : public pxr::TfWeakBase IGN_UTILS_UNIQUE_IMPL_PTR(dataPtr) }; } // namespace omniverse -} // namespace ignition +} // namespace gz #endif diff --git a/source/ignition_live/FUSDNoticeListener.cpp b/source/gazebo_live/FUSDNoticeListener.cpp similarity index 85% rename from source/ignition_live/FUSDNoticeListener.cpp rename to source/gazebo_live/FUSDNoticeListener.cpp index 6ea44f0..f5eb3fe 100644 --- a/source/ignition_live/FUSDNoticeListener.cpp +++ b/source/gazebo_live/FUSDNoticeListener.cpp @@ -18,7 +18,7 @@ #include "GetOp.hpp" -#include +#include #include #include @@ -27,9 +27,9 @@ #include #include -#include +#include -#include +#include #include #include @@ -39,7 +39,7 @@ #include #include -namespace ignition +namespace gz { namespace omniverse { @@ -91,13 +91,13 @@ class FUSDNoticeListener::Implementation } } - void jointStateCb(const ignition::msgs::Model &_msg); + void jointStateCb(const gz::msgs::Model &_msg); std::shared_ptr> stage; std::string worldName; std::unordered_map revoluteJointPublisher; - /// \brief Ignition communication node. + /// \brief gz communication node. public: transport::Node node; Simulator simulatorPoses; @@ -156,7 +156,7 @@ FUSDNoticeListener::FUSDNoticeListener( const std::string &_worldName, Simulator _simulatorPoses, std::unordered_map &_entitiesByName) - : dataPtr(ignition::utils::MakeUniqueImpl()) + : dataPtr(gz::utils::MakeUniqueImpl()) { this->dataPtr->stage = _stage; this->dataPtr->worldName = _worldName; @@ -172,7 +172,7 @@ FUSDNoticeListener::FUSDNoticeListener( } void FUSDNoticeListener::Implementation::jointStateCb( - const ignition::msgs::Model &_msg) + const gz::msgs::Model &_msg) { std::lock_guard lock(this->jointStateMsgMutex); for(int i = 0; i < _msg.joint_size(); ++i) @@ -229,7 +229,7 @@ void FUSDNoticeListener::Handle( model.SetName(modelUSD.GetPath().GetName()); - model.SetRawPose(ignition::math::Pose3d()); + model.SetRawPose(gz::math::Pose3d()); sdf::Link link; link.SetName(modelUSD.GetPath().GetName()); @@ -240,7 +240,7 @@ void FUSDNoticeListener::Handle( root.SetModel(model); // Prepare the input parameters. - ignition::msgs::EntityFactory req; + gz::msgs::EntityFactory req; req.set_sdf(root.ToElement()->ToString("")); req.set_name(modelUSD.GetPath().GetName()); req.set_allow_renaming(false); @@ -248,7 +248,7 @@ void FUSDNoticeListener::Handle( igndbg << "root.ToElement()->ToString("") " << root.ToElement()->ToString("") << '\n'; - ignition::msgs::Boolean rep; + gz::msgs::Boolean rep; bool result; unsigned int timeout = 5000; bool executed = this->dataPtr->node.Request( @@ -269,7 +269,7 @@ void FUSDNoticeListener::Handle( } } - ignition::msgs::Pose_V req; + gz::msgs::Pose_V req; if (this->dataPtr->simulatorPoses == Simulator::IsaacSim) { @@ -327,7 +327,7 @@ void FUSDNoticeListener::Handle( auto transforms = GetOp(xform); auto currentPrim = modelUSD; - ignition::math::Quaterniond q( + gz::math::Quaterniond q( transforms.rotXYZ[0], transforms.rotXYZ[1], transforms.rotXYZ[2]); @@ -337,13 +337,13 @@ void FUSDNoticeListener::Handle( auto visualXform = pxr::UsdGeomXformable(currentPrim); auto visualOp = GetOp(visualXform); transforms.position += visualOp.position; - ignition::math::Quaterniond qX, qY, qZ; - ignition::math::Angle angleX(IGN_DTOR(visualOp.rotXYZ[0])); - ignition::math::Angle angleY(IGN_DTOR(visualOp.rotXYZ[1])); - ignition::math::Angle angleZ(IGN_DTOR(visualOp.rotXYZ[2])); - qX = ignition::math::Quaterniond(angleX.Normalized().Radian(), 0, 0); - qY = ignition::math::Quaterniond(0, angleY.Normalized().Radian(), 0); - qZ = ignition::math::Quaterniond(0, 0, angleZ.Normalized().Radian()); + gz::math::Quaterniond qX, qY, qZ; + gz::math::Angle angleX(IGN_DTOR(visualOp.rotXYZ[0])); + gz::math::Angle angleY(IGN_DTOR(visualOp.rotXYZ[1])); + gz::math::Angle angleZ(IGN_DTOR(visualOp.rotXYZ[2])); + qX = gz::math::Quaterniond(angleX.Normalized().Radian(), 0, 0); + qY = gz::math::Quaterniond(0, angleY.Normalized().Radian(), 0); + qZ = gz::math::Quaterniond(0, 0, angleZ.Normalized().Radian()); q = ((q * qX) * qY) * qZ; transforms.scale = pxr::GfVec3f( transforms.scale[0] * visualOp.scale[0], @@ -361,13 +361,13 @@ void FUSDNoticeListener::Handle( auto linkXform = pxr::UsdGeomXformable(currentPrim); auto linkOp = GetOp(linkXform); transforms.position += linkOp.position; - ignition::math::Quaterniond qX, qY, qZ; - ignition::math::Angle angleX(IGN_DTOR(linkOp.rotXYZ[0])); - ignition::math::Angle angleY(IGN_DTOR(linkOp.rotXYZ[1])); - ignition::math::Angle angleZ(IGN_DTOR(linkOp.rotXYZ[2])); - qX = ignition::math::Quaterniond(angleX.Normalized().Radian(), 0, 0); - qY = ignition::math::Quaterniond(0, angleY.Normalized().Radian(), 0); - qZ = ignition::math::Quaterniond(0, 0, angleZ.Normalized().Radian()); + gz::math::Quaterniond qX, qY, qZ; + gz::math::Angle angleX(IGN_DTOR(linkOp.rotXYZ[0])); + gz::math::Angle angleY(IGN_DTOR(linkOp.rotXYZ[1])); + gz::math::Angle angleZ(IGN_DTOR(linkOp.rotXYZ[2])); + qX = gz::math::Quaterniond(angleX.Normalized().Radian(), 0, 0); + qY = gz::math::Quaterniond(0, angleY.Normalized().Radian(), 0); + qZ = gz::math::Quaterniond(0, 0, angleZ.Normalized().Radian()); q = ((q * qX) * qY) * qZ; transforms.scale = pxr::GfVec3f( transforms.scale[0] * linkOp.scale[0], @@ -386,13 +386,13 @@ void FUSDNoticeListener::Handle( auto modelXform = pxr::UsdGeomXformable(currentPrim); auto modelOp = GetOp(modelXform); transforms.position += modelOp.position; - ignition::math::Quaterniond qX, qY, qZ; - ignition::math::Angle angleX(IGN_DTOR(modelOp.rotXYZ[0])); - ignition::math::Angle angleY(IGN_DTOR(modelOp.rotXYZ[1])); - ignition::math::Angle angleZ(IGN_DTOR(modelOp.rotXYZ[2])); - qX = ignition::math::Quaterniond(angleX.Normalized().Radian(), 0, 0); - qY = ignition::math::Quaterniond(0, angleY.Normalized().Radian(), 0); - qZ = ignition::math::Quaterniond(0, 0, angleZ.Normalized().Radian()); + gz::math::Quaterniond qX, qY, qZ; + gz::math::Angle angleX(IGN_DTOR(modelOp.rotXYZ[0])); + gz::math::Angle angleY(IGN_DTOR(modelOp.rotXYZ[1])); + gz::math::Angle angleZ(IGN_DTOR(modelOp.rotXYZ[2])); + qX = gz::math::Quaterniond(angleX.Normalized().Radian(), 0, 0); + qY = gz::math::Quaterniond(0, angleY.Normalized().Radian(), 0); + qZ = gz::math::Quaterniond(0, 0, angleZ.Normalized().Radian()); q = ((q * qX) * qY) * qZ; transforms.scale = pxr::GfVec3f( transforms.scale[0] * modelOp.scale[0], @@ -424,7 +424,7 @@ void FUSDNoticeListener::Handle( if (req.pose_size() > 0) { bool result; - ignition::msgs::Boolean rep; + gz::msgs::Boolean rep; unsigned int timeout = 100; bool executed = this->dataPtr->node.Request( "/world/" + this->dataPtr->worldName + "/set_pose_vector", @@ -441,4 +441,4 @@ void FUSDNoticeListener::Handle( } } } // namespace omniverse -} // namespace ignition +} // namespace gz diff --git a/source/ignition_live/FUSDNoticeListener.hpp b/source/gazebo_live/FUSDNoticeListener.hpp similarity index 89% rename from source/ignition_live/FUSDNoticeListener.hpp rename to source/gazebo_live/FUSDNoticeListener.hpp index 0a104cc..cc4d127 100644 --- a/source/ignition_live/FUSDNoticeListener.hpp +++ b/source/gazebo_live/FUSDNoticeListener.hpp @@ -14,8 +14,8 @@ * limitations under the License. * */ -#ifndef IGNITION_OMNIVERSE_FUSDNOTICELISTENER_HPP -#define IGNITION_OMNIVERSE_FUSDNOTICELISTENER_HPP +#ifndef GZ_OMNIVERSE_FUSDNOTICELISTENER_HPP +#define GZ_OMNIVERSE_FUSDNOTICELISTENER_HPP #include #include @@ -25,7 +25,7 @@ #include -namespace ignition +namespace gz { namespace omniverse { @@ -45,6 +45,6 @@ class FUSDNoticeListener : public pxr::TfWeakBase IGN_UTILS_UNIQUE_IMPL_PTR(dataPtr) }; } // namespace omniverse -} // namespace ignition +} // namespace gz #endif diff --git a/source/ignition_live/GetOp.hpp b/source/gazebo_live/GetOp.hpp similarity index 90% rename from source/ignition_live/GetOp.hpp rename to source/gazebo_live/GetOp.hpp index 9c98f27..826ea72 100644 --- a/source/ignition_live/GetOp.hpp +++ b/source/gazebo_live/GetOp.hpp @@ -15,17 +15,17 @@ * */ -#ifndef IGNITION_OMNIVERSE_GET_OP_HPP -#define IGNITION_OMNIVERSE_GET_OP_HPP +#ifndef GZ_OMNIVERSE_GET_OP_HPP +#define GZ_OMNIVERSE_GET_OP_HPP #include #include #include #include -#include +#include -namespace ignition +namespace gz { namespace omniverse { @@ -38,7 +38,7 @@ class GetOp this->position = pxr::GfVec3d(0); this->rotXYZ = pxr::GfVec3f(0); this->scale = pxr::GfVec3f(1); - ignition::math::Quaterniond orientQuat; + gz::math::Quaterniond orientQuat; bool resetXformStack = false; std::vector xFormOps = @@ -60,7 +60,7 @@ class GetOp case pxr::UsdGeomXformOp::TypeOrient: rotateOp = xFormOps[i]; rotateOp.Get(&this->rotQ); - orientQuat = ignition::math::Quaterniond( + orientQuat = gz::math::Quaterniond( this->rotQ.GetReal(), this->rotQ.GetImaginary()[0], this->rotQ.GetImaginary()[1], @@ -86,6 +86,6 @@ class GetOp pxr::GfQuatf rotQ; }; } // namespace omniverse -} // namespace ignition +} // namespace gz #endif diff --git a/source/ignition_live/Joint.cpp b/source/gazebo_live/Joint.cpp similarity index 100% rename from source/ignition_live/Joint.cpp rename to source/gazebo_live/Joint.cpp diff --git a/source/ignition_live/Joint.hpp b/source/gazebo_live/Joint.hpp similarity index 84% rename from source/ignition_live/Joint.hpp rename to source/gazebo_live/Joint.hpp index 1aa76ee..39eb9e6 100644 --- a/source/ignition_live/Joint.hpp +++ b/source/gazebo_live/Joint.hpp @@ -15,20 +15,20 @@ * */ -#ifndef IGNITION_OMNIVERSE_JOINT_HPP -#define IGNITION_OMNIVERSE_JOINT_HPP +#ifndef GZ_OMNIVERSE_JOINT_HPP +#define GZ_OMNIVERSE_JOINT_HPP -#include +#include #include #include -namespace ignition::omniverse +namespace gz::omniverse { pxr::UsdPrim CreateFixedJoint(const std::string& _path, const pxr::UsdStageRefPtr& _stage); pxr::UsdPrim CreateRevoluteJoint(const std::string& _path, const pxr::UsdStageRefPtr& _stage); -} // namespace ignition::omniverse +} // namespace gz::omniverse #endif diff --git a/source/ignition_live/Material.cpp b/source/gazebo_live/Material.cpp similarity index 90% rename from source/ignition_live/Material.cpp rename to source/gazebo_live/Material.cpp index 8d68070..a891fa5 100644 --- a/source/ignition_live/Material.cpp +++ b/source/gazebo_live/Material.cpp @@ -17,8 +17,8 @@ #include "Material.hpp" -#include -#include +#include +#include #include #include @@ -32,7 +32,7 @@ #include -namespace ignition +namespace gz { namespace omniverse { @@ -42,10 +42,10 @@ namespace omniverse std::string checkURI(const std::string _fullPath) { // TODO (ahcorde): This code is duplicated is the USD converter (sdformat) - ignition::common::URI uri(_fullPath); + gz::common::URI uri(_fullPath); std::string fullPath = _fullPath; std::string home; - if (!ignition::common::env("HOME", home, false)) + if (!gz::common::env("HOME", home, false)) { ignwarn << "The HOME environment variable was not defined, " << "so the resource [" << fullPath << "] could not be found\n"; @@ -53,24 +53,24 @@ std::string checkURI(const std::string _fullPath) } if (uri.Scheme() == "http" || uri.Scheme() == "https") { - auto systemPaths = ignition::common::systemPaths(); + auto systemPaths = gz::common::systemPaths(); - std::vector tokens = ignition::common::split(uri.Path().Str(), "/"); + std::vector tokens = gz::common::split(uri.Path().Str(), "/"); std::string server = tokens[0]; std::string versionServer = tokens[1]; - std::string owner = ignition::common::lowercase(tokens[2]); - std::string type = ignition::common::lowercase(tokens[3]); - std::string modelName = ignition::common::lowercase(tokens[4]); - std::string modelVersion = ignition::common::lowercase(tokens[5]); + std::string owner = gz::common::lowercase(tokens[2]); + std::string type = gz::common::lowercase(tokens[3]); + std::string modelName = gz::common::lowercase(tokens[4]); + std::string modelVersion = gz::common::lowercase(tokens[5]); - fullPath = ignition::common::joinPaths( - home, ".ignition", "fuel", server, owner, type, modelName, modelVersion); + fullPath = gz::common::joinPaths( + home, ".gz", "fuel", server, owner, type, modelName, modelVersion); systemPaths->AddFilePaths(fullPath); for (int i = 7; i < tokens.size(); i++) { - fullPath = ignition::common::joinPaths( - fullPath, ignition::common::lowercase(tokens[i])); + fullPath = gz::common::joinPaths( + fullPath, gz::common::lowercase(tokens[i])); systemPaths->AddFilePaths(fullPath); } } @@ -89,7 +89,7 @@ bool copyMaterial( if (!_path.empty() && !_fullPath.empty()) { /// - auto fileName = ignition::common::basename(_path); + auto fileName = gz::common::basename(_path); auto filePathIndex = _path.rfind(fileName); auto filePath = _path.substr(0, filePathIndex); if (!omniClientWaitFor(omniClientCopy( @@ -112,11 +112,11 @@ bool copyMaterial( /// materials/textures/ std::string getMaterialCopyPath(const std::string &_uri) { -return ignition::common::joinPaths( +return gz::common::joinPaths( ".", "materials", "textures", - ignition::common::basename(_uri)); + gz::common::basename(_uri)); } /// \brief Fill Material shader attributes and properties @@ -186,7 +186,7 @@ void CreateMaterialInput( /// \param[in] _stageDirUrl stage directory URL to copy materials if required bool SetMaterial(const pxr::UsdGeomGprim &_gprim, - const ignition::msgs::Visual &_visualMsg, + const gz::msgs::Visual &_visualMsg, const pxr::UsdStageRefPtr &_stage, const std::string &_stageDirUrl) { @@ -221,7 +221,7 @@ bool SetMaterial(const pxr::UsdGeomGprim &_gprim, {pxr::TfToken("range:max"), pxr::VtValue(pxr::GfVec3f(100000, 100000, 100000))}, {pxr::TfToken("range:min"), pxr::VtValue(pxr::GfVec3f(0, 0, 0))}}; - ignition::math::Color diffuse( + gz::math::Color diffuse( _visualMsg.material().diffuse().r(), _visualMsg.material().diffuse().g(), _visualMsg.material().diffuse().b(), _visualMsg.material().diffuse().a()); CreateMaterialInput( @@ -235,7 +235,7 @@ bool SetMaterial(const pxr::UsdGeomGprim &_gprim, {pxr::TfToken("range:max"), pxr::VtValue(pxr::GfVec3f(100000, 100000, 100000))}, {pxr::TfToken("range:min"), pxr::VtValue(pxr::GfVec3f(0, 0, 0))}}; - ignition::math::Color emissive(_visualMsg.material().emissive().r(), + gz::math::Color emissive(_visualMsg.material().emissive().r(), _visualMsg.material().emissive().g(), _visualMsg.material().emissive().b(), _visualMsg.material().emissive().a()); @@ -308,8 +308,8 @@ bool SetMaterial(const pxr::UsdGeomGprim &_gprim, std::string albedoMapURI = checkURI(pbr.albedo_map()); std::string fullnameAlbedoMap = - ignition::common::findFile( - ignition::common::basename(albedoMapURI)); + gz::common::findFile( + gz::common::basename(albedoMapURI)); if (fullnameAlbedoMap.empty()) { @@ -339,8 +339,8 @@ bool SetMaterial(const pxr::UsdGeomGprim &_gprim, std::string copyPath = getMaterialCopyPath(pbr.metalness_map()); std::string fullnameMetallnessMap = - ignition::common::findFile( - ignition::common::basename(pbr.metalness_map())); + gz::common::findFile( + gz::common::basename(pbr.metalness_map())); if (fullnameMetallnessMap.empty()) { @@ -370,8 +370,8 @@ bool SetMaterial(const pxr::UsdGeomGprim &_gprim, std::string copyPath = getMaterialCopyPath(pbr.normal_map()); std::string fullnameNormalMap = - ignition::common::findFile( - ignition::common::basename(pbr.normal_map())); + gz::common::findFile( + gz::common::basename(pbr.normal_map())); if (fullnameNormalMap.empty()) { @@ -401,8 +401,8 @@ bool SetMaterial(const pxr::UsdGeomGprim &_gprim, std::string copyPath = getMaterialCopyPath(pbr.roughness_map()); std::string fullnameRoughnessMap = - ignition::common::findFile( - ignition::common::basename(pbr.roughness_map())); + gz::common::findFile( + gz::common::basename(pbr.roughness_map())); if (fullnameRoughnessMap.empty()) { @@ -446,4 +446,4 @@ bool SetMaterial(const pxr::UsdGeomGprim &_gprim, return true; } } // namespace omniverse -} // namespace ignition +} // namespace gz diff --git a/source/ignition_live/Material.hpp b/source/gazebo_live/Material.hpp similarity index 80% rename from source/ignition_live/Material.hpp rename to source/gazebo_live/Material.hpp index 0671ed1..f13c092 100644 --- a/source/ignition_live/Material.hpp +++ b/source/gazebo_live/Material.hpp @@ -14,24 +14,24 @@ * limitations under the License. * */ -#ifndef IGNITION_OMNIVERSE_MATERIAL_HPP -#define IGNITION_OMNIVERSE_MATERIAL_HPP +#ifndef GZ_OMNIVERSE_MATERIAL_HPP +#define GZ_OMNIVERSE_MATERIAL_HPP -#include +#include #include #include #include -namespace ignition +namespace gz { namespace omniverse { bool SetMaterial(const pxr::UsdGeomGprim& _gprim, - const ignition::msgs::Visual& _visualMsg, + const gz::msgs::Visual& _visualMsg, const pxr::UsdStageRefPtr& _stage, const std::string& _stageDirUrl); } -} // namespace ignition +} // namespace gz #endif diff --git a/source/ignition_live/Mesh.cpp b/source/gazebo_live/Mesh.cpp similarity index 78% rename from source/ignition_live/Mesh.cpp rename to source/gazebo_live/Mesh.cpp index c43bca0..2d5d30d 100644 --- a/source/ignition_live/Mesh.cpp +++ b/source/gazebo_live/Mesh.cpp @@ -17,16 +17,16 @@ #include "Mesh.hpp" -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include -namespace ignition::omniverse +namespace gz::omniverse { bool endsWith(const std::string_view &str, const std::string_view &suffix) { @@ -41,15 +41,15 @@ inline std::string removeDash(const std::string &_str) return result; } -pxr::UsdGeomMesh UpdateMesh(const ignition::msgs::MeshGeom &_meshMsg, +pxr::UsdGeomMesh UpdateMesh(const gz::msgs::MeshGeom &_meshMsg, const std::string &_path, const pxr::UsdStageRefPtr &_stage) { - ignition::common::URI uri(_meshMsg.filename()); + gz::common::URI uri(_meshMsg.filename()); std::string fullname; std::string home; - if (!ignition::common::env("HOME", home, false)) + if (!gz::common::env("HOME", home, false)) { ignerr << "The HOME environment variable was not defined, " << "so the resource [" << fullname << "] could not be found\n"; @@ -57,33 +57,33 @@ pxr::UsdGeomMesh UpdateMesh(const ignition::msgs::MeshGeom &_meshMsg, } if (uri.Scheme() == "https" || uri.Scheme() == "http") { - auto systemPaths = ignition::common::systemPaths(); + auto systemPaths = gz::common::systemPaths(); - std::vector tokens = ignition::common::split(uri.Path().Str(), "/"); + std::vector tokens = gz::common::split(uri.Path().Str(), "/"); std::string server = tokens[0]; std::string versionServer = tokens[1]; - std::string owner = ignition::common::lowercase(tokens[2]); - std::string type = ignition::common::lowercase(tokens[3]); - std::string modelName = ignition::common::lowercase(tokens[4]); - std::string modelVersion = ignition::common::lowercase(tokens[5]); + std::string owner = gz::common::lowercase(tokens[2]); + std::string type = gz::common::lowercase(tokens[3]); + std::string modelName = gz::common::lowercase(tokens[4]); + std::string modelVersion = gz::common::lowercase(tokens[5]); - fullname = ignition::common::joinPaths( - home, ".ignition", "fuel", server, owner, type, modelName, modelVersion); + fullname = gz::common::joinPaths( + home, ".gz", "fuel", server, owner, type, modelName, modelVersion); systemPaths->AddFilePaths(fullname); for (int i = 7; i < tokens.size(); i++) { - fullname = ignition::common::joinPaths( - fullname, ignition::common::lowercase(tokens[i])); + fullname = gz::common::joinPaths( + fullname, gz::common::lowercase(tokens[i])); systemPaths->AddFilePaths(fullname); } } else { - fullname = ignition::common::findFile(_meshMsg.filename()); + fullname = gz::common::findFile(_meshMsg.filename()); } - auto ignMesh = ignition::common::MeshManager::Instance()->Load(fullname); + auto ignMesh = gz::common::MeshManager::Instance()->Load(fullname); // Some Meshes are splited in some submeshes, this loop check if the name // of the path is the same as the name of the submesh. In this case @@ -95,9 +95,9 @@ pxr::UsdGeomMesh UpdateMesh(const ignition::msgs::MeshGeom &_meshMsg, if (ignMesh->SubMeshCount() != 1) { - std::string pathLowerCase = ignition::common::lowercase(_path); + std::string pathLowerCase = gz::common::lowercase(_path); std::string subMeshLowerCase = - ignition::common::lowercase(subMesh->Name()); + gz::common::lowercase(subMesh->Name()); if (pathLowerCase.find(subMeshLowerCase) != std::string::npos) { @@ -126,9 +126,9 @@ pxr::UsdGeomMesh UpdateMesh(const ignition::msgs::MeshGeom &_meshMsg, { if (ignMesh->SubMeshCount() != 1) { - std::string pathLowerCase = ignition::common::lowercase(_path); + std::string pathLowerCase = gz::common::lowercase(_path); std::string subMeshLowerCase = - ignition::common::lowercase(subMesh->Name()); + gz::common::lowercase(subMesh->Name()); if (pathLowerCase.find(subMeshLowerCase) == std::string::npos) { @@ -173,21 +173,21 @@ pxr::UsdGeomMesh UpdateMesh(const ignition::msgs::MeshGeom &_meshMsg, unsigned int numFaces = 0; switch (subMesh->SubMeshPrimitiveType()) { - case ignition::common::SubMesh::PrimitiveType::POINTS: + case gz::common::SubMesh::PrimitiveType::POINTS: verticesPerFace = 1; numFaces = subMesh->IndexCount(); break; - case ignition::common::SubMesh::PrimitiveType::LINES: + case gz::common::SubMesh::PrimitiveType::LINES: verticesPerFace = 2; numFaces = subMesh->IndexCount() / 2; break; - case ignition::common::SubMesh::PrimitiveType::TRIANGLES: + case gz::common::SubMesh::PrimitiveType::TRIANGLES: verticesPerFace = 3; numFaces = subMesh->IndexCount() / 3; break; - case ignition::common::SubMesh::PrimitiveType::LINESTRIPS: - case ignition::common::SubMesh::PrimitiveType::TRIFANS: - case ignition::common::SubMesh::PrimitiveType::TRISTRIPS: + case gz::common::SubMesh::PrimitiveType::LINESTRIPS: + case gz::common::SubMesh::PrimitiveType::TRIFANS: + case gz::common::SubMesh::PrimitiveType::TRISTRIPS: default: ignerr << "Submesh " << subMesh->Name() << " has a primitive type that is not supported." << std::endl; @@ -238,8 +238,8 @@ pxr::UsdGeomMesh UpdateMesh(const ignition::msgs::MeshGeom &_meshMsg, // sdf::Material materialSdf = sdf::usd::convert(material); // auto materialUSD = ParseSdfMaterial(&materialSdf, _stage); - // if(materialSdf.Emissive() != ignition::math::Color(0, 0, 0, 1) - // || materialSdf.Specular() != ignition::math::Color(0, 0, 0, 1) + // if(materialSdf.Emissive() != gz::math::Color(0, 0, 0, 1) + // || materialSdf.Specular() != gz::math::Color(0, 0, 0, 1) // || materialSdf.PbrMaterial()) // { // if (materialUSD) @@ -258,4 +258,4 @@ pxr::UsdGeomMesh UpdateMesh(const ignition::msgs::MeshGeom &_meshMsg, return pxr::UsdGeomMesh(); } -} // namespace ignition::omniverse +} // namespace gz::omniverse diff --git a/source/ignition_live/Mesh.hpp b/source/gazebo_live/Mesh.hpp similarity index 78% rename from source/ignition_live/Mesh.hpp rename to source/gazebo_live/Mesh.hpp index 0d59642..8a166a2 100644 --- a/source/ignition_live/Mesh.hpp +++ b/source/gazebo_live/Mesh.hpp @@ -14,22 +14,22 @@ * limitations under the License. * */ -#ifndef IGNITION_OMNIVERSE_MESH_HPP -#define IGNITION_OMNIVERSE_MESH_HPP +#ifndef GZ_OMNIVERSE_MESH_HPP +#define GZ_OMNIVERSE_MESH_HPP -#include +#include #include #include -namespace ignition +namespace gz { namespace omniverse { -pxr::UsdGeomMesh UpdateMesh(const ignition::msgs::MeshGeom& _meshMsg, +pxr::UsdGeomMesh UpdateMesh(const gz::msgs::MeshGeom& _meshMsg, const std::string& _path, const pxr::UsdStageRefPtr& _stage); } -} // namespace ignition +} // namespace gz #endif diff --git a/source/ignition_live/OmniClientpp.cpp b/source/gazebo_live/OmniClientpp.cpp similarity index 94% rename from source/ignition_live/OmniClientpp.cpp rename to source/gazebo_live/OmniClientpp.cpp index 1cc7528..d81dd37 100644 --- a/source/ignition_live/OmniClientpp.cpp +++ b/source/gazebo_live/OmniClientpp.cpp @@ -17,11 +17,11 @@ #include "OmniClientpp.hpp" -#include +#include #include -namespace ignition::omniverse +namespace gz::omniverse { OmniverseLock::OmniverseLock(const std::string& _url) : url(_url) { @@ -58,4 +58,4 @@ OmniverseSync::MaybeError OmniverseSync::Stat( })); return ret; } -} // namespace ignition::omniverse +} // namespace gz::omniverse diff --git a/source/ignition_live/OmniClientpp.hpp b/source/gazebo_live/OmniClientpp.hpp similarity index 89% rename from source/ignition_live/OmniClientpp.hpp rename to source/gazebo_live/OmniClientpp.hpp index dda8cf6..a296e17 100644 --- a/source/ignition_live/OmniClientpp.hpp +++ b/source/gazebo_live/OmniClientpp.hpp @@ -19,8 +19,8 @@ * C++ wrappers for various omniclient apis */ -#ifndef IGNITION_OMNIVERSE_OMNICLIENTPP_HPP -#define IGNITION_OMNIVERSE_OMNICLIENTPP_HPP +#ifndef GZ_OMNIVERSE_OMNICLIENTPP_HPP +#define GZ_OMNIVERSE_OMNICLIENTPP_HPP #include "Error.hpp" @@ -29,7 +29,7 @@ #include #include -namespace ignition::omniverse +namespace gz::omniverse { /// \brief RAII wrapper to omniClientLock and omniClientUnlock class OmniverseLock @@ -56,5 +56,5 @@ class OmniverseSync static MaybeError Stat(const std::string& url) noexcept; }; -} // namespace ignition::omniverse +} // namespace gz::omniverse #endif diff --git a/source/ignition_live/OmniverseConnect.cpp b/source/gazebo_live/OmniverseConnect.cpp similarity index 97% rename from source/ignition_live/OmniverseConnect.cpp rename to source/gazebo_live/OmniverseConnect.cpp index c00b40a..9b2e7a6 100644 --- a/source/ignition_live/OmniverseConnect.cpp +++ b/source/gazebo_live/OmniverseConnect.cpp @@ -17,7 +17,7 @@ #include "OmniverseConnect.hpp" -#include +#include #include #include @@ -31,7 +31,7 @@ #include #include -namespace ignition +namespace gz { namespace omniverse { @@ -144,11 +144,11 @@ MaybeError CreateOmniverseModel( else { auto stage = pxr::UsdStage::CreateNew(normalizedStageUrl); - // Specify ignition up-ness and units. + // Specify gz up-ness and units. pxr::UsdGeomSetStageUpAxis(stage, pxr::UsdGeomTokens->z); pxr::UsdGeomSetStageMetersPerUnit(stage, 1); stage->SetMetadata(pxr::SdfFieldKeys->Comment, - "Created by ignition-omniverse"); + "Created by gz-omniverse"); stage->Save(); ignmsg << "Created omniverse stage at [" << normalizedStageUrl << "]" << std::endl; @@ -248,4 +248,4 @@ bool StartOmniverse() return true; } } // namespace omniverse -} // namespace ignition +} // namespace gz diff --git a/source/ignition_live/OmniverseConnect.hpp b/source/gazebo_live/OmniverseConnect.hpp similarity index 82% rename from source/ignition_live/OmniverseConnect.hpp rename to source/gazebo_live/OmniverseConnect.hpp index 3a58cf3..4652c0a 100644 --- a/source/ignition_live/OmniverseConnect.hpp +++ b/source/gazebo_live/OmniverseConnect.hpp @@ -15,8 +15,8 @@ * */ -#ifndef IGNITION_OMNIVERSE_CONNECT_HPP -#define IGNITION_OMNIVERSE_CONNECT_HPP +#ifndef GZ_OMNIVERSE_CONNECT_HPP +#define GZ_OMNIVERSE_CONNECT_HPP #include "OmniClientpp.hpp" @@ -30,7 +30,7 @@ // Global for making the logging reasonable static std::mutex gLogMutex; -namespace ignition::omniverse +namespace gz::omniverse { static std::string normalizedStageUrl; @@ -38,9 +38,9 @@ static std::string normalizedStageUrl; // omniverse://ov-prod void PrintConnectedUsername(const std::string& stageUrl); -/// \brief Creates a new ignition stage in omniverse, does nothing if the +/// \brief Creates a new gz stage in omniverse, does nothing if the /// stage already exists. -/// \details The new stage is authored with ignition metadata. +/// \details The new stage is authored with gz metadata. /// \return The url of the stage MaybeError CreateOmniverseModel( const std::string& destinationPath); @@ -49,6 +49,6 @@ void CheckpointFile(const char* stageUrl, const char* comment); // Startup Omniverse bool StartOmniverse(); -} // namespace ignition::omniverse +} // namespace gz::omniverse #endif diff --git a/source/ignition_live/Scene.cpp b/source/gazebo_live/Scene.cpp similarity index 90% rename from source/ignition_live/Scene.cpp rename to source/gazebo_live/Scene.cpp index 295d39d..6452bf3 100644 --- a/source/ignition_live/Scene.cpp +++ b/source/gazebo_live/Scene.cpp @@ -22,9 +22,9 @@ #include "Material.hpp" #include "Mesh.hpp" -#include -#include -#include +#include +#include +#include #include #include @@ -43,7 +43,7 @@ using namespace std::chrono_literals; -namespace ignition +namespace gz { namespace omniverse { @@ -52,37 +52,37 @@ class Scene::Implementation public: std::string worldName; std::shared_ptr> stage; - ignition::transport::Node node; + gz::transport::Node node; std::string stageDirUrl; std::unordered_map entities; std::unordered_map entitiesByName; std::shared_ptr USDLayerNoticeListener; std::shared_ptr USDNoticeListener; - Simulator simulatorPoses = {Simulator::Ignition}; + Simulator simulatorPoses = {Simulator::gz}; - bool UpdateSensors(const ignition::msgs::Sensor &_sensor, + bool UpdateSensors(const gz::msgs::Sensor &_sensor, const std::string &_usdSensorPath); - bool UpdateLights(const ignition::msgs::Light &_light, + bool UpdateLights(const gz::msgs::Light &_light, const std::string &_usdLightPath); - bool UpdateScene(const ignition::msgs::Scene &_scene); - bool UpdateVisual(const ignition::msgs::Visual &_visual, + bool UpdateScene(const gz::msgs::Scene &_scene); + bool UpdateVisual(const gz::msgs::Visual &_visual, const std::string &_usdPath); - bool UpdateLink(const ignition::msgs::Link &_link, + bool UpdateLink(const gz::msgs::Link &_link, const std::string &_usdModelPath); - bool UpdateJoint(const ignition::msgs::Joint &_joint, + bool UpdateJoint(const gz::msgs::Joint &_joint, const std::string &_modelName); - bool UpdateModel(const ignition::msgs::Model &_model); + bool UpdateModel(const gz::msgs::Model &_model); void SetPose(const pxr::UsdGeomXformCommonAPI &_prim, - const ignition::msgs::Pose &_pose); + const gz::msgs::Pose &_pose); void ResetPose(const pxr::UsdGeomXformCommonAPI &_prim); void SetScale(const pxr::UsdGeomXformCommonAPI &_xform, - const ignition::msgs::Vector3d &_scale); + const gz::msgs::Vector3d &_scale); void ResetScale(const pxr::UsdGeomXformCommonAPI &_prim); - void CallbackPoses(const ignition::msgs::Pose_V &_msg); - void CallbackJoint(const ignition::msgs::Model &_msg); - void CallbackScene(const ignition::msgs::Scene &_scene); - void CallbackSceneDeletion(const ignition::msgs::UInt32_V &_msg); + void CallbackPoses(const gz::msgs::Pose_V &_msg); + void CallbackJoint(const gz::msgs::Model &_msg); + void CallbackScene(const gz::msgs::Scene &_scene); + void CallbackSceneDeletion(const gz::msgs::UInt32_V &_msg); }; ////////////////////////////////////////////////// @@ -90,13 +90,13 @@ Scene::Scene( const std::string &_worldName, const std::string &_stageUrl, Simulator _simulatorPoses) - : dataPtr(ignition::utils::MakeUniqueImpl()) + : dataPtr(gz::utils::MakeUniqueImpl()) { ignmsg << "Opened stage [" << _stageUrl << "]" << std::endl; this->dataPtr->worldName = _worldName; this->dataPtr->stage = std::make_shared>( pxr::UsdStage::Open(_stageUrl)); - this->dataPtr->stageDirUrl = ignition::common::parentPath(_stageUrl); + this->dataPtr->stageDirUrl = gz::common::parentPath(_stageUrl); this->dataPtr->simulatorPoses = _simulatorPoses; } @@ -109,22 +109,22 @@ std::shared_ptr> &Scene::Stage() ////////////////////////////////////////////////// void Scene::Implementation::SetPose(const pxr::UsdGeomXformCommonAPI &_prim, - const ignition::msgs::Pose &_pose) + const gz::msgs::Pose &_pose) { - if (this->simulatorPoses == Simulator::Ignition) + if (this->simulatorPoses == Simulator::gz) { if (_prim) { pxr::UsdGeomXformCommonAPI xformApi(_prim); const auto &pos = _pose.position(); const auto &orient = _pose.orientation(); - ignition::math::Quaterniond quat(orient.w(), orient.x(), orient.y(), + gz::math::Quaterniond quat(orient.w(), orient.x(), orient.y(), orient.z()); xformApi.SetTranslate(pxr::GfVec3d(pos.x(), pos.y(), pos.z())); xformApi.SetRotate(pxr::GfVec3f( - ignition::math::Angle(quat.Roll()).Degree(), - ignition::math::Angle(quat.Pitch()).Degree(), - ignition::math::Angle(quat.Yaw()).Degree()), + gz::math::Angle(quat.Roll()).Degree(), + gz::math::Angle(quat.Pitch()).Degree(), + gz::math::Angle(quat.Yaw()).Degree()), pxr::UsdGeomXformCommonAPI::RotationOrderXYZ); } } @@ -140,7 +140,7 @@ void Scene::Implementation::ResetPose(const pxr::UsdGeomXformCommonAPI &_prim) ////////////////////////////////////////////////// void Scene::Implementation::SetScale(const pxr::UsdGeomXformCommonAPI &_prim, - const ignition::msgs::Vector3d &_scale) + const gz::msgs::Vector3d &_scale) { pxr::UsdGeomXformCommonAPI xformApi(_prim); xformApi.SetScale(pxr::GfVec3f(_scale.x(), _scale.y(), _scale.z())); @@ -154,7 +154,7 @@ void Scene::Implementation::ResetScale(const pxr::UsdGeomXformCommonAPI &_prim) } ////////////////////////////////////////////////// -bool Scene::Implementation::UpdateVisual(const ignition::msgs::Visual &_visual, +bool Scene::Implementation::UpdateVisual(const gz::msgs::Visual &_visual, const std::string &_usdLinkPath) { auto stage = this->stage->Lock(); @@ -199,7 +199,7 @@ bool Scene::Implementation::UpdateVisual(const ignition::msgs::Visual &_visual, switch (geom.type()) { - case ignition::msgs::Geometry::BOX: + case gz::msgs::Geometry::BOX: { auto usdCube = pxr::UsdGeomCube::Define(*stage, pxr::SdfPath(usdGeomPath)); @@ -219,8 +219,8 @@ bool Scene::Implementation::UpdateVisual(const ignition::msgs::Visual &_visual, break; } // TODO: Support cone - // case ignition::msgs::Geometry::CONE: - case ignition::msgs::Geometry::CYLINDER: + // case gz::msgs::Geometry::CONE: + case gz::msgs::Geometry::CYLINDER: { auto usdCylinder = pxr::UsdGeomCylinder::Define(*stage, pxr::SdfPath(usdGeomPath)); @@ -242,7 +242,7 @@ bool Scene::Implementation::UpdateVisual(const ignition::msgs::Visual &_visual, } break; } - case ignition::msgs::Geometry::PLANE: + case gz::msgs::Geometry::PLANE: { auto usdCube = pxr::UsdGeomCube::Define(*stage, pxr::SdfPath(usdGeomPath)); @@ -262,12 +262,12 @@ bool Scene::Implementation::UpdateVisual(const ignition::msgs::Visual &_visual, } break; } - case ignition::msgs::Geometry::ELLIPSOID: + case gz::msgs::Geometry::ELLIPSOID: { auto usdEllipsoid = pxr::UsdGeomSphere::Define(*stage, pxr::SdfPath(usdGeomPath)); const auto maxRadii = - ignition::math::Vector3d(geom.ellipsoid().radii().x(), + gz::math::Vector3d(geom.ellipsoid().radii().x(), geom.ellipsoid().radii().y(), geom.ellipsoid().radii().z()) .Max(); @@ -289,7 +289,7 @@ bool Scene::Implementation::UpdateVisual(const ignition::msgs::Visual &_visual, } break; } - case ignition::msgs::Geometry::SPHERE: + case gz::msgs::Geometry::SPHERE: { auto usdSphere = pxr::UsdGeomSphere::Define(*stage, pxr::SdfPath(usdGeomPath)); @@ -305,7 +305,7 @@ bool Scene::Implementation::UpdateVisual(const ignition::msgs::Visual &_visual, } break; } - case ignition::msgs::Geometry::CAPSULE: + case gz::msgs::Geometry::CAPSULE: { auto usdCapsule = pxr::UsdGeomCapsule::Define(*stage, pxr::SdfPath(usdGeomPath)); @@ -325,7 +325,7 @@ bool Scene::Implementation::UpdateVisual(const ignition::msgs::Visual &_visual, } break; } - case ignition::msgs::Geometry::MESH: + case gz::msgs::Geometry::MESH: { auto usdMesh = UpdateMesh(geom.mesh(), usdGeomPath, *stage); if (!usdMesh) @@ -367,7 +367,7 @@ bool Scene::Implementation::UpdateVisual(const ignition::msgs::Visual &_visual, } ////////////////////////////////////////////////// -bool Scene::Implementation::UpdateLink(const ignition::msgs::Link &_link, +bool Scene::Implementation::UpdateLink(const gz::msgs::Link &_link, const std::string &_usdModelPath) { auto stage = this->stage->Lock(); @@ -444,7 +444,7 @@ bool Scene::Implementation::UpdateLink(const ignition::msgs::Link &_link, ////////////////////////////////////////////////// bool Scene::Implementation::UpdateJoint( - const ignition::msgs::Joint &_joint, const std::string &_modelName) + const gz::msgs::Joint &_joint, const std::string &_modelName) { auto stage = this->stage->Lock(); auto jointUSD = @@ -460,7 +460,7 @@ bool Scene::Implementation::UpdateJoint( { switch (_joint.type()) { - case ignition::msgs::Joint::FIXED: + case gz::msgs::Joint::FIXED: { pxr::TfToken usdPrimTypeName("PhysicsFixedJoint"); auto jointFixedUSD = stage->DefinePrim( @@ -487,7 +487,7 @@ bool Scene::Implementation::UpdateJoint( _joint.pose().position().z())); return true; } - case ignition::msgs::Joint::REVOLUTE: + case gz::msgs::Joint::REVOLUTE: { igndbg << "Creating a revolute joint" << '\n'; @@ -531,22 +531,22 @@ bool Scene::Implementation::UpdateJoint( igndbg << "Not able to create UsdRelationship for body1" << '\n'; } - ignition::math::Vector3i axis( + gz::math::Vector3i axis( _joint.axis1().xyz().x(), _joint.axis1().xyz().y(), _joint.axis1().xyz().z()); - if (axis == ignition::math::Vector3i(1, 0, 0)) + if (axis == gz::math::Vector3i(1, 0, 0)) { revoluteJointUSD.CreateAttribute(pxr::TfToken("physics:axis"), pxr::SdfValueTypeNames->Token, false).Set(pxr::TfToken("X")); } - else if (axis == ignition::math::Vector3i(0, 1, 0)) + else if (axis == gz::math::Vector3i(0, 1, 0)) { revoluteJointUSD.CreateAttribute(pxr::TfToken("physics:axis"), pxr::SdfValueTypeNames->Token, false).Set(pxr::TfToken("Y")); } - else if (axis == ignition::math::Vector3i(0, 0, 1)) + else if (axis == gz::math::Vector3i(0, 0, 1)) { revoluteJointUSD.CreateAttribute(pxr::TfToken("physics:axis"), pxr::SdfValueTypeNames->Token, false).Set(pxr::TfToken("Z")); @@ -632,7 +632,7 @@ bool Scene::Implementation::UpdateJoint( { attrTargetPos.Set(pxr::VtValue( static_cast( - ignition::math::Angle(_joint.axis1().position()).Degree()))); + gz::math::Angle(_joint.axis1().position()).Degree()))); } else { @@ -640,13 +640,13 @@ bool Scene::Implementation::UpdateJoint( pxr::TfToken("drive:angular:physics:targetPosition"), pxr::SdfValueTypeNames->Float, false).Set( static_cast( - ignition::math::Angle(_joint.axis1().position()).Degree())); + gz::math::Angle(_joint.axis1().position()).Degree())); } return true; } ////////////////////////////////////////////////// -bool Scene::Implementation::UpdateModel(const ignition::msgs::Model &_model) +bool Scene::Implementation::UpdateModel(const gz::msgs::Model &_model) { auto stage = this->stage->Lock(); @@ -790,7 +790,7 @@ bool Scene::Implementation::UpdateModel(const ignition::msgs::Model &_model) } ////////////////////////////////////////////////// -bool Scene::Implementation::UpdateScene(const ignition::msgs::Scene &_scene) +bool Scene::Implementation::UpdateScene(const gz::msgs::Scene &_scene) { for (const auto &model : _scene.model()) { @@ -815,7 +815,7 @@ bool Scene::Implementation::UpdateScene(const ignition::msgs::Scene &_scene) } ////////////////////////////////////////////////// -bool Scene::Implementation::UpdateSensors(const ignition::msgs::Sensor &_sensor, +bool Scene::Implementation::UpdateSensors(const gz::msgs::Sensor &_sensor, const std::string &_usdSensorPath) { auto stage = this->stage->Lock(); @@ -827,7 +827,7 @@ bool Scene::Implementation::UpdateSensors(const ignition::msgs::Sensor &_sensor, *stage, pxr::SdfPath(_usdSensorPath)); // TODO(ahcorde): The default value in USD is 50, but something more - // similar to ignition Gazebo is 40. + // similar to gz Gazebo is 40. usdCamera.CreateFocalLengthAttr().Set( static_cast(52.0f)); @@ -838,14 +838,14 @@ bool Scene::Implementation::UpdateSensors(const ignition::msgs::Sensor &_sensor, static_cast( _sensor.camera().horizontal_fov() * 180.0f / IGN_PI)); - ignition::math::Pose3d poseCameraYUp(0, 0, 0, IGN_PI_2, 0, -IGN_PI_2); - ignition::math::Quaterniond q( + gz::math::Pose3d poseCameraYUp(0, 0, 0, IGN_PI_2, 0, -IGN_PI_2); + gz::math::Quaterniond q( _sensor.pose().orientation().w(), _sensor.pose().orientation().x(), _sensor.pose().orientation().y(), _sensor.pose().orientation().z()); - ignition::math::Pose3d poseCamera( + gz::math::Pose3d poseCamera( _sensor.pose().position().x(), _sensor.pose().position().y(), _sensor.pose().position().z(), @@ -910,7 +910,7 @@ bool Scene::Implementation::UpdateSensors(const ignition::msgs::Sensor &_sensor, return true; } ////////////////////////////////////////////////// -bool Scene::Implementation::UpdateLights(const ignition::msgs::Light &_light, +bool Scene::Implementation::UpdateLights(const gz::msgs::Light &_light, const std::string &_usdLightPath) { // TODO: We can probably re-use code from sdformat @@ -920,7 +920,7 @@ bool Scene::Implementation::UpdateLights(const ignition::msgs::Light &_light, const pxr::SdfPath sdfLightPath(_usdLightPath); switch (_light.type()) { - case ignition::msgs::Light::POINT: + case gz::msgs::Light::POINT: { auto pointLight = pxr::UsdLuxSphereLight::Define(*stage, sdfLightPath); pointLight.CreateTreatAsPointAttr().Set(true); @@ -931,7 +931,7 @@ bool Scene::Implementation::UpdateLights(const ignition::msgs::Light &_light, _light.diffuse().r(), _light.diffuse().g(), _light.diffuse().b()))); break; } - case ignition::msgs::Light::SPOT: + case gz::msgs::Light::SPOT: { auto diskLight = pxr::UsdLuxDiskLight::Define(*stage, sdfLightPath); this->entities[_light.id()] = diskLight.GetPrim(); @@ -940,7 +940,7 @@ bool Scene::Implementation::UpdateLights(const ignition::msgs::Light &_light, _light.diffuse().r(), _light.diffuse().g(), _light.diffuse().b()))); break; } - case ignition::msgs::Light::DIRECTIONAL: + case gz::msgs::Light::DIRECTIONAL: { auto directionalLight = pxr::UsdLuxDistantLight::Define(*stage, sdfLightPath); @@ -973,15 +973,15 @@ bool Scene::Implementation::UpdateLights(const ignition::msgs::Light &_light, bool Scene::Init() { bool result; - ignition::msgs::Empty req; - ignition::msgs::Scene ignScene; + gz::msgs::Empty req; + gz::msgs::Scene ignScene; if (!this->dataPtr->node.Request( "/world/" + this->dataPtr->worldName + "/scene/info", req, 5000, ignScene, result)) { ignwarn << "Error requesting scene info, make sure the world [" << this->dataPtr->worldName - << "] is available, ignition-omniverse will keep trying..." + << "] is available, gz-omniverse will keep trying..." << std::endl; if (!this->dataPtr->node.Request( "/world/" + this->dataPtr->worldName + "/scene/info", req, -1, @@ -1083,7 +1083,7 @@ void Scene::Save() { this->Stage()->Lock()->Save(); } ////////////////////////////////////////////////// /// \brief Function called each time a topic update is received. -void Scene::Implementation::CallbackPoses(const ignition::msgs::Pose_V &_msg) +void Scene::Implementation::CallbackPoses(const gz::msgs::Pose_V &_msg) { for (const auto &poseMsg : _msg.pose()) { @@ -1106,7 +1106,7 @@ void Scene::Implementation::CallbackPoses(const ignition::msgs::Pose_V &_msg) ////////////////////////////////////////////////// /// \brief Function called each time a topic update is received. -void Scene::Implementation::CallbackJoint(const ignition::msgs::Model &_msg) +void Scene::Implementation::CallbackJoint(const gz::msgs::Model &_msg) { // this->UpdateModel(_msg); for (const auto &joint : _msg.joint()) @@ -1120,14 +1120,14 @@ void Scene::Implementation::CallbackJoint(const ignition::msgs::Model &_msg) } ////////////////////////////////////////////////// -void Scene::Implementation::CallbackScene(const ignition::msgs::Scene &_scene) +void Scene::Implementation::CallbackScene(const gz::msgs::Scene &_scene) { this->UpdateScene(_scene); } ////////////////////////////////////////////////// void Scene::Implementation::CallbackSceneDeletion( - const ignition::msgs::UInt32_V &_msg) + const gz::msgs::UInt32_V &_msg) { for (const auto id : _msg.data()) { @@ -1149,4 +1149,4 @@ void Scene::Implementation::CallbackSceneDeletion( } } } // namespace omniverse -} // namespace ignition +} // namespace gz diff --git a/source/ignition_live/Scene.hpp b/source/gazebo_live/Scene.hpp similarity index 73% rename from source/ignition_live/Scene.hpp rename to source/gazebo_live/Scene.hpp index cd231b0..4b0bcf3 100644 --- a/source/ignition_live/Scene.hpp +++ b/source/gazebo_live/Scene.hpp @@ -14,24 +14,24 @@ * */ -#ifndef IGNITION_OMNIVERSE_SCENE_HPP -#define IGNITION_OMNIVERSE_SCENE_HPP +#ifndef GZ_OMNIVERSE_SCENE_HPP +#define GZ_OMNIVERSE_SCENE_HPP #include "Error.hpp" #include "ThreadSafe.hpp" -#include +#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -48,12 +48,12 @@ #include #include -namespace ignition +namespace gz { namespace omniverse { -enum class Simulator : int { Ignition, IsaacSim }; +enum class Simulator : int { gz, IsaacSim }; class Scene { @@ -78,6 +78,6 @@ class Scene IGN_UTILS_UNIQUE_IMPL_PTR(dataPtr) }; } // namespace omniverse -} // namespace ignition +} // namespace gz #endif diff --git a/source/ignition_live/SetOp.hpp b/source/gazebo_live/SetOp.hpp similarity index 91% rename from source/ignition_live/SetOp.hpp rename to source/gazebo_live/SetOp.hpp index 21f06d1..4732350 100644 --- a/source/ignition_live/SetOp.hpp +++ b/source/gazebo_live/SetOp.hpp @@ -15,13 +15,13 @@ * */ -#ifndef IGNITION_OMNIVERSE_SET_OP_HPP -#define IGNITION_OMNIVERSE_SET_OP_HPP +#ifndef GZ_OMNIVERSE_SET_OP_HPP +#define GZ_OMNIVERSE_SET_OP_HPP #include #include -namespace ignition +namespace gz { namespace omniverse { @@ -45,6 +45,6 @@ class SetOp } }; } // namespace omniverse -} // namespace ignition +} // namespace gz #endif diff --git a/source/ignition_live/ThreadSafe.hpp b/source/gazebo_live/ThreadSafe.hpp similarity index 93% rename from source/ignition_live/ThreadSafe.hpp rename to source/gazebo_live/ThreadSafe.hpp index 81898f7..600b337 100644 --- a/source/ignition_live/ThreadSafe.hpp +++ b/source/gazebo_live/ThreadSafe.hpp @@ -15,12 +15,12 @@ * */ -#ifndef IGNITION_OMNIVERSE_THREADSAFE_HPP -#define IGNITION_OMNIVERSE_THREADSAFE_HPP +#ifndef GZ_OMNIVERSE_THREADSAFE_HPP +#define GZ_OMNIVERSE_THREADSAFE_HPP #include -namespace ignition::omniverse +namespace gz::omniverse { /// \brief Make an object threadsafe by locking it behind a mutex. @@ -100,6 +100,6 @@ typename ThreadSafe::Ref ThreadSafe::Lock() return Ref(this->data, this->mutex); } -} // namespace ignition::omniverse +} // namespace gz::omniverse #endif diff --git a/source/ignition_live/main.cpp b/source/gazebo_live/main.cpp similarity index 77% rename from source/ignition_live/main.cpp rename to source/gazebo_live/main.cpp index 134f4ed..c8fa4bd 100644 --- a/source/ignition_live/main.cpp +++ b/source/gazebo_live/main.cpp @@ -21,11 +21,11 @@ #include "SetOp.hpp" #include "ThreadSafe.hpp" -#include -#include -#include +#include +#include +#include -#include +#include #include #include @@ -33,43 +33,43 @@ #include -using namespace ignition::omniverse; +using namespace gz::omniverse; constexpr double kTargetFps = 60; constexpr std::chrono::duration kUpdateRate(1 / kTargetFps); int main(int argc, char* argv[]) { - CLI::App app("Ignition omniverse connector"); + CLI::App app("gz omniverse connector"); std::string destinationPath; app.add_option("-p,--path", destinationPath, // clang-format off - "Location of the omniverse stage. e.g. \"omniverse://localhost/Users/ignition/stage.usd\"") + "Location of the omniverse stage. e.g. \"omniverse://localhost/Users/gz/stage.usd\"") // clang-format on ->required(); std::string worldName; - ignition::omniverse::Simulator simulatorPoses{ - ignition::omniverse::Simulator::Ignition}; - app.add_option("-w,--world", worldName, "Name of the ignition world") + gz::omniverse::Simulator simulatorPoses{ + gz::omniverse::Simulator::gz}; + app.add_option("-w,--world", worldName, "Name of the gz world") ->required(); - std::map map{ - {"ignition", ignition::omniverse::Simulator::Ignition}, - {"isaacsim", ignition::omniverse::Simulator::IsaacSim}}; + std::map map{ + {"gz", gz::omniverse::Simulator::gz}, + {"isaacsim", gz::omniverse::Simulator::IsaacSim}}; app.add_option("--pose", simulatorPoses, "Which simulator will handle the poses") ->required() ->transform(CLI::CheckedTransformer(map, CLI::ignore_case));; app.add_flag_callback("-v,--verbose", - []() { ignition::common::Console::SetVerbosity(4); }); + []() { gz::common::Console::SetVerbosity(4); }); CLI11_PARSE(app, argc, argv); std::string ignGazeboResourcePath; - auto systemPaths = ignition::common::systemPaths(); - ignition::common::env("IGN_GAZEBO_RESOURCE_PATH", ignGazeboResourcePath); + auto systemPaths = gz::common::systemPaths(); + gz::common::env("IGN_GAZEBO_RESOURCE_PATH", ignGazeboResourcePath); for (const auto& resourcePath : - ignition::common::Split(ignGazeboResourcePath, ':')) + gz::common::Split(ignGazeboResourcePath, ':')) { systemPaths->AddFilePaths(resourcePath); } diff --git a/tools/buildscripts/pre_build_copies.json b/tools/buildscripts/pre_build_copies.json deleted file mode 100644 index af4293b..0000000 --- a/tools/buildscripts/pre_build_copies.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "linux-x86_64": { - "_build/target-deps/nv_usd/debug/lib/**/*.*" : "_build/linux-x86_64/debug", - "_build/target-deps/nv_usd/release/lib/**/*.*" : "_build/linux-x86_64/release", - "_build/target-deps/omni_client_library/debug/**/*.*" : "_build/linux-x86_64/debug", - "_build/target-deps/omni_client_library/release/**/*.*" : "_build/linux-x86_64/release", - "_build/target-deps/python/lib/*.*" : "_build/linux-x86_64/release" - }, - "windows-x86_64": { - "_build/target-deps/nv_usd/debug/lib/**/*.*" : "_build/windows-x86_64/debug", - "_build/target-deps/nv_usd/release/lib/**/*.*" : "_build/windows-x86_64/release", - "_build/target-deps/omni_client_library/debug/**/*.*" : "_build/windows-x86_64/debug", - "_build/target-deps/omni_client_library/release/**/*.*" : "_build/windows-x86_64/release", - "_build/host-deps/vc/bin/HostX64/x64/vcruntime*.*" : "_build/windows-x86_64/release" - } -} \ No newline at end of file diff --git a/tools/packman/bootstrap/configure.bat b/tools/packman/bootstrap/configure.bat index bc80cfd..8ad3cdd 100644 --- a/tools/packman/bootstrap/configure.bat +++ b/tools/packman/bootstrap/configure.bat @@ -1,4 +1,4 @@ -:: Copyright 2019 NVIDIA CORPORATION +:: Copyright 2019-2023 NVIDIA CORPORATION :: :: Licensed under the Apache License, Version 2.0 (the "License"); :: you may not use this file except in compliance with the License. @@ -12,7 +12,7 @@ :: See the License for the specific language governing permissions and :: limitations under the License. -set PM_PACKMAN_VERSION=6.32 +set PM_PACKMAN_VERSION=7.21.1 :: Specify where packman command is rooted set PM_INSTALL_PATH=%~dp0.. @@ -48,7 +48,7 @@ echo. :: that may be needed in the path :ENSURE_DIR if not exist "%PM_PACKAGES_ROOT%" ( - echo Creating directory %PM_PACKAGES_ROOT% + echo Creating packman packages cache at %PM_PACKAGES_ROOT% mkdir "%PM_PACKAGES_ROOT%" ) if %errorlevel% neq 0 ( goto ERROR_MKDIR_PACKAGES_ROOT ) @@ -59,7 +59,7 @@ if defined PM_PYTHON_EXT ( goto PACKMAN ) -set PM_PYTHON_VERSION=3.7.9-windows-x86_64 +set PM_PYTHON_VERSION=3.10.5-1-windows-x86_64 set PM_PYTHON_BASE_DIR=%PM_PACKAGES_ROOT%\python set PM_PYTHON_DIR=%PM_PYTHON_BASE_DIR%\%PM_PYTHON_VERSION% set PM_PYTHON=%PM_PYTHON_DIR%\python.exe @@ -70,7 +70,7 @@ if not exist "%PM_PYTHON_BASE_DIR%" call :CREATE_PYTHON_BASE_DIR set PM_PYTHON_PACKAGE=python@%PM_PYTHON_VERSION%.cab for /f "delims=" %%a in ('powershell -ExecutionPolicy ByPass -NoLogo -NoProfile -File "%~dp0\generate_temp_file_name.ps1"') do set TEMP_FILE_NAME=%%a set TARGET=%TEMP_FILE_NAME%.zip -call "%~dp0fetch_file_from_s3.cmd" %PM_PYTHON_PACKAGE% "%TARGET%" +call "%~dp0fetch_file_from_packman_bootstrap.cmd" %PM_PYTHON_PACKAGE% "%TARGET%" if %errorlevel% neq 0 ( echo !!! Error fetching python from CDN !!! goto ERROR @@ -95,11 +95,16 @@ if exist "%PM_PYTHON%" ( if exist "%PM_PYTHON_DIR%" ( rd /s /q "%PM_PYTHON_DIR%" > nul ) ) -:: Perform atomic rename -rename "%TEMP_FOLDER_NAME%" "%PM_PYTHON_VERSION%" 1> nul -:: Failure during move, need to clean up and abort +:: Perform atomic move (allowing overwrite, /y) +move /y "%TEMP_FOLDER_NAME%" "%PM_PYTHON_DIR%" 1> nul +:: Verify that python.exe is now where we expect +if exist "%PM_PYTHON%" goto PACKMAN + +:: Wait a second and try again (can help with access denied weirdness) +timeout /t 1 /nobreak 1> nul +move /y "%TEMP_FOLDER_NAME%" "%PM_PYTHON_DIR%" 1> nul if %errorlevel% neq 0 ( - echo !!! Error renaming python !!! + echo !!! Error moving python %TEMP_FOLDER_NAME% -> %PM_PYTHON_DIR% !!! call :CLEAN_UP_TEMP_FOLDER goto ERROR ) @@ -112,14 +117,17 @@ if defined PM_MODULE_DIR_EXT ( set PM_MODULE_DIR=%PM_PACKAGES_ROOT%\packman-common\%PM_PACKMAN_VERSION% ) -set PM_MODULE=%PM_MODULE_DIR%\packman.py +set PM_MODULE=%PM_MODULE_DIR%\run.py -if exist "%PM_MODULE%" goto ENSURE_7ZA +if exist "%PM_MODULE%" goto END + +:: Clean out broken PM_MODULE_DIR if it exists +if exist "%PM_MODULE_DIR%" ( rd /s /q "%PM_MODULE_DIR%" > nul ) set PM_MODULE_PACKAGE=packman-common@%PM_PACKMAN_VERSION%.zip for /f "delims=" %%a in ('powershell -ExecutionPolicy ByPass -NoLogo -NoProfile -File "%~dp0\generate_temp_file_name.ps1"') do set TEMP_FILE_NAME=%%a set TARGET=%TEMP_FILE_NAME% -call "%~dp0fetch_file_from_s3.cmd" %PM_MODULE_PACKAGE% "%TARGET%" +call "%~dp0fetch_file_from_packman_bootstrap.cmd" %PM_MODULE_PACKAGE% "%TARGET%" if %errorlevel% neq 0 ( echo !!! Error fetching packman from CDN !!! goto ERROR @@ -134,19 +142,6 @@ if %errorlevel% neq 0 ( del "%TARGET%" -:ENSURE_7ZA -set PM_7Za_VERSION=16.02.4 -set PM_7Za_PATH=%PM_PACKAGES_ROOT%\7za\%PM_7ZA_VERSION% -if exist "%PM_7Za_PATH%" goto END -set PM_7Za_PATH=%PM_PACKAGES_ROOT%\chk\7za\%PM_7ZA_VERSION% -if exist "%PM_7Za_PATH%" goto END - -"%PM_PYTHON%" -S -s -u -E "%PM_MODULE%" pull "%PM_MODULE_DIR%\deps.packman.xml" -if %errorlevel% neq 0 ( - echo !!! Error fetching packman dependencies !!! - goto ERROR -) - goto END :ERROR_MKDIR_PACKAGES_ROOT diff --git a/tools/packman/bootstrap/download_file_from_url.ps1 b/tools/packman/bootstrap/download_file_from_url.ps1 new file mode 100644 index 0000000..df55745 --- /dev/null +++ b/tools/packman/bootstrap/download_file_from_url.ps1 @@ -0,0 +1,53 @@ +<# +Copyright 2019 NVIDIA CORPORATION + +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 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +#> + +param( +[Parameter(Mandatory=$true)][string]$source=$null, +[string]$output="out.exe" +) +$filename = $output + +$triesLeft = 4 +$delay = 2 +do +{ + $triesLeft -= 1 + + try + { + Write-Host "Downloading from bootstrap.packman.nvidia.com ..." + $wc = New-Object net.webclient + $wc.Downloadfile($source, $fileName) + exit 0 + } + catch + { + Write-Host "Error downloading $source!" + Write-Host $_.Exception|format-list -force + if ($triesLeft) + { + Write-Host "Retrying in $delay seconds ..." + Start-Sleep -seconds $delay + } + $delay = $delay * $delay + } +} while ($triesLeft -gt 0) +# We only get here if the retries have been exhausted, remove any left-overs: +if (Test-Path $fileName) +{ + Remove-Item $fileName +} +exit 1 \ No newline at end of file diff --git a/tools/packman/bootstrap/fetch_file_from_s3.cmd b/tools/packman/bootstrap/fetch_file_from_packman_bootstrap.cmd similarity index 85% rename from tools/packman/bootstrap/fetch_file_from_s3.cmd rename to tools/packman/bootstrap/fetch_file_from_packman_bootstrap.cmd index cce5773..6167f50 100644 --- a/tools/packman/bootstrap/fetch_file_from_s3.cmd +++ b/tools/packman/bootstrap/fetch_file_from_packman_bootstrap.cmd @@ -19,12 +19,11 @@ @echo Fetching %PACKAGE_NAME% ... -@powershell -ExecutionPolicy ByPass -NoLogo -NoProfile -File "%~dp0fetch_file_from_s3.ps1" -sourceName %PACKAGE_NAME% ^ - -output %TARGET_PATH% +@powershell -ExecutionPolicy ByPass -NoLogo -NoProfile -File "%~dp0download_file_from_url.ps1" ^ + -source "http://bootstrap.packman.nvidia.com/%PACKAGE_NAME%" -output %TARGET_PATH% :: A bug in powershell prevents the errorlevel code from being set when using the -File execution option -:: We must therefore do our own failure analysis, basically make sure the file exists and is larger than 0 bytes: +:: We must therefore do our own failure analysis, basically make sure the file exists: @if not exist %TARGET_PATH% goto ERROR_DOWNLOAD_FAILED -@if %~z2==0 goto ERROR_DOWNLOAD_FAILED @endlocal @exit /b 0 diff --git a/tools/packman/bootstrap/fetch_file_from_s3.ps1 b/tools/packman/bootstrap/fetch_file_from_s3.ps1 deleted file mode 100644 index be8ec2b..0000000 --- a/tools/packman/bootstrap/fetch_file_from_s3.ps1 +++ /dev/null @@ -1,220 +0,0 @@ -<# -Copyright 2019 NVIDIA CORPORATION - -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 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -#> - -param( -[Parameter(Mandatory=$true)][string]$sourceName=$null, -[string]$output="out.exe" -) -$source = "http://bootstrap.packman.nvidia.com/" + $sourceName -$filename = $output - -$triesLeft = 3 - -do -{ - $triesLeft -= 1 - $req = [System.Net.httpwebrequest]::Create($source) - $req.cookiecontainer = New-Object System.net.CookieContainer - - try - { - Write-Host "Connecting to bootstrap.packman.nvidia.com ..." - $res = $req.GetResponse() - if($res.StatusCode -eq "OK") { - Write-Host "Downloading ..." - [int]$goal = $res.ContentLength - $reader = $res.GetResponseStream() - $writer = new-object System.IO.FileStream $fileName, "Create" - [byte[]]$buffer = new-object byte[] 4096 - [int]$total = [int]$count = 0 - do - { - $count = $reader.Read($buffer, 0, $buffer.Length); - $writer.Write($buffer, 0, $count); - $total += $count - if($goal -gt 0) { - Write-Progress "Downloading $url" "Saving $total of $goal" -id 0 -percentComplete (($total/$goal)*100) - } else { - Write-Progress "Downloading $url" "Saving $total bytes..." -id 0 - } - } while ($count -gt 0) - - $triesLeft = 0 - } - } - catch - { - Write-Host "Error downloading $source!" - Write-Host $_.Exception|format-list -force - } - finally - { - if ($reader) - { - $reader.Close() - } - if ($writer) - { - $writer.Flush() - $writer.Close() - } - } -} while ($triesLeft -gt 0) - - -# SIG # Begin signature block -# MIIaWAYJKoZIhvcNAQcCoIIaSTCCGkUCAQExDzANBglghkgBZQMEAgEFADB5Bgor -# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG -# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCBFTYFqTzmSEZEq -# MY4INqgJKB1EIJuRMWRZ9gC3y0+b66CCCiIwggTTMIIDu6ADAgECAhBi50XpIWUh -# PJcfXEkK6hKlMA0GCSqGSIb3DQEBCwUAMIGEMQswCQYDVQQGEwJVUzEdMBsGA1UE -# ChMUU3ltYW50ZWMgQ29ycG9yYXRpb24xHzAdBgNVBAsTFlN5bWFudGVjIFRydXN0 -# IE5ldHdvcmsxNTAzBgNVBAMTLFN5bWFudGVjIENsYXNzIDMgU0hBMjU2IENvZGUg -# U2lnbmluZyBDQSAtIEcyMB4XDTE4MDcwOTAwMDAwMFoXDTIxMDcwOTIzNTk1OVow -# gYMxCzAJBgNVBAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMRQwEgYDVQQHDAtT -# YW50YSBDbGFyYTEbMBkGA1UECgwSTlZJRElBIENvcnBvcmF0aW9uMQ8wDQYDVQQL -# DAZJVC1NSVMxGzAZBgNVBAMMEk5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rCW5/Sei+XhyU9P43co7JnB3tk106g5Cz89wbCRj8fwOOh -# CnqLQDzv77pbDMhaGCyy5XGUiCHz9ClDSLHofQ== -# SIG # End signature block diff --git a/tools/packman/bootstrap/fetch_file_from_url.ps1 b/tools/packman/bootstrap/fetch_file_from_url.ps1 deleted file mode 100644 index db30e82..0000000 --- a/tools/packman/bootstrap/fetch_file_from_url.ps1 +++ /dev/null @@ -1,197 +0,0 @@ -<# -Copyright 2019 NVIDIA CORPORATION - -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 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -#> - -param( -[Parameter(Mandatory=$true)][string]$sourceUrl=$null, -[Parameter(Mandatory=$true)][string]$output=$null -) -$source = $sourceUrl -$filename = $output - -$req = [System.Net.httpwebrequest]::Create($source) -$req.cookiecontainer = New-Object System.net.CookieContainer - -Write-Host "Connecting to $source ..." -$res = $req.GetResponse() - -if($res.StatusCode -eq "OK") { - Write-Host "Downloading ..." - [int]$goal = $res.ContentLength - $reader = $res.GetResponseStream() - $writer = new-object System.IO.FileStream $fileName, "Create" - [byte[]]$buffer = new-object byte[] 4096 - [int]$total = [int]$count = 0 - do - { - $count = $reader.Read($buffer, 0, $buffer.Length); - $writer.Write($buffer, 0, $count); - $total += $count - if($goal -gt 0) { - Write-Progress "Downloading $url" "Saving $total of $goal" -id 0 -percentComplete (($total/$goal)*100) - } else { - Write-Progress "Downloading $url" "Saving $total bytes..." -id 0 - } - } while ($count -gt 0) - - $reader.Close() - $writer.Flush() - $writer.Close() -} - - -# SIG # Begin signature block -# MIIaWAYJKoZIhvcNAQcCoIIaSTCCGkUCAQExDzANBglghkgBZQMEAgEFADB5Bgor -# BgEEAYI3AgEEoGswaTA0BgorBgEEA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EyIEFzc3VyZWQgSUQgVGltZXN0YW1waW5nIENBAhAN -# QkrgvjqI/2BAIc4UAPDdMA0GCWCGSAFlAwQCAQUAoIGYMBoGCSqGSIb3DQEJAzEN -# BgsqhkiG9w0BCRABBDAcBgkqhkiG9w0BCQUxDxcNMjEwNDA4MDkxMTA5WjArBgsq -# hkiG9w0BCRACDDEcMBowGDAWBBTh14Ko4ZG+72vKFpG1qrSUpiSb8zAvBgkqhkiG -# 9w0BCQQxIgQgcfHF4iLArMhGi0LIUSIfH7cPIAExUHs0yFqHkCt/71UwDQYJKoZI -# hvcNAQEBBQAEggEAVpbbBo26x/fMI7gFiMlpLg5VzPUjGgZADcCVv2xhDtfwGtkK -# ogIkJOA5MsBmeowG2P+nPdeoiNvZIPhCWR1x5oVevJDveOFiJWIie2nG3h13XkCE -# dcpIthL2b+6eCQeg5ezEPAHO6Hm2oUQ8X1Xh94Ybr6SJjiUHhBozVIyYIQsPCdiG -# G8UlNoOl2l0nRbRXxC3QscAtuHSgB4rvCshsnL0snOvZt8Pr0cPh+Hi3nlPC3SvG -# aZHSCS21lFU3lG/dGMKFhPirgBVk2o5iduMczC9tPZ+PQMwZkMeP1riC/E7LwmlD -# 59BsD3YO7j4qsN/M4D0krdJV3zWNp6A33uPMBQ== -# SIG # End signature block diff --git a/tools/packman/bootstrap/install_package.py b/tools/packman/bootstrap/install_package.py index 5b56a70..7ce9b96 100644 --- a/tools/packman/bootstrap/install_package.py +++ b/tools/packman/bootstrap/install_package.py @@ -16,42 +16,157 @@ import zipfile import tempfile import sys -import shutil +import os +import stat +import time +import hashlib +from typing import Any, Callable, Union + + +RENAME_RETRY_COUNT = 100 +RENAME_RETRY_DELAY = 0.1 -__author__ = "hfannar" logging.basicConfig(level=logging.WARNING, format="%(message)s") logger = logging.getLogger("install_package") -class TemporaryDirectory: - def __init__(self): - self.path = None +def remove_directory_item(path): + if os.path.islink(path) or os.path.isfile(path): + try: + os.remove(path) + except PermissionError: + # make sure we have access and try again: + os.chmod(path, stat.S_IRWXU) + os.remove(path) + else: + # try first to delete the dir because this will work for folder junctions, otherwise we would follow the junctions and cause destruction! + clean_out_folder = False + try: + # make sure we have access preemptively - this is necessary because recursing into a directory without permissions + # will only lead to heart ache + os.chmod(path, stat.S_IRWXU) + os.rmdir(path) + except OSError: + clean_out_folder = True + + if clean_out_folder: + # we should make sure the directory is empty + names = os.listdir(path) + for name in names: + fullname = os.path.join(path, name) + remove_directory_item(fullname) + # now try to again get rid of the folder - and not catch if it raises: + os.rmdir(path) + + +class StagingDirectory: + def __init__(self, staging_path): + self.staging_path = staging_path + self.temp_folder_path = None + os.makedirs(staging_path, exist_ok=True) def __enter__(self): - self.path = tempfile.mkdtemp() - return self.path + self.temp_folder_path = tempfile.mkdtemp(prefix="ver-", dir=self.staging_path) + return self + + def get_temp_folder_path(self): + return self.temp_folder_path + + # this function renames the temp staging folder to folder_name, it is required that the parent path exists! + def promote_and_rename(self, folder_name): + abs_dst_folder_name = os.path.join(self.staging_path, folder_name) + os.rename(self.temp_folder_path, abs_dst_folder_name) def __exit__(self, type, value, traceback): - # Remove temporary data created - shutil.rmtree(self.path) + # Remove temp staging folder if it's still there (something went wrong): + path = self.temp_folder_path + if os.path.isdir(path): + remove_directory_item(path) -def install_package(package_src_path, package_dst_path): - with zipfile.ZipFile( - package_src_path, allowZip64=True - ) as zip_file, TemporaryDirectory() as temp_dir: - zip_file.extractall(temp_dir) - # Recursively copy (temp_dir will be automatically cleaned up on exit) - try: - # Recursive copy is needed because both package name and version folder could be missing in - # target directory: - shutil.copytree(temp_dir, package_dst_path) - except OSError as exc: +def rename_folder(staging_dir: StagingDirectory, folder_name: str): + try: + staging_dir.promote_and_rename(folder_name) + except OSError as exc: + # if we failed to rename because the folder now exists we can assume that another packman process + # has managed to update the package before us - in all other cases we re-raise the exception + abs_dst_folder_name = os.path.join(staging_dir.staging_path, folder_name) + if os.path.exists(abs_dst_folder_name): logger.warning( - "Directory %s already present, packaged installation aborted" % package_dst_path + f"Directory {abs_dst_folder_name} already present, package installation already completed" ) else: - logger.info("Package successfully installed to %s" % package_dst_path) + raise + + +def call_with_retry( + op_name: str, func: Callable, retry_count: int = 3, retry_delay: float = 20 +) -> Any: + retries_left = retry_count + while True: + try: + return func() + except (OSError, IOError) as exc: + logger.warning(f"Failure while executing {op_name} [{str(exc)}]") + if retries_left: + retry_str = "retry" if retries_left == 1 else "retries" + logger.warning( + f"Retrying after {retry_delay} seconds" + f" ({retries_left} {retry_str} left) ..." + ) + time.sleep(retry_delay) + else: + logger.error("Maximum retries exceeded, giving up") + raise + retries_left -= 1 + + +def rename_folder_with_retry(staging_dir: StagingDirectory, folder_name): + dst_path = os.path.join(staging_dir.staging_path, folder_name) + call_with_retry( + f"rename {staging_dir.get_temp_folder_path()} -> {dst_path}", + lambda: rename_folder(staging_dir, folder_name), + RENAME_RETRY_COUNT, + RENAME_RETRY_DELAY, + ) + + +def generate_sha256_for_file(file_path: Union[str, os.PathLike]) -> str: + """Returns the SHA-256 hex digest for the file at `file_path`""" + hash = hashlib.sha256() + # Read the file in binary mode and update the hash object with data + with open(file_path, "rb") as file: + for chunk in iter(lambda: file.read(4096), b""): + hash.update(chunk) + return hash.hexdigest() + + +def install_common_module(package_path, install_path): + COMMON_SHA256 = "d4117f80ecc6dcc36444e04da85b125a4269f2abfe59a8984150138ad7d832c1" + package_sha256 = generate_sha256_for_file(package_path) + if package_sha256 != COMMON_SHA256: + raise RuntimeError( + f"Package at '{package_path}' must have a sha256 of '{COMMON_SHA256}' " + f"but was found to have '{package_sha256}'" + ) + staging_path, version = os.path.split(install_path) + with StagingDirectory(staging_path) as staging_dir: + output_folder = staging_dir.get_temp_folder_path() + with zipfile.ZipFile(package_path, allowZip64=True) as zip_file: + zip_file.extractall(output_folder) + + # attempt the rename operation + rename_folder_with_retry(staging_dir, version) + + print(f"Package successfully installed to {install_path}") -install_package(sys.argv[1], sys.argv[2]) +if __name__ == "__main__": + executable_paths = os.getenv("PATH") + paths_list = executable_paths.split(os.path.pathsep) if executable_paths else [] + target_path_np = os.path.normpath(sys.argv[2]) + target_path_np_nc = os.path.normcase(target_path_np) + for exec_path in paths_list: + if os.path.normcase(os.path.normpath(exec_path)) == target_path_np_nc: + raise RuntimeError(f"packman will not install to executable path '{exec_path}'") + install_common_module(sys.argv[1], target_path_np) diff --git a/tools/packman/config.packman.xml b/tools/packman/config.packman.xml index 61ce21e..24ca05d 100644 --- a/tools/packman/config.packman.xml +++ b/tools/packman/config.packman.xml @@ -1,4 +1,5 @@ - - + + + diff --git a/tools/packman/packman b/tools/packman/packman index 05aefb0..eb7e5ef 100755 --- a/tools/packman/packman +++ b/tools/packman/packman @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright 2019-2020 NVIDIA CORPORATION +# Copyright 2019-2023 NVIDIA CORPORATION # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -18,11 +18,13 @@ set -eu if echo ${PM_VERBOSITY-} | grep -i "debug" > /dev/null ; then set -x + PM_CURL_SILENT="" + PM_WGET_QUIET="" else PM_CURL_SILENT="-s -S" PM_WGET_QUIET="--quiet" fi -PM_PACKMAN_VERSION=6.32 +export PM_PACKMAN_VERSION=7.21.1 # This is necessary for newer macOS if [ `uname` == 'Darwin' ]; then @@ -30,33 +32,32 @@ if [ `uname` == 'Darwin' ]; then export LANG=en_US.UTF-8 fi -# Specify where packman command exists -export PM_INSTALL_PATH="$(realpath "$(dirname "${BASH_SOURCE}")")" - -add_packages_root_to_file() -{ - FILE_PATH=$1 - if [ -f "$FILE_PATH" ]; then - if ! grep -Fq "PM_PACKAGES_ROOT" $FILE_PATH ; then - echo "Adjusting $FILE_PATH" - echo -e "export PM_PACKAGES_ROOT=\$HOME/packman-repo\n" >> $FILE_PATH - fi - fi +# We cannot rely on realpath, it isn't installed on macOS and some Linux distros +get_abs_filename() { + echo "$(cd "$(dirname "$1")" && pwd)/$(basename "$1")" } +# Specify where packman command exists +export PM_INSTALL_PATH="$(get_abs_filename "$(dirname "${BASH_SOURCE}")")" + # The packages root may already be configured by the user if [ -z "${PM_PACKAGES_ROOT:-}" ]; then - # Set variable permanently using .profile for this user (if exists) - add_packages_root_to_file ~/.profile - add_packages_root_to_file ~/.bashrc # Set variable temporarily in this process so that the following execution will work - export PM_PACKAGES_ROOT="${HOME}/packman-repo" + if [ `uname` == 'Darwin' ]; then + export PM_PACKAGES_ROOT="${HOME}/Library/Application Support/packman-cache" + else + if [ -z "${XDG_CACHE_HOME:-}" ]; then + export PM_PACKAGES_ROOT="${HOME}/.cache/packman" + else + export PM_PACKAGES_ROOT="${XDG_CACHE_HOME}/packman" + fi + fi fi # Ensure the packages root path exists: if [ ! -d "$PM_PACKAGES_ROOT" ]; then - echo "Creating packman packages repository at $PM_PACKAGES_ROOT" - mkdir -p "$PM_PACKAGES_ROOT" + echo "Creating packman packages cache at $PM_PACKAGES_ROOT" + mkdir -p -m a+rwx "$PM_PACKAGES_ROOT" fi fetch_file_from_s3() @@ -72,18 +73,28 @@ fetch_file_from_s3() fi } +generate_temp_file_name() +{ + if [ `uname` == "Darwin" ]; then + local tmpfile=`mktemp -t packman` + else + local tmpfile=`mktemp -t packman.XXXXXXXX` + fi + echo "$tmpfile" +} + install_python() { PLATFORM=`uname` PROCESSOR=`uname -m` - PYTHON_VERSION=3.7.9 + PYTHON_VERSION=3.10.5-1 if [ $PLATFORM == 'Darwin' ]; then PYTHON_PACKAGE=$PYTHON_VERSION-macos-x86_64 elif [ $PLATFORM == 'Linux' ] && [ $PROCESSOR == 'x86_64' ]; then PYTHON_PACKAGE=$PYTHON_VERSION-linux-x86_64 elif [ $PLATFORM == 'Linux' ] && [ $PROCESSOR == 'aarch64' ]; then - PYTHON_PACKAGE=$PYTHON_VERSION-177-linux-aarch64 + PYTHON_PACKAGE=$PYTHON_VERSION-linux-aarch64 else echo "Operating system not supported" exit 1 @@ -97,10 +108,12 @@ install_python() export PM_PYTHON="$PYTHON_INSTALL_FOLDER/python" if [ ! -f "$PM_PYTHON" ]; then - fetch_file_from_s3 "python@$PYTHON_PACKAGE.tar.gz" "/tmp/python@$PYTHON_PACKAGE.tar.gz" + PYTHON_PACKAGE_TMP=$(generate_temp_file_name) + fetch_file_from_s3 "python@$PYTHON_PACKAGE.tar.gz" "$PYTHON_PACKAGE_TMP" if [ "$?" -eq "0" ]; then echo "Unpacking python" - tar -xf "/tmp/python@$PYTHON_PACKAGE.tar.gz" -C "$PYTHON_INSTALL_FOLDER" + tar -xf "$PYTHON_PACKAGE_TMP" -C "$PYTHON_INSTALL_FOLDER" + rm "$PYTHON_PACKAGE_TMP" else echo "Failed downloading the Python interpreter" exit $? @@ -121,38 +134,28 @@ if [ -z "${PM_MODULE_DIR_EXT:-}" ]; then else PM_MODULE_DIR="$PM_MODULE_DIR_EXT" fi -export PM_MODULE="$PM_MODULE_DIR/packman.py" +export PM_MODULE="$PM_MODULE_DIR/run.py" # Ensure the packman package exists: if [ ! -f "$PM_MODULE" ]; then + # Remove a previously corrupt packman-common if it's there + if [ -d "$PM_MODULE_DIR" ]; then + rm -rf "$PM_MODULE_DIR" + fi PM_MODULE_PACKAGE="packman-common@$PM_PACKMAN_VERSION.zip" - TARGET="/tmp/$PM_MODULE_PACKAGE" + TARGET=$(generate_temp_file_name) # We always fetch packman from S3: - fetch_file_from_s3 $PM_MODULE_PACKAGE $TARGET + fetch_file_from_s3 "$PM_MODULE_PACKAGE" "$TARGET" if [ "$?" -eq "0" ]; then echo "Unpacking ..." "$PM_PYTHON" -S -s -u -E "$PM_INSTALL_PATH/bootstrap/install_package.py" "$TARGET" "$PM_MODULE_DIR" - rm $TARGET + rm "$TARGET" else echo "Failure while fetching packman module from S3!" exit 1 fi fi -# Ensure 7za package exists: -PM_7za_VERSION=16.02.4 -export PM_7za_PATH="$PM_PACKAGES_ROOT/7za/$PM_7za_VERSION" -if [ ! -d "$PM_7za_PATH" ]; then - export PM_7za_PATH="$PM_PACKAGES_ROOT/chk/7za/$PM_7za_VERSION" - if [ ! -d "$PM_7za_PATH" ]; then - "$PM_PYTHON" -S -s -u -E "$PM_MODULE" pull "$PM_MODULE_DIR/deps.packman.xml" - if [ "$?" -ne 0 ]; then - echo "Failure while installing required 7za package" - exit 1 - fi - fi -fi - # Generate temporary file name for environment variables: PM_VAR_PATH=`mktemp -u -t tmp.$$.pmvars.XXXXXX` @@ -174,11 +177,6 @@ if [ -f "$PM_VAR_PATH" ]; then rm -f "$PM_VAR_PATH" fi -# Return the exit code from python -if [ "$exit_code" != 0 ]; then - exit "$exit_code" -fi - # avoid leaking -e and -u into the host script if they weren't originally set if [[ ! ( "$SAVED_SETTINGS" =~ e ) ]]; then set +e @@ -188,3 +186,7 @@ if [[ ! ( "$SAVED_SETTINGS" =~ u ) ]]; then set +u fi +# Return the exit code from python +if [ "$exit_code" != 0 ]; then + exit "$exit_code" +fi diff --git a/tools/packman/packman.cmd b/tools/packman/packman.cmd index f4d139a..b49e6fd 100644 --- a/tools/packman/packman.cmd +++ b/tools/packman/packman.cmd @@ -1,23 +1,22 @@ -:: Reset errorlevel status (don't inherit from caller) [xxxxxxxxxxx] +:: RUN_PM_MODULE must always be at the same spot for packman update to work (batch reloads file during update!) +:: [xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx] +:: Reset errorlevel status (don't inherit from caller) @call :ECHO_AND_RESET_ERROR -:: You can remove the call below if you do your own manual configuration of the dev machines -call "%~dp0\bootstrap\configure.bat" +:: You can remove this section if you do your own manual configuration of the dev machines +call :CONFIGURE if %errorlevel% neq 0 ( exit /b %errorlevel% ) + :: Everything below is mandatory if not defined PM_PYTHON goto :PYTHON_ENV_ERROR if not defined PM_MODULE goto :MODULE_ENV_ERROR -:: Generate temporary path for variable file -for /f "delims=" %%a in ('powershell -ExecutionPolicy ByPass -NoLogo -NoProfile ^ --File "%~dp0bootstrap\generate_temp_file_name.ps1"') do set PM_VAR_PATH=%%a +set PM_VAR_PATH_ARG= -if %1.==. ( - set PM_VAR_PATH_ARG= -) else ( - set PM_VAR_PATH_ARG=--var-path="%PM_VAR_PATH%" -) +if "%1"=="pull" goto :SET_VAR_PATH +if "%1"=="install" goto :SET_VAR_PATH +:RUN_PM_MODULE "%PM_PYTHON%" -S -s -u -E "%PM_MODULE%" %* %PM_VAR_PATH_ARG% if %errorlevel% neq 0 ( exit /b %errorlevel% ) @@ -48,9 +47,43 @@ exit /b 1 @echo Error while processing and setting environment variables! exit /b 1 +:: pad [xxxx] :ECHO_AND_RESET_ERROR @echo off if /I "%PM_VERBOSITY%"=="debug" ( @echo on ) exit /b 0 + +:SET_VAR_PATH +:: Generate temporary path for variable file +for /f "delims=" %%a in ('%PM_PYTHON% -S -s -u -E -c "import tempfile;file = tempfile.NamedTemporaryFile(mode='w+t', delete=False);print(file.name)"') do (set PM_VAR_PATH=%%a) +set PM_VAR_PATH_ARG=--var-path="%PM_VAR_PATH%" +goto :RUN_PM_MODULE + +:CONFIGURE +:: Must capture and set code page to work around issue #279, powershell invocation mutates console font +:: This issue only happens in Windows CMD shell when using 65001 code page. Some Git Bash implementations +:: don't support chcp so this workaround is a bit convoluted. +:: Test for chcp: +chcp > nul 2>&1 +if %errorlevel% equ 0 ( + for /f "tokens=2 delims=:" %%a in ('chcp') do (set PM_OLD_CODE_PAGE=%%a) +) else ( + call :ECHO_AND_RESET_ERROR +) +:: trim leading space (this is safe even when PM_OLD_CODE_PAGE has not been set) +set PM_OLD_CODE_PAGE=%PM_OLD_CODE_PAGE:~1% +if "%PM_OLD_CODE_PAGE%" equ "65001" ( + chcp 437 > nul + set PM_RESTORE_CODE_PAGE=1 +) +call "%~dp0\bootstrap\configure.bat" +set PM_CONFIG_ERRORLEVEL=%errorlevel% +if defined PM_RESTORE_CODE_PAGE ( + :: Restore code page + chcp %PM_OLD_CODE_PAGE% > nul +) +set PM_OLD_CODE_PAGE= +set PM_RESTORE_CODE_PAGE= +exit /b %PM_CONFIG_ERRORLEVEL% diff --git a/tools/packman/packmanconf.py b/tools/packman/packmanconf.py new file mode 100644 index 0000000..6afae51 --- /dev/null +++ b/tools/packman/packmanconf.py @@ -0,0 +1,112 @@ +# Use this file to bootstrap packman into your Python environment (3.7.x). Simply +# add the path by doing sys.insert to where packmanconf.py is located and then execute: +# +# >>> import packmanconf +# >>> packmanconf.init() +# +# It will use the configured remote(s) and the version of packman in the same folder, +# giving you full access to the packman API via the following module +# +# >> import packmanapi +# >> dir(packmanapi) + +import os +import platform +import sys + + +def init(): + """Call this function to initialize the packman configuration. + + Calls to the packman API will work after successfully calling this function. + + Note: + This function only needs to be called once during the execution of your + program. Calling it repeatedly is harmless but wasteful. + Compatibility with your Python interpreter is checked and upon failure + the function will report what is required. + + Example: + >>> import packmanconf + >>> packmanconf.init() + >>> import packmanapi + >>> packmanapi.set_verbosity_level(packmanapi.VERBOSITY_HIGH) + """ + major = sys.version_info.major + minor = sys.version_info.minor + patch = sys.version_info.micro + if major == 3 and (minor == 10 or (minor == 11 and patch <= 2)): + # we are good + pass + else: + raise RuntimeError( + f"This version of packman requires Python 3.10.0 up to 3.11.2, " + f"but {major}.{minor}.{patch} was provided" + ) + conf_dir = os.path.dirname(os.path.abspath(__file__)) + os.environ["PM_INSTALL_PATH"] = conf_dir + packages_root = get_packages_root(conf_dir) + version = get_version(conf_dir) + module_dir = get_module_dir(conf_dir, packages_root, version) + sys.path.insert(1, module_dir) + + +def get_packages_root(conf_dir: str) -> str: + root = os.getenv("PM_PACKAGES_ROOT") + if not root: + platform_name = platform.system() + if platform_name == "Windows": + drive, _ = os.path.splitdrive(conf_dir) + root = os.path.join(drive, "packman-repo") + elif platform_name == "Darwin": + # macOS + root = os.path.join( + os.path.expanduser("~"), "Library/Application Support/packman-cache" + ) + elif platform_name == "Linux": + try: + cache_root = os.environ["XDG_HOME_CACHE"] + except KeyError: + cache_root = os.path.join(os.path.expanduser("~"), ".cache") + return os.path.join(cache_root, "packman") + else: + raise RuntimeError(f"Unsupported platform '{platform_name}'") + # make sure the path exists: + os.makedirs(root, exist_ok=True) + return root + + +def get_module_dir(conf_dir, packages_root: str, version: str) -> str: + module_dir = os.path.join(packages_root, "packman-common", version) + if not os.path.exists(module_dir): + import tempfile + + tf = tempfile.NamedTemporaryFile(delete=False) + target_name = tf.name + tf.close() + url = f"http://bootstrap.packman.nvidia.com/packman-common@{version}.zip" + print(f"Downloading '{url}' ...") + import urllib.request + + urllib.request.urlretrieve(url, target_name) + from importlib.machinery import SourceFileLoader + + # import module from path provided + script_path = os.path.join(conf_dir, "bootstrap", "install_package.py") + ip = SourceFileLoader("install_package", script_path).load_module() + print("Unpacking ...") + ip.install_common_module(target_name, module_dir) + os.unlink(tf.name) + return module_dir + + +def get_version(conf_dir: str): + path = os.path.join(conf_dir, "packman") + if not os.path.exists(path): # in dev repo fallback + path += ".sh" + with open(path, "rt", encoding="utf8") as launch_file: + for line in launch_file.readlines(): + if "PM_PACKMAN_VERSION" in line: + _, value = line.split("=") + return value.strip() + raise RuntimeError(f"Unable to find 'PM_PACKMAN_VERSION' in '{path}'") diff --git a/tools/packman/python.bat b/tools/packman/python.bat index e5490a9..aecd569 100644 --- a/tools/packman/python.bat +++ b/tools/packman/python.bat @@ -13,9 +13,20 @@ :: limitations under the License. @echo off -setlocal +setlocal enableextensions call "%~dp0\packman" init set "PYTHONPATH=%PM_MODULE_DIR%;%PYTHONPATH%" -set PYTHONNOUSERSITE=1 -"%PM_PYTHON%" -u %* + +if not defined PYTHONNOUSERSITE ( + set PYTHONNOUSERSITE=1 +) + +REM For performance, default to unbuffered; however, allow overriding via +REM PYTHONUNBUFFERED=0 since PYTHONUNBUFFERED on windows can truncate output +REM when printing long strings +if not defined PYTHONUNBUFFERED ( + set PYTHONUNBUFFERED=1 +) + +"%PM_PYTHON%" %* \ No newline at end of file diff --git a/tools/packman/python.sh b/tools/packman/python.sh index 37c9f1b..74328bf 100755 --- a/tools/packman/python.sh +++ b/tools/packman/python.sh @@ -22,11 +22,21 @@ if [ ! -f "$PACKMAN_CMD" ]; then fi source "$PACKMAN_CMD" init export PYTHONPATH="${PM_MODULE_DIR}:${PYTHONPATH}" -export PYTHONNOUSERSITE=1 + +if [ -z "${PYTHONNOUSERSITE:-}" ]; then + export PYTHONNOUSERSITE=1 +fi + +# For performance, default to unbuffered; however, allow overriding via +# PYTHONUNBUFFERED=0 since PYTHONUNBUFFERED on windows can truncate output +# when printing long strings +if [ -z "${PYTHONUNBUFFERED:-}" ]; then + export PYTHONUNBUFFERED=1 +fi # workaround for our python not shipping with certs if [[ -z ${SSL_CERT_DIR:-} ]]; then export SSL_CERT_DIR=/etc/ssl/certs/ fi -"${PM_PYTHON}" -u "$@" +"${PM_PYTHON}" "$@" diff --git a/tools/repoman/build.py b/tools/repoman/build.py deleted file mode 100644 index 3b52be7..0000000 --- a/tools/repoman/build.py +++ /dev/null @@ -1,71 +0,0 @@ -import os -import sys -import argparse - -import repoman -import packmanapi - - -DEPS = { - "nvtools_build": { - "version": "0.3.2", - "link_path_host": "nvtools_build", - } -} - - -def run_command(): - platform_host = repoman.api.get_and_validate_host_platform(["windows-x86_64", "linux-x86_64"]) - repo_folders = repoman.api.get_repo_paths() - repoman.api.fetch_deps(DEPS, platform_host, repo_folders["host_deps"]) - - BUILD_SCRIPT = os.path.join(repo_folders["host_deps"], "nvtools_build", "build.py") - - # Fetch the asset dependencies - parser = argparse.ArgumentParser() - parser.add_argument('-p', '--platform-target', - dest='platform_target', required=False) - options, _ = parser.parse_known_args() - - # Checking if platform was passed - # We cannot use argparse's default, as we also need to set up the command line argument - # if it wasn't supplied. It is possible to also check for the host platform, if we want to - # make different default behavior when building on windows. - if not repoman.api.has_options_arg(options, 'platform_target'): - options.platform_target = 'linux-x86_64' - sys.argv.extend(["--platform-target", options.platform_target]) - - # We need the host-deps before we can run MSBuild - packmanapi.pull(os.path.join(repo_folders["root"], repo_folders["host_deps_xml"]), platform=platform_host) - - # Construct arguments for the underlying script - script_argv = sys.argv[1:] - script_argv.extend(["--root", repo_folders["root"]]) - script_argv.extend(["--deps-host", repo_folders["host_deps_xml"]]) - script_argv.extend(["--deps-target", repo_folders["target_deps_xml"]]) - if platform_host == "windows-x86_64": - script_argv.extend(["--premake-tool", os.path.join(repo_folders["host_deps"], "premake", "premake5.exe")]) - # Look for different MSBuild versions - ms_build_path = "" - ms_build_locations = [ - r"buildtools\MSBuild\15.0\Bin\MSBuild.exe", - r"buildtools\MSBuild\Current\Bin\MSBuild.exe", - ] - for ms_build_location in ms_build_locations: - print("Checking if MSBuild.exe located here: " + os.path.join(repo_folders["host_deps"], ms_build_location)) - if os.path.exists(os.path.join(repo_folders["host_deps"], ms_build_location)): - ms_build_path = os.path.join(repo_folders["host_deps"], ms_build_location) - break - print("Building using this MSBuild: " + ms_build_path) - script_argv.extend(["--msbuild-tool", ms_build_path]) - script_argv.extend(["--vs-version", "vs2019"]) - script_argv.extend(["--sln", os.path.join(repo_folders["compiler"], r"vs2019\Samples.sln")]) - elif platform_host == "linux-x86_64": - script_argv.extend(["--premake-tool", os.path.join(repo_folders["host_deps"], "premake", "premake5")]) - - # Execute module script and set globals - repoman.api.run_script_with_custom_args(BUILD_SCRIPT, script_argv) - - -if __name__ == "__main__" or __name__ == "__mp_main__": - run_command() diff --git a/tools/repoman/clean.py b/tools/repoman/clean.py deleted file mode 100644 index 9e3cf48..0000000 --- a/tools/repoman/clean.py +++ /dev/null @@ -1,26 +0,0 @@ -import os -import sys -import platform - - -def clean(): - folders = [ - '_build', - '_compiler', - '_builtpackages' - ] - for folder in folders: - # having to do the platform check because its safer when you might be removing - # folders with windows junctions. - if os.path.exists(folder): - print("Removing %s" % folder) - if platform.system() == 'Windows': - os.system("rmdir /q /s %s > nul 2>&1" % folder) - else: - os.system("rm -r -f %s > /dev/null 2>&1" % folder) - if os.path.exists(folder): - print("Warning: %s was not successfully removed, most probably due to a file lock on 1 or more of the files." % folder) - - -if __name__ == "__main__" or __name__ == "__mp_main__": - clean() diff --git a/tools/repoman/filecopy.py b/tools/repoman/filecopy.py deleted file mode 100644 index 27fb392..0000000 --- a/tools/repoman/filecopy.py +++ /dev/null @@ -1,31 +0,0 @@ -import os -import sys -import argparse - -import packmanapi -import repoman - -DEPS = { - "nvfilecopy": { - "version": "1.4", - "link_path_host": "nvtools_nvfilecopy", - } -} - - -if __name__ == "__main__" or __name__ == "__mp_main__": - repo_folders = repoman.api.get_repo_paths() - deps_folders = repoman.api.fetch_deps(DEPS, None, repo_folders["host_deps"]) - - sys.path.append(deps_folders["nvfilecopy"]) - import nvfilecopy - - parser = argparse.ArgumentParser() - parser.add_argument('-p', '--platform-target', dest='platform_target', required=True) - options, _ = parser.parse_known_args() - platform_target = repoman.api.validate_platform( - "target", - options.platform_target, - ["windows-x86_64", "linux-x86_64", "linux-aarch64"] - ) - nvfilecopy.process_json_file(sys.argv[len(sys.argv) - 1], platform_target) diff --git a/tools/repoman/findwindowsbuildtools.py b/tools/repoman/findwindowsbuildtools.py deleted file mode 100644 index 30b48a0..0000000 --- a/tools/repoman/findwindowsbuildtools.py +++ /dev/null @@ -1,190 +0,0 @@ -import os -import sys -import argparse -import subprocess -import json -from xml.etree import ElementTree - -import repoman -import packmanapi - - -DEPS = { - "nvtools_build": { - "version": "0.2.0", - "link_path_host": "nvtools_build", - } -} - -''' -buildtools: C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools -vc: ../_build/host-deps/buildtools/VC/Tools/MSVC/14.27.29110 -''' -def update_host_deps(host_deps_path:str, vs_path:str = "", msvc_ver:str = ""): - # Preserving comments in the XML host_deps file - # credit: https://stackoverflow.com/questions/33573807/faithfully-preserve-comments-in-parsed-xml - class CommentedTreeBuilder(ElementTree.TreeBuilder): - def comment(self, data): - self.start(ElementTree.Comment, {}) - self.data(data) - self.end(ElementTree.Comment) - - parser = ElementTree.XMLParser(target=CommentedTreeBuilder()) - # python 3.8 adds insert_comments - #parser = ElementTree.XMLParser(target=ElementTree.TreeBuilder(insert_comments=True)) - - vc_path = os.path.join("..", "_build", "host-deps", "buildtools", "VC", "Tools", "MSVC", msvc_ver) - - # Use winsdk.bat from Visual Studio tools to find the Windows SDK - windows_sdk_dir = "" - windows_sdk_ver = "" - windows_sdk_bin_dir = "" - windows_sdk_lib_dir = "" - windows_sdk_include_dir = "" - - winsdk_bat_path = os.path.join(vs_path, "Common7", "Tools", "vsdevcmd", "core", "winsdk.bat") - if os.path.exists(winsdk_bat_path): - # We have a batch wrapper that calls the winsdk.bat file and emits the important env vars to be processed - script_path = os.path.split(os.path.abspath(__file__))[0] - cmd_line = [] - cmd_line.append(os.path.join(script_path, "print_winsdk_env_vars.bat")) - cmd_line.append(winsdk_bat_path) - completed = subprocess.run(cmd_line, capture_output=True) - for line in completed.stdout.decode().splitlines(): - if "WindowsSDKDir" in line: - windows_sdk_dir = line.split("=")[1].rstrip("\\") - elif "WindowsSdkVersion" in line: - windows_sdk_ver = line.split("=")[1].rstrip("\\") - - if os.path.exists(windows_sdk_dir): - windows_sdk_bin_dir = os.path.join(windows_sdk_dir, "bin", windows_sdk_ver) - windows_sdk_include_dir = os.path.join(windows_sdk_dir, "include", windows_sdk_ver) - windows_sdk_lib_dir = os.path.join(windows_sdk_dir, "lib", windows_sdk_ver) - - # Read the XML tree from the host_deps file - tree = ElementTree.parse(host_deps_path, parser) - root = tree.getroot() - - # Replace the builtools and vc paths - find_replace_dict = { - "buildtools": vs_path, - "vc": vc_path, - "winsdk": windows_sdk_dir, - "winsdk_bin": windows_sdk_bin_dir, - "winsdk_include": windows_sdk_include_dir, - "winsdk_lib": windows_sdk_lib_dir, - } - for dependency in root.findall("dependency"): - for find_key in find_replace_dict.keys(): - if "name" in dependency.attrib.keys() and find_key == dependency.attrib["name"] and find_replace_dict[find_key] != "": - for source in dependency.iter("source"): - source.attrib["path"] = find_replace_dict[find_key] - print("Updating <%s> attribute with <%s>" % (dependency.attrib["name"],source.attrib["path"])) - - tree.write(host_deps_path) - - -''' -find_vs will search through the display names of the installed Visual Studio versions and -return the installation path for the first one that matches the input string provided - -current display names: -* Visual Studio Community 2019 -* Visual Studio Professional 2019 -* Visual Studio Professional 2017 -''' -def find_vs(search_str:str, listall:bool = False) -> str: - program_files = os.getenv("ProgramFiles(x86)") - if not program_files: - print("ERROR: No Program Files (x86) directory found") - return None - vswhere_path = os.path.join(program_files, "Microsoft Visual Studio", "Installer", "vswhere.exe") - if not os.path.exists(vswhere_path): - print("ERROR: vswhere.exe is not found here, so no Visual Studio installations found: " + vswhere_path) - return None - - # Run vswhere with a json-formatted output - cmd_line = list() - cmd_line.append(vswhere_path) - cmd_line.append("-products") - cmd_line.append("*") - cmd_line.append("-format") - cmd_line.append("json") - - completed = subprocess.run(cmd_line, capture_output=True) - version_strings = completed.stdout.decode() - version_json = json.loads(version_strings) - - # Find the requested version using the displayName attribute - last_version = None - for vs_version in version_json: - if listall: - print(vs_version["displayName"]) - last_version = vs_version["installationPath"] - elif search_str in vs_version["displayName"]: - return vs_version["installationPath"] - - return last_version - - -''' -find_msvc_ver will list the first MSVC version found in a Visual Studio installation -vs_install_path = "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community" -returns something like "14.25.28610" -''' -def find_msvc_ver(vs_install_path:str) -> str: - # return first folder found in "VC/Tools/MSVC" - msvc_folder = os.path.join(vs_install_path, "VC", "Tools", "MSVC") - if not os.path.exists(msvc_folder): - print("ERROR: No MSVC folder found at " + msvc_folder) - return None - - msvc_vers = os.listdir(msvc_folder) - if len(msvc_vers) > 0: - return msvc_vers[0] - else: - print("ERROR: No MSVC folder found at " + msvc_folder) - return None - -def run_command(): - parser = argparse.ArgumentParser() - parser.add_argument('-v', - '--visual-studio-version', - default='2019', - dest='vs_ver', - help='Different Visual Studio installation \"displayNames\" will be searched with this substring', - required=False) - parser.add_argument('-l', - '--list-all', - dest='list_all', - action='store_true', - help="Enable this to simply just list all Visual Studio installations rather than updating the host_deps file", - required=False) - parser.add_argument('-d', - '--host-deps-path', - dest='host_deps_path', - help="The path to the host_deps.packman.xml file", - required=False) - args, _ = parser.parse_known_args() - - if not args.list_all: - print("Searching for an install of Visual Studio <%s>" % (args.vs_ver)) - - vs_path = find_vs(args.vs_ver, args.list_all) - if not vs_path: - print("ERROR: No Visual Studio Installation Found") - exit(1) - - if not args.list_all and vs_path: - print("VS " + args.vs_ver + " found in: " + vs_path) - - msvc_version = find_msvc_ver(vs_path) - if msvc_version: - print("VS " + args.vs_ver + " MSVC ver: " + msvc_version) - - if args.host_deps_path and vs_path and msvc_version: - update_host_deps(args.host_deps_path, vs_path = vs_path, msvc_ver = msvc_version) - print("Update host dependencies file: " + args.host_deps_path) - -if __name__ == "__main__" or __name__ == "__mp_main__": - run_command() diff --git a/tools/repoman/package.py b/tools/repoman/package.py deleted file mode 100644 index b8ab399..0000000 --- a/tools/repoman/package.py +++ /dev/null @@ -1,25 +0,0 @@ -import os -import sys -import packmanapi - -packagemaker_path = packmanapi.install("packagemaker", package_version="4.0.0-rc9", link_path='_packages/packagemaker') -sys.path.append('_packages/packagemaker') - -import packagemaker - - -def main(): - pkg = packagemaker.PackageDesc() - pkg.version = os.getenv('BUILD_NUMBER', '0') - pkg.output_folder = '_unsignedpackages' - pkg.name = 'samples' - pkg.files = [ - ('_build/windows-x86_64/release/*.exe'), - ('_build/windows-x86_64/release/*.dll'), - ] - - packagemaker.package(pkg) - - -if __name__ == '__main__' or __name__ == '__mp_main__': - main() diff --git a/tools/repoman/print_winsdk_env_vars.bat b/tools/repoman/print_winsdk_env_vars.bat deleted file mode 100644 index 2f0dbfb..0000000 --- a/tools/repoman/print_winsdk_env_vars.bat +++ /dev/null @@ -1,5 +0,0 @@ -@echo off -call %1 -::call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\Tools\vsdevcmd\core\winsdk.bat" -echo WindowsSDKDir=%WindowsSDKDir% -echo WindowsSdkVersion=%WindowsSdkVersion% \ No newline at end of file diff --git a/tools/repoman/repoman.py b/tools/repoman/repoman.py index 9ff786a..9d5f7d1 100644 --- a/tools/repoman/repoman.py +++ b/tools/repoman/repoman.py @@ -1,15 +1,37 @@ +# SPDX-FileCopyrightText: Copyright (c) 2019-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: MIT +# + +import contextlib +import io import os import sys import packmanapi -SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__)) -REPO_ROOT_DIR = os.path.join(SCRIPT_DIR, "..", "..") -HOST_DEPS_PATH = os.path.join(REPO_ROOT_DIR, "_build", "host-deps") +REPO_ROOT = os.path.join(os.path.dirname(os.path.realpath(__file__)), "../..") +REPO_DEPS_FILE = os.path.join(REPO_ROOT, "deps/repo-deps.packman.xml") + + +def bootstrap(): + """ + Bootstrap all omni.repo modules. + + Pull with packman from repo.packman.xml and add them all to python sys.path to enable importing. + """ + with contextlib.redirect_stdout(io.StringIO()): + deps = packmanapi.pull(REPO_DEPS_FILE) + + for dep_path in deps.values(): + if dep_path not in sys.path: + sys.path.append(dep_path) + + # Add this repo root, as we are repoman itself! + sys.path.append(REPO_ROOT) -repoman_link_path = os.path.abspath(os.path.join(HOST_DEPS_PATH, "nvtools_repoman")) -packmanapi.install("repo_repoman", package_version="0.1.1-beta2", link_path=repoman_link_path) +if __name__ == "__main__": + bootstrap() + import omni.repo.man -sys.path.append(repoman_link_path) -import api + omni.repo.man.main(REPO_ROOT) diff --git a/tools/vscode/settings.template.json b/tools/vscode/settings.template.json new file mode 100644 index 0000000..aa1a59c --- /dev/null +++ b/tools/vscode/settings.template.json @@ -0,0 +1,18 @@ +{ + "editor.rulers": [150], + "files.trimTrailingWhitespace": true, + "files.trimFinalNewlines": true, + "diffEditor.ignoreTrimWhitespace": false, + "python.analysis.extraPaths": [ + ], + "python.languageServer": "Pylance", + "python.formatting.provider": "black", + "python.formatting.blackArgs": ["--line-length", "150"], + "isort.args": ["--profile", "black"], + "python.linting.enabled": true, + "python.linting.pylintEnabled": false, + "flake8.args": [ + "--max-line-length=150", + "--ignore=F405" + ] +} diff --git a/tutorials/01_compile.md b/tutorials/01_compile.md index f77da47..7151933 100644 --- a/tutorials/01_compile.md +++ b/tutorials/01_compile.md @@ -1,6 +1,6 @@ # How to compile it -## Install Ignition +## Install Gazebo ```bash sudo apt update @@ -11,35 +11,35 @@ sudo apt-get update sudo apt-get install python3-vcstool python3-colcon-common-extensions sudo apt-get install git libfreeimage-dev -sudo apt-get install ignition-edifice +sudo apt-get install gz-harmonic ``` -For more information, see https://ignitionrobotics.org/docs/edifice/install_ubuntu_src. +For more information, see https://gazebosim.org/docs/harmonic/install_ubuntu_src. -# Compile ignition-omniverse +# Compile gz-omni -We need to compile some Ignition packages from source with a specific flag due the `omni-client` library. -To make this process simple we have created the [`ign-omni-meta` repository](https://github.com/ignitionrobotics/ign-omni-meta). +We need to compile some Gazebo packages from source with a specific flag due the `omni-client` library. +To make this process simple we have created the [`gz-omni-meta` repository](https://github.com/gazebosim/gz-omni-meta). To compile this libraries you should run: ```bash -mkdir -p ~/ign-omni/src -cd ~/ign-omni/src -git clone https://github.com/ignitionrobotics/ign-omni-meta -vcs import . < ign-omni-meta/repos.yaml +mkdir -p ~/gz-omni/src +cd ~/gz-omni/src +git clone https://github.com/gazebosim/gz-omni-meta +vcs import . < gz-omni-meta/repos.yaml cd protobuf -git -C . apply ../ign-omni-meta/protobuf-cmake.patch -cd ~/ign-omni +git -C . apply ../gz-omni-meta/protobuf-cmake.patch +cd ~/gz-omni colcon build --merge-install --event-handlers console_direct+ --packages-select protobuf -cp src/ign-omni-meta/colcon.meta . -colcon build --merge-install --event-handlers console_direct+ --packages-up-to ignition-omniverse1 +cp src/gz-omni-meta/colcon.meta . +colcon build --merge-install --event-handlers console_direct+ --packages-up-to gazebo-omniverse1 ``` You can ignore the following message: ```bash -WARNING:colcon.colcon_cmake.task.cmake.build:Could not run installation step for package 'ignition-omniverse1' because it has no 'install' target +WARNING:colcon.colcon_cmake.task.cmake.build:Could not run installation step for package 'gazebo-omniverse1' because it has no 'install' target ``` -**Note: There will be 2 builds of ignition, the default build when ignition-edifice is compiled from source, and a special build with pre cxx11 abi compiled as part of ignition-omniverse.** +**Note: There will be 2 builds of gazebo, the default build when gazebo-harmonic is compiled from source, and a special build with pre cxx11 abi compiled as part of gazebo-omniverse.** diff --git a/tutorials/02_quickstart.md b/tutorials/02_quickstart.md index f24c54c..b531f70 100644 --- a/tutorials/02_quickstart.md +++ b/tutorials/02_quickstart.md @@ -2,9 +2,9 @@ Please review this [tutorial](./01_compile.md) if you need to install ign-omni. -## Run Ignition +## Run gz -Run the `shapes.sdf` world in Ignition Gazebo. This should run in a separate terminal using your normal Ignition Gazebo installation. +Run the `shapes.sdf` world in gz Gazebo. This should run in a separate terminal using your normal gz Gazebo installation. ```bash ign gazebo -v 4 shapes.sdf @@ -14,8 +14,8 @@ ign gazebo -v 4 shapes.sdf If not already done so, install nvidia omniverse, isaac sim and omniverse nucleus, for more information, see https://www.nvidia.com/en-us/omniverse/. -### (Optional) Create ignition user in nucleus -When nucleus is first installed, it will prompt you to create a user. If the ignition user is not created at this time, it can be created later via the omniverse app. +### (Optional) Create gz user in nucleus +When nucleus is first installed, it will prompt you to create a user. If the gz user is not created at this time, it can be created later via the omniverse app. ![](omniverse-create-user.gif) @@ -25,7 +25,7 @@ Launch `IsaacSim` and activate the `live sync` ## Run the connector -**Note**: `ignition-omni` will be built under `src/ign-omni/_build`, this is because +**Note**: `gz-omni` will be built under `src/ign-omni/_build`, this is because it uses a custom build system by NVidia which is hard coded to put output in that directory. In this case you need to source the special workspace that we have created @@ -36,10 +36,10 @@ In a new terminal ```bash source ~/ign-omni/install/setup.bash cd ~/ign-omni/src/ign-omni -bash run_ignition_omni.sh -p omniverse://localhost/Users/ignition/shapes.usd -w shapes --pose ignition +bash run_gz_omni.sh -p omniverse://localhost/Users/gz/shapes.usd -w shapes --pose gz ``` -You may replace `ignition` with any user registered in nucleus. +You may replace `gz` with any user registered in nucleus. Open the `shapes.usd` in Isaac Sim and optionally enable live sync. diff --git a/tutorials/03_ROS_simulation.md b/tutorials/03_ROS_simulation.md index d76528a..9e0d16b 100644 --- a/tutorials/03_ROS_simulation.md +++ b/tutorials/03_ROS_simulation.md @@ -1,6 +1,6 @@ # Run a more complex simulation - + For example you can run the turtlebot3. Compile the code from this PR https://github.com/ROBOTIS-GIT/turtlebot3_simulations/pull/180 @@ -9,8 +9,8 @@ Use ROS 2 Galactic. ``` mkdir -p ~/turtlebot3_ws/src cd ~/turtlebot3_ws/src -git clone https://github.com/ahcorde/turtlebot3_simulations -b ahcorde/ignition_support -git clone https://github.com/ignitionrobotics/ign_ros2_control -b galactic +git clone https://github.com/ahcorde/turtlebot3_simulations -b ahcorde/gz_support +git clone https://github.com/gzrobotics/ign_ros2_control -b galactic rosdep install --from-paths ./ -i -y --rosdistro galactic ``` @@ -19,17 +19,17 @@ Compile it ```bash cd ~/turtlebot3_ws/ source /opt/ros/galactic/setup.sh -export IGNITION_VERSION=fortress +export GZ_VERSION=fortress colcon build --merge-install --event-handlers console_direct+ ``` -## Run Ignition +## Run gz -This should run in a separate terminal using your normal Ignition Gazebo installation. +This should run in a separate terminal using your normal gz Gazebo installation. ```bash source ~/turtlebot3_ws/install/setup.bash -TURTLEBOT3_MODEL=waffle ros2 launch turtlebot3_ignition ignition.launch.py +TURTLEBOT3_MODEL=waffle ros2 launch turtlebot3_gz gz.launch.py ``` ## Run IsaacSim @@ -40,11 +40,11 @@ Launch `IsaacSim` and activate the `live sync` ## Run the connector -Create this directory `omniverse://localhost/Users/ignition/` in the nucleus server and run the connector +Create this directory `omniverse://localhost/Users/gz/` in the nucleus server and run the connector ```bash export IGN_GAZEBO_RESOURCE_PATH="~/turtlebot3_ws/src/turtlebot3_simulations/turtlebot3_gazebo/models:/opt/ros/galactic/share" -reset && bash run_ignition_omni.sh -p omniverse://localhost/Users/ignition/turtlebot3.usd -w empty -v --pose ignition +reset && bash run_gz_omni.sh -p omniverse://localhost/Users/gz/turtlebot3.usd -w empty -v --pose gz ``` ![](turtlebot3.gif) diff --git a/tutorials/04_articulated_arm_issacsim_to_ignition.md b/tutorials/04_articulated_arm_issacsim_to_ignition.md index 8206c54..b25cc43 100644 --- a/tutorials/04_articulated_arm_issacsim_to_ignition.md +++ b/tutorials/04_articulated_arm_issacsim_to_ignition.md @@ -1,10 +1,10 @@ -# Articulated arm connection from Isaac Sim to Ignition +# Articulated arm connection from Isaac Sim to gz -In this tutorial we well explain how to use the connector from Issac Sim to Ignition +In this tutorial we well explain how to use the connector from Issac Sim to gz ## Prerequisites - sdformat with USD support (see the [sdformat installation instructions](http://sdformat.org/tutorials?tut=install)) - - Ignition fuel tools cli command (see the [ign fuel tools installation instructions](https://ignitionrobotics.org/api/fuel_tools/7.0/install.html)) + - gz fuel tools cli command (see the [ign fuel tools installation instructions](https://gzrobotics.org/api/fuel_tools/7.0/install.html)) - ign-omni Connector (see the [compile instructions](01_compile.md)) - Omniverse Issac Sim - ros_ign_bridge @@ -25,7 +25,7 @@ Positionals: Options: -h,--help Print this help message and exit --help-all Show all help - --version + --version ``` - Convert the Panda Franka Emika robot to USD. Create the following file `panda.sdf`: @@ -46,21 +46,21 @@ Options: + filename="gz-gazebo-physics-system" + name="gz::gazebo::systems::Physics"> + filename="gz-gazebo-sensors-system" + name="gz::gazebo::systems::Sensors"> ogre2 + filename="gz-gazebo-user-commands-system" + name="gz::gazebo::systems::UserCommands"> + filename="gz-gazebo-scene-broadcaster-system" + name="gz::gazebo::systems::SceneBroadcaster"> @@ -79,7 +79,7 @@ Options: panda 0 0 0 0 0 0 - https://fuel.ignitionrobotics.org/1.0/OpenRobotics/models/Panda with Ignition position controller model + https://fuel.gzrobotics.org/1.0/OpenRobotics/models/Panda with gz position controller model true @@ -113,7 +113,7 @@ Options: - Download the panda model from fuel: ```bash -ign fuel download --url "https://fuel.ignitionrobotics.org/1.0/OpenRobotics/models/Panda with Ignition position controller model" +ign fuel download --url "https://fuel.gzrobotics.org/1.0/OpenRobotics/models/Panda with gz position controller model" ``` - Run the converter: @@ -121,7 +121,7 @@ ign fuel download --url "https://fuel.ignitionrobotics.org/1.0/OpenRobotics/mod sdf2usd /panda.sdf panda.usd ``` - - Copy the file in this path `omniverse://localhost/Users/ignition/panda.usd`: + - Copy the file in this path `omniverse://localhost/Users/gz/panda.usd`: ![](live_sync.gif) - Load the model in Issac Sim and activate the `live sync` @@ -132,7 +132,7 @@ sdf2usd /panda.sdf panda.usd - Add ROS joint state - Configure *articulationPrim* to `/fuel/panda` - - Launch the simulation in Ignition Gazebo: + - Launch the simulation in gz Gazebo: ```bash ign gazebo panda.sdf -v 4 -r ``` @@ -141,12 +141,12 @@ ign gazebo panda.sdf -v 4 -r ```bash source ~/ign-omni/install/setup.bash cd ~/ign-omni/src/ign-omni -bash run_ignition_omni.sh -p omniverse://localhost/Users/ignition/panda.usd -w fuel --pose ignition +bash run_gz_omni.sh -p omniverse://localhost/Users/gz/panda.usd -w fuel --pose gz ``` - - Right now Issac Sim does not provide the joint angle, but this data is provided in ROS. You should launch a ROS -> Ignition bridge: + - Right now Issac Sim does not provide the joint angle, but this data is provided in ROS. You should launch a ROS -> gz bridge: ```bash -rosrun ros_ign_bridge parameter_bridge /joint_states@sensor_msgs/JointState]ignition.msgs.Model +rosrun ros_ign_bridge parameter_bridge /joint_states@sensor_msgs/JointState]gz.msgs.Model ``` - Then you can move the robot. There is a workspace available here `.local/share/ov/pkg/isaac_sim-2021.2.1/ros_workspace/` that you need to compile it and run: diff --git a/tutorials/05_hybrid_simulation.md b/tutorials/05_hybrid_simulation.md index 2562a86..f95dab0 100644 --- a/tutorials/05_hybrid_simulation.md +++ b/tutorials/05_hybrid_simulation.md @@ -1,12 +1,12 @@ # Hybrid simulation -This demo explains how to use the hybrid simulation. The concept of Hybrid simulation is defined as: *A user can separate their simulation workload between Ignition -and Isaac Sim, with both systems running in parallel. For example, sensors can be handled by Isaac Sim, with rendering handled by Ignition, or vice versa.* +This demo explains how to use the hybrid simulation. The concept of Hybrid simulation is defined as: *A user can separate their simulation workload between gz +and Isaac Sim, with both systems running in parallel. For example, sensors can be handled by Isaac Sim, with rendering handled by gz, or vice versa.* We can define more tangible examples, we can use some of the ROS frameworks such as the Nav stack or Moveit to use the ROS data from both simulators. For example: - - Moveit: We can simulate in Ignition the joints of an articulated arm (sensing the data from the joints and sending commands to the joints) and in Isaac Sim we can simulate a camera attached to the robot or looking at the scene. - - Nav stack: We can simulate in Ignition the diff drive controller and simulate all the sensors in Isaac Sim (Lidar, cameras, etc). + - Moveit: We can simulate in gz the joints of an articulated arm (sensing the data from the joints and sending commands to the joints) and in Isaac Sim we can simulate a camera attached to the robot or looking at the scene. + - Nav stack: We can simulate in gz the diff drive controller and simulate all the sensors in Isaac Sim (Lidar, cameras, etc). The possibilities are huge you just need to configure your on setup. In the following image is explained how the hybrid simulation works. @@ -19,14 +19,14 @@ Once the connector is running we need to defined which data from sensor or actua - Isaac Sim can share the data in the ROS network using some the predefined ROS plugins ![](isaac_ros_plugins.png) - - Ignition uses `ros_ign_bridge`, this package provides a network bridge which enables the exchange of messages between ROS 2 and Ignition Transport. You can follow this tutorial to learn more about [how to use ROS Ignition bridges](https://docs.ros.org/en/galactic/Tutorials/Simulators/Ignition/Setting-up-a-Robot-Simulation-Ignition.html) + - gz uses `ros_ign_bridge`, this package provides a network bridge which enables the exchange of messages between ROS 2 and gz Transport. You can follow this tutorial to learn more about [how to use ROS gz bridges](https://docs.ros.org/en/galactic/Tutorials/Simulators/gz/Setting-up-a-Robot-Simulation-gz.html) ## Demo In particular will follow this steps: - Launch a world containing a ROS 2-controlled robot. - - Enable hybrid simulation, sharing the workload between Ignition and Isaac Sim + - Enable hybrid simulation, sharing the workload between gz and Isaac Sim - Control the robot from ROS 2 - Visualize the data in the ROS network from both simulators in Rviz2 @@ -35,7 +35,7 @@ In particular will follow this steps: - [Turtebot4 Simulation](https://github.com/turtlebot/turtlebot4_simulator) - Omniverse Issac Sim - [ROS & ROS2 Bridge](https://docs.omniverse.nvidia.com/app_isaacsim/app_isaacsim/ext_omni_isaac_ros_bridge.html) - - [How to use ROS Ignition bridges](https://docs.ros.org/en/galactic/Tutorials/Simulators/Ignition/Setting-up-a-Robot-Simulation-Ignition.html) + - [How to use ROS gz bridges](https://docs.ros.org/en/galactic/Tutorials/Simulators/gz/Setting-up-a-Robot-Simulation-gz.html) - ros_ign_bridge - ROS 2: `sudo apt-get install ros-galactic-ros-ign-bridge` @@ -43,7 +43,7 @@ In particular will follow this steps: In this case we are going to simulate the Turtebot4 available in this [repository](https://github.com/turtlebot/turtlebot4_simulator). -But first we are going to modify the lidar ros_ign_bridge bridge. Edit the file `~/turtlebot4_ws/src/turtlebot4_simulator/turtlebot4_ignition_bringup/launch/ros_ign_bridge.launch.py`. We should remap the `/scan` ROS 2 topic to `/scan_ignition`. The original file is: +But first we are going to modify the lidar ros_ign_bridge bridge. Edit the file `~/turtlebot4_ws/src/turtlebot4_simulator/turtlebot4_gz_bringup/launch/ros_ign_bridge.launch.py`. We should remap the `/scan` ROS 2 topic to `/scan_gz`. The original file is: ```python remappings=[ @@ -61,7 +61,7 @@ remappings=[ (['/world/', LaunchConfiguration('world'), '/model/', LaunchConfiguration('robot_name'), '/link/rplidar_link/sensor/rplidar/scan'], - '/scan_ignition') + '/scan_gz') ]) ``` @@ -71,58 +71,58 @@ Now you should compile it. Follow the instructions in the [README.md](https://gi If you need to compile `ign-omni`, please review this [instructions](01_compile.md). -**Note**: `ignition-omni` will be built under `src/ign-omni/_build`, this is because +**Note**: `gz-omni` will be built under `src/ign-omni/_build`, this is because it uses a custom build system by NVidia which is hard coded to put output in that directory. In this case you need to source the special workspace that we have created with the `ign-omni-meta` repository. -Create an empty file in Nucleus in the following directory `omniverse://localhost/Users/ignition/turtlebot4.usd` +Create an empty file in Nucleus in the following directory `omniverse://localhost/Users/gz/turtlebot4.usd` ## Running the example: ### Run the ROS 2 simulation -You should run the Turtlebot4 simulation in Ignition, we are going to set to true the `slam` option to be able to create a map and navigate in the scene and we are going to set `rviz` to true too, in this case to visualize all the data from the nav2 stack in Rviz2: +You should run the Turtlebot4 simulation in gz, we are going to set to true the `slam` option to be able to create a map and navigate in the scene and we are going to set `rviz` to true too, in this case to visualize all the data from the nav2 stack in Rviz2: ```bash source ~/turtlebot4_ws/install/setup.bash -ros2 launch turtlebot4_ignition_bringup ignition.launch.py slam:=sync nav2:=true rviz:=true +ros2 launch turtlebot4_gz_bringup gz.launch.py slam:=sync nav2:=true rviz:=true ``` ### Run the connector -Once the simulation in Ignition is running we need to define some arguments to run the connector: +Once the simulation in gz is running we need to define some arguments to run the connector: ```bash -Ignition omniverse connector -Usage: ./_build/linux-x86_64/debug/ignition-omniverse1 [OPTIONS] +gz omniverse connector +Usage: ./_build/linux-x86_64/debug/gz-omniverse1 [OPTIONS] Options: -h,--help Print this help message and exit - -p,--path TEXT REQUIRED Location of the omniverse stage. e.g. "omniverse://localhost/Users/ignition/stage.usd" - -w,--world TEXT REQUIRED Name of the ignition world - --pose ENUM:value in {ignition->0,isaacsim->1} OR {0,1} REQUIRED + -p,--path TEXT REQUIRED Location of the omniverse stage. e.g. "omniverse://localhost/Users/gz/stage.usd" + -w,--world TEXT REQUIRED Name of the gz world + --pose ENUM:value in {gz->0,isaacsim->1} OR {0,1} REQUIRED Which simulator will handle the poses - -v,--verbose + -v,--verbose ``` In particular we need to define: - `-p,--path`: this is the file inside Omniverse, Isaac Sim and the connector are going to share it thanks to live sync mode. **This file must live in Omniverse**. - - `-w,--world`: The name of the Ignition world - - `--pose`: This option has two values: `ignition` or `isaacsim`. It defines how will handle the models pose and the joint states. + - `-w,--world`: The name of the gz world + - `--pose`: This option has two values: `gz` or `isaacsim`. It defines how will handle the models pose and the joint states. ```bash source ~/ign-omni/install/setup.bash cd ~/ign-omni/src/ign-omni export IGN_GAZEBO_RESOURCE_PATH=$IGN_GAZEBO_RESOURCE_PATH:`echo $HOME`/turtlebot4_ws/install/share/:`echo $HOME`/turtlebot4_ws/install/turtlebot4_description/share/:`echo $HOME`/turtlebot4_ws/install/irobot_create_description/share/ -bash run_ignition_omni.sh -p omniverse://localhost/Users/ignition/turtlebot4.usd -w depot -v --pose ignition +bash run_gz_omni.sh -p omniverse://localhost/Users/gz/turtlebot4.usd -w depot -v --pose gz ``` ### Run Issac Sim -Launch `IssacSim`, load the file `omniverse://localhost/Users/ignition/turtlebot4.usd` and activate the `live sync` +Launch `IssacSim`, load the file `omniverse://localhost/Users/gz/turtlebot4.usd` and activate the `live sync` ![](../live_sync.gif) @@ -205,7 +205,7 @@ if __name__ == '__main__': **Note: With this script you can choose how is going to provide the data from the lidar** - If you define `/scan_isaac` the data used is provided by Isaac Sim. - - If you define `/scan_ignition` the data used is provided by Ignition Gazebo. + - If you define `/scan_gz` the data used is provided by gz Gazebo. Launch the node: