Skip to content

Commit

Permalink
Formatted code
Browse files Browse the repository at this point in the history
Signed-off-by: Mateusz Wasilewski <[email protected]>
  • Loading branch information
MateuszWasilewski committed Jul 31, 2024
1 parent 2bf527a commit 54a1c55
Show file tree
Hide file tree
Showing 45 changed files with 264 additions and 272 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace LevelModificationTools
return;
}

const auto assetIter = m_config.m_prefabVariants.begin()+variantId;
const auto assetIter = m_config.m_prefabVariants.begin() + variantId;
AZ_Warning(
"PrefabVariantComponent", assetIter != m_config.m_prefabVariants.end(), "Prefab variant with id %d not found.", variantId);
if (assetIter != m_config.m_prefabVariants.end())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace LevelModificationTools
public:
AZ_COMPONENT(PrefabVariantComponent, "{018f8611-85fc-7e0f-a879-b3a0ff793535}", AZ::Component);
PrefabVariantComponent() = default;
explicit PrefabVariantComponent(PrefabVariantConfig config);
explicit PrefabVariantComponent(PrefabVariantConfig config);
~PrefabVariantComponent() override = default;

// Component overrides
Expand Down
7 changes: 3 additions & 4 deletions Gems/Pointcloud/Code/Include/Pointcloud/PointcloudAsset.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ namespace Pointcloud
class PointcloudAsset final : public AZ::Data::AssetData
{
public:

//! The vertex data for the pointcloud
struct CloudVertex
{
Expand All @@ -27,9 +26,9 @@ namespace Pointcloud

struct CloudHeader
{
uint32_t m_magicNumber {0x0};
uint32_t m_elementSize {0x0};
uint32_t m_numPoints {0x0};
uint32_t m_magicNumber{ 0x0 };
uint32_t m_elementSize{ 0x0 };
uint32_t m_numPoints{ 0x0 };
};

static constexpr uint32_t PointcloudMagicNumber = 0x12345678;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ namespace Pointcloud
{
}


void PointcloudSystemComponent::Init()
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
#include <Pointcloud/PointcloudAsset.h>
namespace Pointcloud
{
class PointcloudSystemComponent
: public AZ::Component
class PointcloudSystemComponent : public AZ::Component
{
public:
AZ_COMPONENT_DECL(PointcloudSystemComponent);
Expand Down
5 changes: 2 additions & 3 deletions Gems/Pointcloud/Code/Source/PointcloudModuleInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@

namespace Pointcloud
{
class PointcloudModuleInterface
: public AZ::Module
class PointcloudModuleInterface : public AZ::Module
{
public:
AZ_TYPE_INFO_WITH_NAME_DECL(PointcloudModuleInterface)
Expand All @@ -28,4 +27,4 @@ namespace Pointcloud
*/
AZ::ComponentTypeList GetRequiredSystemComponents() const override;
};
}// namespace Pointcloud
} // namespace Pointcloud
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ namespace Pointcloud

m_drawSrgLayout = m_shader->GetAsset()->GetDrawSrgLayout(m_shader->GetSupervariantIndex());
AZ_Error(
"PointcloudFeatureProcessor", m_drawSrgLayout, "Failed to get the draw shader resource group layout for the pointcloud shader.");
"PointcloudFeatureProcessor",
m_drawSrgLayout,
"Failed to get the draw shader resource group layout for the pointcloud shader.");

m_drawListTag = m_shader->GetDrawListTag();

Expand Down Expand Up @@ -95,10 +97,10 @@ namespace Pointcloud
{
for (auto& [_, pcData] : m_pointcloudData)
{
if (m_meshPipelineState && pcData.m_drawSrg && pcData.m_meshStreamBufferViews.front().GetByteCount() != 0)
if (m_meshPipelineState && pcData.m_drawSrg && pcData.m_meshStreamBufferViews.front().GetByteCount() != 0)
{
pcData.m_drawPacket =
BuildDrawPacket( pcData.m_drawSrg, m_meshPipelineState, m_drawListTag, pcData.m_meshStreamBufferViews, pcData.m_vertices);
pcData.m_drawPacket = BuildDrawPacket(
pcData.m_drawSrg, m_meshPipelineState, m_drawListTag, pcData.m_meshStreamBufferViews, pcData.m_vertices);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ namespace Pointcloud
, protected AzToolsFramework::EditorEvents::Bus::Handler
{
using BaseSystemComponent = PointcloudSystemComponent;

public:
AZ_COMPONENT_DECL(PointcloudEditorSystemComponent);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
#pragma once

#include <AzCore/Component/EntityId.h>
#include <AzCore/RTTI/RTTI.h>
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/std/string/string.h>
#include <ROS2/Communication/TopicConfiguration.h>
#include <AzCore/Component/EntityId.h>
namespace ROS2PoseControl {
namespace ROS2PoseControl
{
//! A structure for a single ROS2 topic, a part of publisher or subscriber configuration.
struct ROS2PoseControlConfiguration {
struct ROS2PoseControlConfiguration
{
public:
AZ_TYPE_INFO(ROS2PoseControlConfiguration, "{4f7686d5-f44e-43a6-a1b8-f404065c6430}");

static void Reflect(AZ::ReflectContext *context);
static void Reflect(AZ::ReflectContext* context);

AZ::Crc32 isTrackingModeTF2Visibility() const;

AZ::Crc32 isTrackingModePoseMessagesVisibility() const;


AZ::Crc32 isGroudOffsetVisible() const;

enum class TrackingMode {
enum class TrackingMode
{
PoseMessages,
TF2
};
Expand All @@ -38,4 +40,4 @@ namespace ROS2PoseControl {

AZStd::string m_startOffsetTag;
};
} // namespace ROS2
} // namespace ROS2PoseControl
11 changes: 3 additions & 8 deletions Gems/ROS2PoseControl/Code/Source/Clients/ROS2PoseControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,10 @@ namespace ROS2PoseControl
geometry_msgs::msg::TransformStamped transformStamped;
std::string errorString;
if (m_tf_buffer->canTransform(
m_configuration.m_referenceFrame.c_str(),
m_configuration.m_targetFrame.c_str(),
tf2::TimePointZero,
&errorString))
m_configuration.m_referenceFrame.c_str(), m_configuration.m_targetFrame.c_str(), tf2::TimePointZero, &errorString))
{
transformStamped = m_tf_buffer->lookupTransform(
m_configuration.m_referenceFrame.c_str(),
m_configuration.m_targetFrame.c_str(),
tf2::TimePointZero);
m_configuration.m_referenceFrame.c_str(), m_configuration.m_targetFrame.c_str(), tf2::TimePointZero);
m_tf2WarningShown = false;
}
else
Expand Down Expand Up @@ -363,7 +358,7 @@ namespace ROS2PoseControl
request.m_distance = maxDistance;

AzPhysics::SceneQueryHits result = sceneInterface->QueryScene(sceneHandle, &request);
if(!m_groundNotFoundWarningShown)
if (!m_groundNotFoundWarningShown)
{
AZ_Warning("ROS2PoseControl", hitPosition.has_value(), "No ground found for the entity");
m_groundNotFoundWarningShown = !hitPosition.has_value();
Expand Down
4 changes: 1 addition & 3 deletions Gems/ROS2PoseControl/Code/Source/Clients/ROS2PoseControl.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ namespace ROS2PoseControl
void SetIsTracking(bool isTracking);

private:

//! Obtains the transform in the world tagged with the given tag name.
//! @param tagName The name of the tag to search for.
//! @return The transform of the entity with the given tag name, if it exists.
Expand All @@ -68,7 +67,7 @@ namespace ROS2PoseControl

AZ::Transform RemoveTilt(AZ::Transform transform) const;

AZStd::optional<AZ::Vector3> QueryGround(const AZ::Vector3& location, const AZ::Vector3& gravityDirection, float maxDistance);
AZStd::optional<AZ::Vector3> QueryGround(const AZ::Vector3& location, const AZ::Vector3& gravityDirection, float maxDistance);

void ApplyTransform(const AZ::Transform& transform);

Expand All @@ -88,6 +87,5 @@ namespace ROS2PoseControl
bool m_tf2WarningShown = false;
bool m_groundNotFoundWarningShown = false;
bool m_startingOffsetNotFoundWarningShown = false;

};
} // namespace ROS2PoseControl
Original file line number Diff line number Diff line change
@@ -1,74 +1,83 @@
#include <AzCore/Serialization/EditContext.h>
#include <ROS2PoseControl/ROS2PoseControlConfiguration.h>

namespace ROS2PoseControl {
AZ::Crc32 ROS2PoseControlConfiguration::isTrackingModeTF2Visibility() const {
return m_tracking_mode == TrackingMode::TF2
? AZ::Edit::PropertyVisibility::Show
: AZ::Edit::PropertyVisibility::Hide;
namespace ROS2PoseControl
{
AZ::Crc32 ROS2PoseControlConfiguration::isTrackingModeTF2Visibility() const
{
return m_tracking_mode == TrackingMode::TF2 ? AZ::Edit::PropertyVisibility::Show : AZ::Edit::PropertyVisibility::Hide;
}

AZ::Crc32 ROS2PoseControlConfiguration::isTrackingModePoseMessagesVisibility() const {
return m_tracking_mode == TrackingMode::PoseMessages
? AZ::Edit::PropertyVisibility::Show
: AZ::Edit::PropertyVisibility::Hide;
AZ::Crc32 ROS2PoseControlConfiguration::isTrackingModePoseMessagesVisibility() const
{
return m_tracking_mode == TrackingMode::PoseMessages ? AZ::Edit::PropertyVisibility::Show : AZ::Edit::PropertyVisibility::Hide;
}

AZ::Crc32 ROS2PoseControlConfiguration::isGroudOffsetVisible() const {
return m_clampToGround ? AZ::Edit::PropertyVisibility::Show
: AZ::Edit::PropertyVisibility::Hide;
AZ::Crc32 ROS2PoseControlConfiguration::isGroudOffsetVisible() const
{
return m_clampToGround ? AZ::Edit::PropertyVisibility::Show : AZ::Edit::PropertyVisibility::Hide;
}

void ROS2PoseControlConfiguration::Reflect(AZ::ReflectContext *context) {
if (auto serializeContext = azrtti_cast<AZ::SerializeContext *>(context)) {
void ROS2PoseControlConfiguration::Reflect(AZ::ReflectContext* context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<ROS2PoseControlConfiguration>()
->Version(1)
->Field("m_tracking_mode", &ROS2PoseControlConfiguration::m_tracking_mode)
->Field("m_poseTopicConfiguration", &ROS2PoseControlConfiguration::m_poseTopicConfiguration)
->Field("m_targetFrame", &ROS2PoseControlConfiguration::m_targetFrame)
->Field("m_referenceFrame", &ROS2PoseControlConfiguration::m_referenceFrame)
->Field("lockZAxis", &ROS2PoseControlConfiguration::m_lockZAxis)
->Field("startOffsetTag", &ROS2PoseControlConfiguration::m_startOffsetTag)
->Field("m_clampToGround", &ROS2PoseControlConfiguration::m_clampToGround)
->Field("m_groundOffset", &ROS2PoseControlConfiguration::m_groundOffset);
->Version(1)
->Field("m_tracking_mode", &ROS2PoseControlConfiguration::m_tracking_mode)
->Field("m_poseTopicConfiguration", &ROS2PoseControlConfiguration::m_poseTopicConfiguration)
->Field("m_targetFrame", &ROS2PoseControlConfiguration::m_targetFrame)
->Field("m_referenceFrame", &ROS2PoseControlConfiguration::m_referenceFrame)
->Field("lockZAxis", &ROS2PoseControlConfiguration::m_lockZAxis)
->Field("startOffsetTag", &ROS2PoseControlConfiguration::m_startOffsetTag)
->Field("m_clampToGround", &ROS2PoseControlConfiguration::m_clampToGround)
->Field("m_groundOffset", &ROS2PoseControlConfiguration::m_groundOffset);

if (AZ::EditContext *ec = serializeContext->GetEditContext()) {
ec->Class<ROS2PoseControlConfiguration>("ROS2PoseControlConfiguration",
"Sub configuration for ROS2PoseControl component")
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
->DataElement(
AZ::Edit::UIHandlers::ComboBox,
&ROS2PoseControlConfiguration::m_tracking_mode,
"Tracking Mode",
"Selects tracking mode")
->EnumAttribute(TrackingMode::PoseMessages, "Pose Messages")
->EnumAttribute(TrackingMode::TF2, "TF2")
->Attribute(AZ::Edit::Attributes::ChangeNotify, AZ::Edit::PropertyRefreshLevels::EntireTree)
->DataElement(
AZ::Edit::UIHandlers::Default,
&ROS2PoseControlConfiguration::m_poseTopicConfiguration,
"Topic for control message",
"Configuration for ROS2 topic to receive control messages to")
->Attribute(AZ::Edit::Attributes::Visibility,
&ROS2PoseControlConfiguration::isTrackingModePoseMessagesVisibility)
->DataElement(AZ::Edit::UIHandlers::Default, &ROS2PoseControlConfiguration::m_targetFrame,
"Target Frame", "Frame to track eg. base_link")
->Attribute(AZ::Edit::Attributes::Visibility,
&ROS2PoseControlConfiguration::isTrackingModeTF2Visibility)
->DataElement(AZ::Edit::UIHandlers::Default, &ROS2PoseControlConfiguration::m_referenceFrame,
"Reference Frame", "Reference frame eg. map")
->Attribute(AZ::Edit::Attributes::Visibility,
&ROS2PoseControlConfiguration::isTrackingModeTF2Visibility)
->DataElement(AZ::Edit::UIHandlers::Default, &ROS2PoseControlConfiguration::m_lockZAxis,
"Lock Z Axis", "Lock Z axis")
->DataElement(AZ::Edit::UIHandlers::Default, &ROS2PoseControlConfiguration::m_startOffsetTag,
"Start Offset Tag", "Tag that will be used to set the start offset for the entity.")
->DataElement(AZ::Edit::UIHandlers::Default, &ROS2PoseControlConfiguration::m_clampToGround,
"Clamp to Ground", "Clamp to ground")
->DataElement(AZ::Edit::UIHandlers::Default, &ROS2PoseControlConfiguration::m_groundOffset, "Ground Offset",
"Offset from the ground")
->Attribute(AZ::Edit::Attributes::Visibility, &ROS2PoseControlConfiguration::isGroudOffsetVisible);
if (AZ::EditContext* ec = serializeContext->GetEditContext())
{
ec->Class<ROS2PoseControlConfiguration>("ROS2PoseControlConfiguration", "Sub configuration for ROS2PoseControl component")
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
->DataElement(
AZ::Edit::UIHandlers::ComboBox,
&ROS2PoseControlConfiguration::m_tracking_mode,
"Tracking Mode",
"Selects tracking mode")
->EnumAttribute(TrackingMode::PoseMessages, "Pose Messages")
->EnumAttribute(TrackingMode::TF2, "TF2")
->Attribute(AZ::Edit::Attributes::ChangeNotify, AZ::Edit::PropertyRefreshLevels::EntireTree)
->DataElement(
AZ::Edit::UIHandlers::Default,
&ROS2PoseControlConfiguration::m_poseTopicConfiguration,
"Topic for control message",
"Configuration for ROS2 topic to receive control messages to")
->Attribute(AZ::Edit::Attributes::Visibility, &ROS2PoseControlConfiguration::isTrackingModePoseMessagesVisibility)
->DataElement(
AZ::Edit::UIHandlers::Default,
&ROS2PoseControlConfiguration::m_targetFrame,
"Target Frame",
"Frame to track eg. base_link")
->Attribute(AZ::Edit::Attributes::Visibility, &ROS2PoseControlConfiguration::isTrackingModeTF2Visibility)
->DataElement(
AZ::Edit::UIHandlers::Default,
&ROS2PoseControlConfiguration::m_referenceFrame,
"Reference Frame",
"Reference frame eg. map")
->Attribute(AZ::Edit::Attributes::Visibility, &ROS2PoseControlConfiguration::isTrackingModeTF2Visibility)
->DataElement(AZ::Edit::UIHandlers::Default, &ROS2PoseControlConfiguration::m_lockZAxis, "Lock Z Axis", "Lock Z axis")
->DataElement(
AZ::Edit::UIHandlers::Default,
&ROS2PoseControlConfiguration::m_startOffsetTag,
"Start Offset Tag",
"Tag that will be used to set the start offset for the entity.")
->DataElement(
AZ::Edit::UIHandlers::Default, &ROS2PoseControlConfiguration::m_clampToGround, "Clamp to Ground", "Clamp to ground")
->DataElement(
AZ::Edit::UIHandlers::Default,
&ROS2PoseControlConfiguration::m_groundOffset,
"Ground Offset",
"Offset from the ground")
->Attribute(AZ::Edit::Attributes::Visibility, &ROS2PoseControlConfiguration::isGroudOffsetVisible);
}
}
};
} // namespace ROS2
} // namespace ROS2PoseControl
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@

#include "ROS2PoseControlSystemComponent.h"
#include <ROS2PoseControl/ROS2PoseControlTypeIds.h>
#include <ROS2PoseControlModuleInterface.h>
#include "ROS2PoseControlSystemComponent.h"

namespace ROS2PoseControl
{
class ROS2PoseControlModule
: public ROS2PoseControlModuleInterface
class ROS2PoseControlModule : public ROS2PoseControlModuleInterface
{
public:
AZ_RTTI(ROS2PoseControlModule, ROS2PoseControlModuleTypeId, ROS2PoseControlModuleInterface);
AZ_CLASS_ALLOCATOR(ROS2PoseControlModule, AZ::SystemAllocator);
};
}// namespace ROS2PoseControl
} // namespace ROS2PoseControl

AZ_DECLARE_MODULE_CLASS(Gem_ROS2PoseControl, ROS2PoseControl::ROS2PoseControlModule)
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,14 @@

namespace ROS2PoseControl
{
AZ_COMPONENT_IMPL(ROS2PoseControlSystemComponent, "ROS2PoseControlSystemComponent",
ROS2PoseControlSystemComponentTypeId);
AZ_COMPONENT_IMPL(ROS2PoseControlSystemComponent, "ROS2PoseControlSystemComponent", ROS2PoseControlSystemComponentTypeId);

void ROS2PoseControlSystemComponent::Reflect(AZ::ReflectContext* context)
{
ROS2PoseControlConfiguration::Reflect(context);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<ROS2PoseControlSystemComponent, AZ::Component>()
->Version(0)
;
serializeContext->Class<ROS2PoseControlSystemComponent, AZ::Component>()->Version(0);
}
}

Expand Down Expand Up @@ -60,5 +57,4 @@ namespace ROS2PoseControl
{
}


} // namespace ROS2PoseControl
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@

namespace ROS2PoseControl
{
class ROS2PoseControlSystemComponent
: public AZ::Component
class ROS2PoseControlSystemComponent : public AZ::Component
{
public:
AZ_COMPONENT_DECL(ROS2PoseControlSystemComponent);
Expand Down
Loading

0 comments on commit 54a1c55

Please sign in to comment.