VehicleConfiguration.cpp 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. #include "Utilities.h"
  9. #include <AzCore/Debug/Trace.h>
  10. #include <AzCore/Serialization/EditContext.h>
  11. #include <AzCore/Serialization/EditContextConstants.inl>
  12. #include <AzCore/Serialization/SerializeContext.h>
  13. #include <ROS2Controllers/VehicleDynamics/VehicleConfiguration.h>
  14. namespace ROS2Controllers::VehicleDynamics
  15. {
  16. void VehicleConfiguration::Reflect(AZ::ReflectContext* context)
  17. {
  18. AxleConfiguration::Reflect(context);
  19. if (AZ::SerializeContext* serialize = azrtti_cast<AZ::SerializeContext*>(context))
  20. {
  21. serialize->Class<VehicleConfiguration>()
  22. ->Version(1)
  23. ->Field("AxlesConfigurations", &VehicleConfiguration::m_axles)
  24. ->Field("Track", &VehicleConfiguration::m_track)
  25. ->Field("Wheelbase", &VehicleConfiguration::m_wheelbase);
  26. if (AZ::EditContext* ec = serialize->GetEditContext())
  27. {
  28. ec->Class<VehicleConfiguration>("Vehicle configuration", "Configuration of vehicle")
  29. ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
  30. ->Attribute(AZ::Edit::Attributes::Category, "ROS2")
  31. ->DataElement(
  32. AZ::Edit::UIHandlers::Default, &VehicleConfiguration::m_axles, "Axles", "Configurations of axles for this vehicle")
  33. ->Attribute(AZ::Edit::Attributes::AutoExpand, true)
  34. ->DataElement(
  35. AZ::Edit::UIHandlers::Default,
  36. &VehicleConfiguration::m_track,
  37. "Track",
  38. "The distance in meters between the hub flanges on an axle")
  39. ->DataElement(
  40. AZ::Edit::UIHandlers::Default,
  41. &VehicleConfiguration::m_wheelbase,
  42. "Wheelbase",
  43. "The distance in meters between the midpoints of vehicles front and rear wheels");
  44. }
  45. }
  46. }
  47. } // namespace ROS2Controllers::VehicleDynamics