Open 3D Engine ROS2 Gem API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
ROS2::SensorEventSource< EventT, EventHandlerT, EventArgs > Class Template Referenceabstract

#include <SensorEventSource.h>

Public Types

using SourceBaseType = SensorEventSource< EventT, EventHandlerT, EventArgs... >
 
using SourceCallbackType = AZStd::function< void(EventArgs...)>
 
using AdaptedCallbackType = AZStd::function< void(float, EventArgs...)>
 
using SourceEventType = EventT< EventArgs... >
 
using SourceEventHandlerType = EventHandlerT< EventArgs... >
 
using AdaptedEventType = EventT< float, EventArgs... >
 
using AdaptedEventHandlerType = EventHandlerT< float, EventArgs... >
 

Public Member Functions

virtual void Start ()
 
virtual void Stop ()
 
virtual float GetDeltaTime (EventArgs... args) const =0
 
void ConnectToSourceEvent (SourceEventHandlerType &sourceEventHandler)
 

Protected Attributes

SourceEventType m_sourceEvent {}
 This event should be signalled based on specific event source specialization.
 

Detailed Description

template<template< typename... > class EventT, template< typename... > class EventHandlerT, typename... EventArgs>
class ROS2::SensorEventSource< EventT, EventHandlerT, EventArgs >

Base class template for sensor event sources (based e.g. on TickBus or engine physics callback). Developer that wants to implement new event source should derive from this class and signal m_sensorEvent based on chosen approach. Derived classes can be used directly as unconstrained source of frequency - e.g. TickBasedSource, when synchronization with draw calls is necessary. However, in most common case they will be used as source of events for sensors, through EventSourceAdapter object, where their m_sensorEvent will be additionally adapted to some sensor-specific frequency.

See also
ROS2::EventSourceAdapter
ROS2::TickBasedSource
ROS2::PhysicsBasedSource

Member Function Documentation

◆ ConnectToSourceEvent()

template<template< typename... > class EventT, template< typename... > class EventHandlerT, typename... EventArgs>
void ROS2::SensorEventSource< EventT, EventHandlerT, EventArgs >::ConnectToSourceEvent ( SourceEventHandlerType &  sourceEventHandler)
inline

Connects given event handler to sensor source event. By design, source event is not restricted by frequency settings. This event should be signalled based on event source internal logic (e.g. on draw call). For more details check event source specializations.

Parameters
sourceEventHandlerEvent handler that will be connected to source event.

◆ GetDeltaTime()

template<template< typename... > class EventT, template< typename... > class EventHandlerT, typename... EventArgs>
virtual float ROS2::SensorEventSource< EventT, EventHandlerT, EventArgs >::GetDeltaTime ( EventArgs...  args) const
pure virtual

Returns delta time from set of source event parameters (passed as variadic up to some point). The purpose of this method is to give developers access to event source delta time, without additional variables or helpers.

Parameters
argsSet of source event parameters.
Returns
Delta time in seconds.

◆ Start()

template<template< typename... > class EventT, template< typename... > class EventHandlerT, typename... EventArgs>
virtual void ROS2::SensorEventSource< EventT, EventHandlerT, EventArgs >::Start ( )
inlinevirtual

Starts event source - see specific event source description for more details. After call to this method event source is supposed to start signalling source event.

Reimplemented in ROS2::PhysicsBasedSource, and ROS2::TickBasedSource.

◆ Stop()

template<template< typename... > class EventT, template< typename... > class EventHandlerT, typename... EventArgs>
virtual void ROS2::SensorEventSource< EventT, EventHandlerT, EventArgs >::Stop ( )
inlinevirtual

Stops event source - see specific event source description for more details. After call to this method event source is supposed to stop signalling source event.

Reimplemented in ROS2::PhysicsBasedSource, and ROS2::TickBasedSource.


The documentation for this class was generated from the following file: