Skip to content

Commit dd011a0

Browse files
authored
Fixes ViewportCameraController numpy array missing datatype (#3375)
# Description This PR fixes #3374. The numpy array type is specified upon creation to be fp32. ## Type of change - Bug fix (non-breaking change which fixes an issue) ## Checklist - [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with `./isaaclab.sh --format` - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] I have updated the changelog and the corresponding version in the extension's `config/extension.toml` file - [ ] I have added my name to the `CONTRIBUTORS.md` or my name already exists there
1 parent 3830019 commit dd011a0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

source/isaaclab/isaaclab/envs/ui/viewport_camera_controller.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ def __init__(self, env: ManagerBasedEnv | DirectRLEnv, cfg: ViewerCfg):
5252
self._env = env
5353
self._cfg = copy.deepcopy(cfg)
5454
# cast viewer eye and look-at to numpy arrays
55-
self.default_cam_eye = np.array(self._cfg.eye)
56-
self.default_cam_lookat = np.array(self._cfg.lookat)
55+
self.default_cam_eye = np.array(self._cfg.eye, dtype=float)
56+
self.default_cam_lookat = np.array(self._cfg.lookat, dtype=float)
5757

5858
# set the camera origins
5959
if self.cfg.origin_type == "env":
@@ -207,9 +207,9 @@ def update_view_location(self, eye: Sequence[float] | None = None, lookat: Seque
207207
"""
208208
# store the camera view pose for later use
209209
if eye is not None:
210-
self.default_cam_eye = np.asarray(eye)
210+
self.default_cam_eye = np.asarray(eye, dtype=float)
211211
if lookat is not None:
212-
self.default_cam_lookat = np.asarray(lookat)
212+
self.default_cam_lookat = np.asarray(lookat, dtype=float)
213213
# set the camera locations
214214
viewer_origin = self.viewer_origin.detach().cpu().numpy()
215215
cam_eye = viewer_origin + self.default_cam_eye

0 commit comments

Comments
 (0)