/* * Copyright (c) Contributors to the Open 3D Engine Project. * For complete copyright and license terms please see the LICENSE at the root of this distribution. * * SPDX-License-Identifier: Apache-2.0 OR MIT * */ #include #include #include #include #include namespace ROS2 { void TickBasedSource::Reflect(AZ::ReflectContext* context) { if (auto* serializeContext = azrtti_cast(context)) { serializeContext->Class()->Version(1); } } void TickBasedSource::Start() { AZ::TickBus::Handler::BusConnect(); } void TickBasedSource::Stop() { AZ::TickBus::Handler::BusDisconnect(); } float TickBasedSource::GetDeltaTime(float deltaTime) const { return deltaTime; } void TickBasedSource::OnTick(float deltaTime, AZ::ScriptTimePoint time) { AZ_UNUSED(time); AZ_UNUSED(deltaTime); const auto expectedSimulationLoopTime = ROS2Interface::Get()->GetExpectedSimulationLoopTime(); m_sourceEvent.Signal(expectedSimulationLoopTime); } } // namespace ROS2