LidarSensor#

Fully qualified name: isaacsim::sensors::physx::LidarSensor

class LidarSensor : public isaacsim::sensors::physx::RangeSensorComponentBase<PrimType>#

A LiDAR (Light Detection and Ranging) sensor implementation.

This class simulates a LiDAR sensor with configurable parameters such as rotation rate, field of view, and resolution. It provides both depth and intensity data, along with optional semantic information about detected objects. The sensor performs ray casting in the physics scene to detect objects and measure distances.

Public Functions

LidarSensor(omni::physx::IPhysx *physxPtr)#

Constructs a new LiDAR sensor instance.

Parameters:

physxPtr[in] Pointer to the PhysX interface for physics simulation

~LidarSensor()#

Virtual destructor for proper cleanup.

virtual void onStart()#

Initializes the LiDAR sensor when the component starts.

Sets up initial parameters, allocates memory for scan data, and prepares the sensor for operation

virtual void preTick()#

Performs pre-tick operations before the main sensor update.

Updates sensor parameters and prepares for the next scan cycle

virtual void tick()#

Performs the main sensor update during each tick.

Executes the LiDAR scanning operation, updates sensor data, and processes results

virtual void onComponentChange()#

Handles component property changes.

Updates sensor configuration when properties are modified through the interface

inline int getNumCols() const#

Gets the number of columns (horizontal samples) in the scan pattern.

Returns:

Number of columns in the scan grid

inline int getNumRows() const#

Gets the number of rows (vertical samples) in the scan pattern.

Returns:

Number of rows in the scan grid

inline int getNumColsTicked() const#

Gets the number of columns processed in the last tick.

Returns:

Number of columns processed in the most recent update

inline std::vector<uint16_t> &getDepthData()#

Gets the latest depth data from the sensor.

Returns:

Reference to vector containing normalized depth values (0-65535)

inline std::vector<float> &getBeamTimeData()#

Gets the timestamp for each beam in the scan.

Returns:

Reference to vector containing beam timestamps in seconds

inline std::vector<float> &getLinearDepthData()#

Gets the latest linear depth data in meters.

Returns:

Reference to vector containing depth values in meters

inline std::vector<uint8_t> &getIntensityData()#

Gets the latest intensity data from the sensor.

Returns:

Reference to vector containing intensity values (0-255)

inline std::vector<float> &getZenithData()#

Gets the zenith angles for each sensor ray.

Returns:

Reference to vector containing zenith angles in radians

inline std::vector<float> &getAzimuthData()#

Gets the azimuth angles for each sensor ray.

Returns:

Reference to vector containing azimuth angles in radians

inline std::vector<std::string> &getPrimData()#

Gets the primitive data for each hit point.

Returns:

Reference to vector containing primitive names/identifiers

inline carb::Float2 getAzimuthRange()#

Gets the azimuth angle range of the sensor.

Returns:

Pair of minimum and maximum azimuth angles in radians

inline carb::Float2 getZenithRange()#

Gets the zenith angle range of the sensor.

Returns:

Pair of minimum and maximum zenith angles in radians

inline virtual void initialize(
const PrimType &prim,
pxr::UsdStageWeakPtr stage,
)#

Initializes various pointers and handles in the component.

Must be called after creation, can be overridden to initialize subcomponents

Parameters:
  • prim[in] The USD prim representing this sensor

  • stage[in] The USD stage containing the sensor prim

inline virtual void onPhysicsStep()#

Called after each physics step to update sensor data.

This function is called after each physics simulation step to process and update the range sensor data based on the latest physics state

inline virtual void onPhysicsStep(float dt)#

Called during each physics simulation step.

Override this to implement physics-based behavior

Parameters:

dt[in] Time step size in seconds

inline virtual void draw()#

Called after all sensors have simulated to perform any drawing related tasks.

Renders the debug visualization for both points and lines if enabled

inline virtual void onStop()#

Run when stop is pressed.

Clears all visualization data and ensures it’s properly rendered

inline virtual void updateTimestamp(
double timeSeconds,
double dt,
int64_t timeNano,
)#

Updates timestamps for component.

Parameters:
  • timeSeconds[in] Current simulation time in seconds

  • dt[in] Time step duration in seconds

  • timeNano[in] Current simulation time in nanoseconds

inline bool getDrawPoints()#

Gets the draw points visualization state.

Returns:

True if point visualization is enabled, false otherwise

inline bool getDrawLines()#

Gets the draw lines visualization state.

Returns:

True if line visualization is enabled, false otherwise

inline std::vector<carb::Float3> &getPointCloud()#

Gets the latest point cloud data from the range sensor.

Returns a reference to the vector containing the most recent hit positions detected by the range sensor. Each point represents a detected surface in 3D space.

Returns:

Reference to vector of 3D points representing the latest point cloud data

inline virtual void onRenderEvent()#

Called for each rendered frame.

Override this to implement render-specific behavior or visual updates

inline PrimType &getPrim()#

Retrieves the component’s USD prim.

Returns:

Reference to the component’s USD prim

inline bool getEnabled()#

Checks if the component is enabled.

Returns:

true if the component is enabled, false otherwise

inline uint64_t getSequenceNumber()#

Gets the component’s sequence number.

Returns:

The component’s sequence number

Public Members

bool mDoStart = true#

Flag indicating whether onStart should be called.

Protected Attributes

bool m_drawPoints = false#

Flag to enable/disable point visualization.

bool m_drawLines = false#

Flag to enable/disable line visualization.

std::vector<carb::Float3> m_lastHitPos#

Vector storing the most recent hit positions from the sensor.

float m_minRange = 0.4f#

Minimum range of the sensor in meters.

float m_maxRange = 100.0f#

Maximum range of the sensor in meters.

float m_metersPerUnit = 1.0#

Conversion factor from scene units to meters.

pxr::UsdPrim m_parentPrim#

Reference to the parent USD prim containing this sensor.

omni::physx::IPhysx *m_physx = nullptr#

Pointer to the PhysX interface.

::physx::PxScene *m_pxScene = nullptr#

Pointer to the PhysX scene.

omni::timeline::ITimeline *m_timeline = nullptr#

Pointer to the timeline interface.

omni::fabric::IToken *m_token = nullptr#

Pointer to the fabric token interface.

carb::tasking::ITasking *m_tasking = nullptr#

Pointer to the tasking interface.

std::shared_ptr<isaacsim::util::debug_draw::drawing::PrimitiveDrawingHelper> m_lineDrawing#

Helper for drawing debug lines.

std::shared_ptr<isaacsim::util::debug_draw::drawing::PrimitiveDrawingHelper> m_pointDrawing#

Helper for drawing debug points.

pxr::RangeSensorRangeSensor m_rangeSensorPrim#

Reference to the range sensor USD prim.

pxr::UsdTimeCode m_parentPrimTimeCode#

Time code for the parent prim’s current state.

bool m_isParentPrimTimeSampled = false#

Flag indicating if the parent prim has time-sampled transforms.

bool m_firstFrame = true#

Flag indicating if this is the first frame.

PrimType m_prim#

USD prim reference storing component settings.

pxr::UsdStageWeakPtr m_stage = nullptr#

Weak pointer to the USD stage containing the prim.

usdrt::UsdStageRefPtr m_usdrtStage = nullptr#

Runtime USD stage reference.

double m_timeSeconds = 0#

Current simulation time in seconds.

int64_t m_timeNanoSeconds = 0#

Current simulation time in nanoseconds.

double m_timeDelta = 0#

Time delta for current tick in seconds.

uint64_t m_sequenceNumber = 0#

Component sequence number for ordering/identification.

bool m_enabled = true#

Component enabled state flag.