Monocular Camera

File: monocular_camera.py
Author: Marcelo Jacinto (marcelo.jacinto@tecnico.ulisboa.pt)
License: BSD-3-Clause. Copyright (c) 2024, Marcelo Jacinto. All rights reserved.
Description: Simulates a monocular camera attached to the vehicle

Classes:

MonocularCamera

The class that implements a monocular camera sensor.

class pegasus.simulator.logic.graphical_sensors.monocular_camera.MonocularCamera

Bases: GraphicalSensor

The class that implements a monocular camera sensor. This class inherits the base class GraphicalSensor.

Methods:

__init__(camera_name[, config])

Initialize the MonocularCamera class

initialize(vehicle)

A method that can be invoked when the simulation is starting to give access to the control backend to the entire vehicle object.

start()

Method that when implemented should handle the begining of the simulation of vehicle

stop()

Method that when implemented should handle the stopping of the simulation of vehicle

update(state, dt)

Method that should be implemented by the class that inherits Sensor.

Attributes:

state

(dict) The 'state' of the sensor, i.e. the data produced by the sensor at any given point in time.

__init__(camera_name, config={})

Initialize the MonocularCamera class

Check the oficial documentation for the Camera class in Isaac Sim: https://docs.omniverse.nvidia.com/isaacsim/latest/features/sensors_simulation/isaac_sim_sensors_camera.html#isaac-sim-sensors-camera

Parameters:

config (dict) – A Dictionary that contains all the parameters for configuring the MonocularCamera - it can be empty or only have some of the parameters used by the MonocularCamera.

Examples

The dictionary default parameters are

>>> {"depth": True,
>>> "position": np.array([0.30, 0.0, 0.0]),
>>> "orientation": np.array([0.0, 0.0, 0.0]),
>>> "resolution": (1920, 1200),
>>> "frequency": 30,
>>> "intrinsics": np.array([[958.8, 0.0, 957.8], [0.0, 956.7, 589.5], [0.0, 0.0, 1.0]]),
>>> "distortion_coefficients": np.array([0.14, -0.03, -0.0002, -0.00003, 0.009, 0.5, -0.07, 0.017]),
>>> "diagonal_fov": 140.0}
initialize(vehicle)

A method that can be invoked when the simulation is starting to give access to the control backend to the entire vehicle object. Even though we provide update_sensor and update_state callbacks that are called at every physics step with the latest vehicle state and its sensor data, having access to the full vehicle object may prove usefull under some circumstances. This is nice to give users the possibility of overiding default vehicle behaviour via this control backend structure.

Parameters:

vehicle (Vehicle) – A reference to the vehicle that this sensor is associated with

start()

Method that when implemented should handle the begining of the simulation of vehicle

stop()

Method that when implemented should handle the stopping of the simulation of vehicle

update(state, dt)

Method that should be implemented by the class that inherits Sensor. This is where the actual implementation of the sensor should be performed.

Parameters:
  • state (State) – The current state of the vehicle.

  • dt (float) – The time elapsed between the previous and current function calls (s).

Returns:

(dict) A dictionary containing the current state of the sensor (the data produced by the sensor)

property state

(dict) The ‘state’ of the sensor, i.e. the data produced by the sensor at any given point in time