Move headers from src/experimental/usd to include/experimental/usd

PiperOrigin-RevId: 775269423
Change-Id: Ifca6c3ead32b9fb3f02784ed38a9efae300be410
This commit is contained in:
Sam Haves
2025-06-24 09:32:13 -07:00
committed by Copybara-Service
parent 78df2ae7fa
commit 9089059517
21 changed files with 120 additions and 27 deletions
@@ -0,0 +1,41 @@
// Copyright 2025 DeepMind Technologies Limited
//
// 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.
#ifndef MUJOCO_SRC_EXPERIMENTAL_USD_LAYER_SINK_H_
#define MUJOCO_SRC_EXPERIMENTAL_USD_LAYER_SINK_H_
#include <vector>
#include <mujoco/mujoco.h>
#include <pxr/usd/sdf/path.h>
#include <pxr/usd/usd/common.h>
namespace mujoco {
namespace usd {
// A sink for writing pose data to an SDF layer.
// Opinions will be authored on the edit target layer for the
// passed stage argument.
class LayerSink {
public:
explicit LayerSink(pxr::UsdStageRefPtr stage);
void Update(const mjData* const data, std::vector<pxr::SdfPath> body_paths_);
private:
pxr::UsdStageRefPtr stage_;
};
} // namespace usd
} // namespace mujoco
#endif // MUJOCO_SRC_EXPERIMENTAL_USD_LAYER_SINK_H_
@@ -17,8 +17,8 @@
/// \file mjcPhysics/actuatorAPI.h
#include "./api.h"
#include "./tokens.h"
#include <mujoco/experimental/usd/mjcPhysics/api.h>
#include <mujoco/experimental/usd/mjcPhysics/tokens.h>
#include "pxr/base/gf/matrix4d.h"
#include "pxr/base/gf/vec3d.h"
#include "pxr/base/gf/vec3f.h"
@@ -17,8 +17,8 @@
/// \file mjcPhysics/collisionAPI.h
#include "./api.h"
#include "./tokens.h"
#include <mujoco/experimental/usd/mjcPhysics/api.h>
#include <mujoco/experimental/usd/mjcPhysics/tokens.h>
#include "pxr/base/gf/matrix4d.h"
#include "pxr/base/gf/vec3d.h"
#include "pxr/base/gf/vec3f.h"
@@ -17,8 +17,8 @@
/// \file mjcPhysics/meshCollisionAPI.h
#include "./api.h"
#include "./tokens.h"
#include <mujoco/experimental/usd/mjcPhysics/api.h>
#include <mujoco/experimental/usd/mjcPhysics/tokens.h>
#include "pxr/base/gf/matrix4d.h"
#include "pxr/base/gf/vec3d.h"
#include "pxr/base/gf/vec3f.h"
@@ -17,8 +17,8 @@
/// \file mjcPhysics/sceneAPI.h
#include "./api.h"
#include "./tokens.h"
#include <mujoco/experimental/usd/mjcPhysics/api.h>
#include <mujoco/experimental/usd/mjcPhysics/tokens.h>
#include "pxr/base/gf/matrix4d.h"
#include "pxr/base/gf/vec3d.h"
#include "pxr/base/gf/vec3f.h"
@@ -17,7 +17,7 @@
/// \file mjcPhysics/siteAPI.h
#include "./api.h"
#include <mujoco/experimental/usd/mjcPhysics/api.h>
#include "pxr/base/gf/matrix4d.h"
#include "pxr/base/gf/vec3d.h"
#include "pxr/base/gf/vec3f.h"
@@ -26,7 +26,7 @@
#include <vector>
#include "./api.h"
#include <mujoco/experimental/usd/mjcPhysics/api.h>
#include "pxr/base/tf/staticData.h"
#include "pxr/base/tf/token.h"
#include "pxr/pxr.h"
+52
View File
@@ -0,0 +1,52 @@
// Copyright 2025 DeepMind Technologies Limited
//
// 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.
#ifndef MUJOCO_SRC_EXPERIMENTAL_USD_WRITER_H_
#define MUJOCO_SRC_EXPERIMENTAL_USD_WRITER_H_
#include <functional>
#include <vector>
#include <mujoco/mujoco.h>
#include <pxr/usd/sdf/path.h>
#include <pxr/usd/usd/common.h>
namespace mujoco {
namespace usd {
using PoseSinkFn =
std::function<void(const mjData* const, std::vector<pxr::SdfPath>)>;
class Writer {
public:
Writer(pxr::UsdStageRefPtr stage, mjSpec* spec, mjModel_* model);
~Writer();
Writer(const Writer&) = delete;
Writer& operator=(const Writer&) = delete;
void Update(const mjData* const data);
void AddSink(PoseSinkFn sink_fn);
private:
void BuildMjUsdMapping();
pxr::UsdStageRefPtr stage_;
std::vector<pxr::SdfPath> body_id_to_path_;
mjSpec* spec_ = nullptr;
mjModel_* model_ = nullptr;
std::vector<PoseSinkFn> pose_sinks_;
};
} // namespace usd
} // namespace mujoco
#endif // MUJOCO_SRC_EXPERIMENTAL_USD_WRITER_H_
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "./actuatorAPI.h"
#include <mujoco/experimental/usd/mjcPhysics/actuatorAPI.h>
#include "pxr/usd/sdf/assetPath.h"
#include "pxr/usd/sdf/types.h"
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "./collisionAPI.h"
#include <mujoco/experimental/usd/mjcPhysics/collisionAPI.h>
#include "pxr/usd/sdf/assetPath.h"
#include "pxr/usd/sdf/types.h"
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "./meshCollisionAPI.h"
#include <mujoco/experimental/usd/mjcPhysics/meshCollisionAPI.h>
#include "pxr/usd/sdf/assetPath.h"
#include "pxr/usd/sdf/types.h"
+1 -1
View File
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "./sceneAPI.h"
#include <mujoco/experimental/usd/mjcPhysics/sceneAPI.h>
#include "pxr/usd/sdf/assetPath.h"
#include "pxr/usd/sdf/types.h"
+1 -1
View File
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "./siteAPI.h"
#include <mujoco/experimental/usd/mjcPhysics/siteAPI.h>
#include "pxr/usd/sdf/assetPath.h"
#include "pxr/usd/sdf/types.h"
+1 -1
View File
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "./tokens.h"
#include <mujoco/experimental/usd/mjcPhysics/tokens.h>
PXR_NAMESPACE_OPEN_SCOPE
@@ -23,7 +23,7 @@
#include <mujoco/mjspec.h>
#include <mujoco/mujoco.h>
#include "third_party/mujoco/src/experimental/usd/mjcPhysics/tokens.h"
#include <mujoco/experimental/usd/mjcPhysics/tokens.h>
#include "mjcf/utils.h"
#include <pxr/base/arch/attributes.h>
#include <pxr/base/gf/matrix4d.h>
+1 -1
View File
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "third_party/mujoco/src/experimental/usd/utils.h"
#include <mujoco/experimental/usd/utils.h>
#include <mujoco/mujoco.h>
#include <pxr/usd/sdf/path.h>
@@ -14,8 +14,8 @@
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <mujoco/experimental/usd/mjcPhysics/sceneAPI.h>
#include <mujoco/mujoco.h>
#include "src/experimental/usd/mjcPhysics/sceneAPI.h"
#include "test/fixture.h"
#include <pxr/base/gf/vec3d.h>
#include <pxr/base/vt/types.h>
@@ -14,9 +14,9 @@
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <mujoco/experimental/usd.h>
#include <mujoco/experimental/usd/mjcPhysics/siteAPI.h>
#include <mujoco/experimental/usd/usd.h>
#include <mujoco/mujoco.h>
#include "src/experimental/usd/mjcPhysics/siteAPI.h"
#include "test/fixture.h"
#include <pxr/base/tf/token.h>
#include <pxr/usd/sdf/path.h>
@@ -17,12 +17,12 @@
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include "src/experimental/usd/mjcPhysics/actuatorAPI.h"
#include "src/experimental/usd/mjcPhysics/collisionAPI.h"
#include "src/experimental/usd/mjcPhysics/meshCollisionAPI.h"
#include "src/experimental/usd/mjcPhysics/sceneAPI.h"
#include "src/experimental/usd/mjcPhysics/siteAPI.h"
#include "src/experimental/usd/mjcPhysics/tokens.h"
#include <mujoco/experimental/usd/mjcPhysics/actuatorAPI.h>
#include <mujoco/experimental/usd/mjcPhysics/collisionAPI.h>
#include <mujoco/experimental/usd/mjcPhysics/meshCollisionAPI.h>
#include <mujoco/experimental/usd/mjcPhysics/sceneAPI.h>
#include <mujoco/experimental/usd/mjcPhysics/siteAPI.h>
#include <mujoco/experimental/usd/mjcPhysics/tokens.h>
#include "test/experimental/usd/test_utils.h"
#include "test/fixture.h"
#include <pxr/base/gf/vec2f.h>