Fixing formatting for usd files and adding pylint configuration

This commit is contained in:
Abhishek Joshi
2024-07-03 18:32:59 -05:00
parent 09b00cec5d
commit 59303bb161
7 changed files with 290 additions and 153 deletions
+19 -8
View File
@@ -1,15 +1,27 @@
from typing import List, Optional, Tuple
import utils as utils_component
# Copyright 2024 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.
# ==============================================================================
import numpy as np
from pxr import Gf
from pxr import Usd
from pxr import UsdGeom
class USDCamera:
import mujoco.usd.utils as utils_component
class USDCamera:
"""Class that handles the cameras in the USD scene"""
def __init__(self, stage: Usd.Stage, obj_name: str):
self.stage = stage
@@ -22,7 +34,6 @@ class USDCamera:
# defining ops required by update function
self.transform_op = self.usd_xform.AddTransformOp()
# self.usd_camera.CreateFocalLengthAttr().Set(18.14756) # default in omniverse
self.usd_camera.CreateFocalLengthAttr().Set(12)
self.usd_camera.CreateFocusDistanceAttr().Set(400)
@@ -31,8 +42,8 @@ class USDCamera:
self.usd_camera.GetClippingRangeAttr().Set(Gf.Vec2f(1e-4, 1e6))
def update(self, cam_pos: np.ndarray, cam_mat: np.ndarray, frame: int):
"""Updates the position and orientation of the camera in the scene"""
transformation_mat = utils_component.create_transform_matrix(
rotation_matrix=cam_mat, translation_vector=cam_pos
).T
self.transform_op.Set(Gf.Matrix4d(transformation_mat.tolist()), frame)
self.transform_op.Set(Gf.Matrix4d(transformation_mat.tolist()), frame)