2. Add Camera and Sensors¶
Omniverse Isaac Sim provides a variety of sensors that can be used to sense the environment and robot’s state. In this tutorial, we will cover the simple example of attaching a camera sensor to our mock robot, a process that can be generalized to other sensors. Details regarding the camera and other types of sensors can be found in our Advance Tutorials and Sensor Extensions under Manuals.
2.1. Learning Objectives¶
This tutorial details how to
Attach cameras to geometries
2.2. Getting Started¶
Complete the Introductory Tutorial series and the previous tutorial in the GUI Tutorials.
To add a camera, go to the Menu Bar and select Create > Camera. A camera will appear on the stage tree, and a grey wireframe representing the camera’s view will appear on the stage. You can move and rotate the camera’s transform just like any other objects on the stage.
You can also add a camera by moving the current view in the viewport to a view of your choosing, and then go to the Camera button on the upper left hand corner of the viewport display, and select Camera > Create Camera from View. A new camera should appear on the Stage tree, as well as the list of cameras that can be selected in the Camera button.
2.3. Attach Camera to Robot¶
Let’s first rename the newly added camera to car_camera so we can keep track of it.
It would be easier to place the camera if we could see both the desired camera input stream, as well as where it is relative to the robot from an outside camera. Open up a second viewport window by going to the Menu Bar and click Window > New Viewport Window. A new viewport appears; dock it wherever you’d like.
Keep one of the viewport in Perspective camera view, and change the other one to car_camera view. Find the Cameras menu on the top edge of the viewport, and switch to Camera > car_camera. Now we can have both the view of the onboard camera, as well as an overview of the scene.
Attach the camera to the robot’s body by dragging the prim under
body. Now the camera will move together with the body. You may need to switch the camera view for the viewport again.
Let’s point the camera slightly down so we can see the car as well as the ground. Set the camera transform translation to
x=20,y=0,z=200and orientation to
x=0,y=70,z=90. You should see the viewport showing the onboard camera view splitting the window between the robot’s body and the ground and the relative position and orientation of the camera to the robot in the Perspective camera viewport.
Press Play. The camera onboard the robot should now move with the robot.
A similar strategy is used to apply other onboard sensors.
If the view XXX of the camera is moved while displaying, it will change the camera’s properties. So it’s better to afix a prim that has the right offset to the parent, and then afix the camera to that frame. So that if you accidentally moved the camera position, you can easily get back by zeroing out all the camera position offset in relation to the camera frame, which cannot be easily moved.
In this tutorial, we learned how to add a camera to the robot.
2.4.1. Next Steps¶
Continue on to Interactive Scripting to learn how to run python APIs inside the GUI.