VehicleModelLimits.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. #include "VehicleInputs.h"
  10. #include <AzCore/RTTI/TypeInfo.h>
  11. #include <AzCore/Serialization/SerializeContext.h>
  12. namespace ROS2Controllers::VehicleDynamics
  13. {
  14. //! A structure holding limits of vehicle, including speed and steering limits
  15. class VehicleModelLimits
  16. {
  17. public:
  18. AZ_RTTI(VehicleModelLimits, "{76DA392D-64BB-45A8-BC90-84AAE7901991}");
  19. VehicleModelLimits() = default;
  20. virtual ~VehicleModelLimits() = default;
  21. static void Reflect(AZ::ReflectContext* context);
  22. //! Limit input state to values that are possible for model.
  23. //! @param inputState Input state to filter.
  24. //! @returns Filtered, pruned state.
  25. virtual VehicleInputs LimitState(const VehicleInputs& inputState) const = 0;
  26. //! Returns maximal permissible input states.
  27. //! @returns VehicleInputsState
  28. virtual VehicleInputs GetMaximumState() const = 0;
  29. protected:
  30. //! Limit value with a symmetrical range.
  31. //! @param value Input value.
  32. //! @param absoluteLimit Limits for value (between -absoluteLimit and absoluteLimit).
  33. //! @returns A limited value. Always returns either value, -absoluteLimit or absoluteLimit.
  34. static float LimitValue(float value, float absoluteLimit);
  35. };
  36. } // namespace ROS2Controllers::VehicleDynamics