Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
442 changes: 213 additions & 229 deletions Project/Assets/Kraken/apple_kraken_v1/apple_kraken_v1.prefab

Large diffs are not rendered by default.

455 changes: 219 additions & 236 deletions Project/Assets/Kraken/apple_kraken_v2/apple_kraken_v2.prefab

Large diffs are not rendered by default.

3,522 changes: 3,522 additions & 0 deletions Project/Assets/Kraken/nose_middle_script.scriptcanvas

Large diffs are not rendered by default.

64 changes: 61 additions & 3 deletions Project/Gem/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ ly_add_target(
Gem::AtomLyIntegration_CommonFeatures.Editor.Static
Gem::Atom_AtomBridge.Static
Gem::ImGui.Static
Gem::PhysX.Static
)

target_depends_on_ros2_packages(ROSConDemo.Static std_srvs nav_msgs vision_msgs)
Expand All @@ -70,12 +71,69 @@ ly_add_target(
AZ::AzFramework
)

# if enabled, ROSConDemo is used by all kinds of applications
ly_create_alias(NAME ROSConDemo.Builders NAMESPACE Gem TARGETS Gem::ROSConDemo)
ly_create_alias(NAME ROSConDemo.Tools NAMESPACE Gem TARGETS Gem::ROSConDemo)
# By default, we will specify that the above target ROSConDemo would be used by
# Client and Server type targets when this gem is enabled. If you don't want it
# active in Clients or Servers by default, delete one or more of the following lines:
ly_create_alias(NAME ROSConDemo.Clients NAMESPACE Gem TARGETS Gem::ROSConDemo)
ly_create_alias(NAME ROSConDemo.Servers NAMESPACE Gem TARGETS Gem::ROSConDemo)

# If we are on a host platform, we want to add the host tools targets like the ROSConDemo.Editor target which
# will also depend on ROSConDemo.Static
if(PAL_TRAIT_BUILD_HOST_TOOLS)
ly_add_target(
NAME ROSConDemo.Editor.Static STATIC
NAMESPACE Gem
AUTOMOC
AUTORCC
FILES_CMAKE
roscondemo_editor_files.cmake
INCLUDE_DIRECTORIES
PRIVATE
Source
PUBLIC
Include
COMPILE_DEFINITIONS
PRIVATE
ROSConDemo_EDITOR
BUILD_DEPENDENCIES
PUBLIC
AZ::AzToolsFramework
Gem::AtomLyIntegration_CommonFeatures.Editor.Static
Gem::LmbrCentral.API
Gem::ROS2.Editor.Static
Gem::ROSConDemo.Static
PRIVATE
)

find_package(urdfdom)
target_link_libraries(ROSConDemo.Editor.Static PUBLIC urdfdom::urdfdom_model)

ly_add_target(
NAME ROSConDemo.Editor GEM_MODULE
NAMESPACE Gem
FILES_CMAKE
roscondemo_editor_shared_files.cmake
COMPILE_DEFINITIONS
PRIVATE
ROSConDemo_EDITOR
INCLUDE_DIRECTORIES
PRIVATE
Source
PUBLIC
Include
BUILD_DEPENDENCIES
PUBLIC
Gem::ROSConDemo.Editor.Static
Gem::Atom_Feature_Common.Static
)

# By default, we will specify that the above target ROSConDemo would be used by
# Tool and Builder type targets when this gem is enabled. If you don't want it
# active in Tools or Builders by default, delete one or both of the following lines:
ly_create_alias(NAME ROSConDemo.Tools NAMESPACE Gem TARGETS Gem::ROSConDemo.Editor)
ly_create_alias(NAME ROSConDemo.Builders NAMESPACE Gem TARGETS Gem::ROSConDemo.Editor)
endif()

################################################################################
# Gem dependencies
################################################################################
Expand Down
20 changes: 10 additions & 10 deletions Project/Gem/Source/Manipulator/KrakenManipulatorController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

#include "KrakenManipulatorController.h"
#include <ROS2/Manipulator/MotorizedJointBus.h>
#include <ROS2/Manipulation/MotorizedJoints/PidMotorControllerBus.h>
#include <AzCore/Serialization/EditContext.h>

#include <AzFramework/Components/TransformComponent.h>
Expand Down Expand Up @@ -103,11 +103,11 @@ namespace AppleKraken
float error_x = std::numeric_limits<float>::max();
float error_z = std::numeric_limits<float>::max();

ROS2::MotorizedJointRequestBus::Event(m_entityX, &ROS2::MotorizedJointRequest::SetSetpoint, m_setPointX);
ROS2::MotorizedJointRequestBus::EventResult(error_x, m_entityX, &ROS2::MotorizedJointRequest::GetError);
ROS2::PidMotorControllerRequestBus::Event(m_entityX, &ROS2::PidMotorControllerRequests::SetSetpoint, m_setPointX);
ROS2::PidMotorControllerRequestBus::EventResult(error_x, m_entityX, &ROS2::PidMotorControllerRequests::GetError);

ROS2::MotorizedJointRequestBus::Event(m_entityZ, &ROS2::MotorizedJointRequest::SetSetpoint, m_setPointZ);
ROS2::MotorizedJointRequestBus::EventResult(error_z, m_entityZ, &ROS2::MotorizedJointRequest::GetError);
ROS2::PidMotorControllerRequestBus::Event(m_entityZ, &ROS2::PidMotorControllerRequests::SetSetpoint, m_setPointZ);
ROS2::PidMotorControllerRequestBus::EventResult(error_z, m_entityZ, &ROS2::PidMotorControllerRequests::GetError);

// auto - disable nose retrieve only if we reached small error.
if (m_noseRetrieveRequest == true)
Expand All @@ -133,7 +133,7 @@ namespace AppleKraken
if (m_time_Y_ok > m_timeSetpointReach)
{
float error_y = std::numeric_limits<float>::max();
ROS2::MotorizedJointRequestBus::EventResult(error_y, m_entityY, &ROS2::MotorizedJointRequest::GetError);
ROS2::PidMotorControllerRequestBus::EventResult(error_y, m_entityY, &ROS2::PidMotorControllerRequests::GetError);
if (error_y < max_errorY && error_y > -max_errorY)
{
m_noseRetrievingSuccess = true;
Expand All @@ -145,7 +145,7 @@ namespace AppleKraken
{
m_noseRetrievingSuccess = false;
}
ROS2::MotorizedJointRequestBus::Event(m_entityY, &ROS2::MotorizedJointRequest::SetSetpoint, m_setPointY);
ROS2::PidMotorControllerRequestBus::Event(m_entityY, &ROS2::PidMotorControllerRequests::SetSetpoint, m_setPointY);
}

}
Expand All @@ -164,9 +164,9 @@ namespace AppleKraken
float x{0};
float y{0};
float z{0};
ROS2::MotorizedJointRequestBus::EventResult(x, m_entityX, &ROS2::MotorizedJointRequest::GetCurrentMeasurement);
ROS2::MotorizedJointRequestBus::EventResult(y, m_entityY, &ROS2::MotorizedJointRequest::GetCurrentMeasurement);
ROS2::MotorizedJointRequestBus::EventResult(z, m_entityZ, &ROS2::MotorizedJointRequest::GetCurrentMeasurement);
ROS2::PidMotorControllerRequestBus::EventResult(x, m_entityX, &ROS2::PidMotorControllerRequests::GetCurrentMeasurement);
ROS2::PidMotorControllerRequestBus::EventResult(y, m_entityY, &ROS2::PidMotorControllerRequests::GetCurrentMeasurement);
ROS2::PidMotorControllerRequestBus::EventResult(z, m_entityZ, &ROS2::PidMotorControllerRequests::GetCurrentMeasurement);
return AZ::Vector3{x,y,z};
};

Expand Down
4 changes: 2 additions & 2 deletions Project/Gem/Source/Manipulator/KrakenManipulatorController.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ namespace AppleKraken

AZ::Vector3 m_desiredPosition{0, 0, 0 };
AZStd::optional<AZ::Vector3> m_desiredApple;
bool m_noseRetrieveRequest{false };
bool m_noseRetrievingSuccess{false};
bool m_noseRetrieveRequest{ false };
bool m_noseRetrievingSuccess{ false };

AZ::Vector3 m_vectorX{1, 0, 0 };
AZ::Vector3 m_vectorY{0, 1, 0 };
Expand Down
43 changes: 43 additions & 0 deletions Project/Gem/Source/ROSConDemoEditorModule.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* 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 <QtCore/qglobal.h>
#include <ROSConDemoModuleInterface.h>
#include <ROSConDemoEditorSystemComponent.h>

namespace ROSConDemo
{
class ROSConDemoEditorModule : public ROSConDemoModuleInterface
{
public:
AZ_RTTI(ROSConDemoEditorModule, "{ca41105c-1c8c-1db7-72fe-c20cd0160c76}", ROSConDemoModuleInterface);
AZ_CLASS_ALLOCATOR(ROSConDemoEditorModule, AZ::SystemAllocator);

ROSConDemoEditorModule()
{
m_descriptors.insert(
m_descriptors.end(),
{
ROSConDemoEditorSystemComponent::CreateDescriptor(),
});
}

/**
* Add required SystemComponents to the SystemEntity.
* Non-SystemComponents should not be added here
*/
AZ::ComponentTypeList GetRequiredSystemComponents() const override
{
return AZ::ComponentTypeList{
azrtti_typeid<ROSConDemoEditorSystemComponent>(),
};
}
};
} // namespace ROSConDemo

AZ_DECLARE_MODULE_CLASS(Gem_ROSConDemo, ROSConDemo::ROSConDemoEditorModule)
69 changes: 69 additions & 0 deletions Project/Gem/Source/ROSConDemoEditorSystemComponent.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
* 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 "ROSConDemoSystemComponent.h"
#include <AzCore/Component/ComponentApplicationBus.h>
#include <AzCore/Serialization/SerializeContext.h>
#include <ROSConDemoEditorSystemComponent.h>

namespace ROSConDemo
{
void ROSConDemoEditorSystemComponent::Reflect(AZ::ReflectContext* context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<ROSConDemoEditorSystemComponent, ROSConDemoSystemComponent>()->Version(0);
}
}

ROSConDemoEditorSystemComponent::ROSConDemoEditorSystemComponent() = default;

ROSConDemoEditorSystemComponent::~ROSConDemoEditorSystemComponent() = default;

void ROSConDemoEditorSystemComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
{
ROSConDemoSystemComponent::GetProvidedServices(provided);
provided.push_back(AZ_CRC_CE("ROSConDemoEditorService"));
}

void ROSConDemoEditorSystemComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
{
ROSConDemoSystemComponent::GetIncompatibleServices(incompatible);
incompatible.push_back(AZ_CRC_CE("ROSConDemoEditorService"));
}

void ROSConDemoEditorSystemComponent::GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required)
{
required.push_back(AZ_CRC_CE("ROS2EditorService"));
ROSConDemoSystemComponent::GetRequiredServices(required);
}

void ROSConDemoEditorSystemComponent::GetDependentServices([[maybe_unused]] AZ::ComponentDescriptor::DependencyArrayType& dependent)
{
ROSConDemoSystemComponent::GetDependentServices(dependent);
}

void ROSConDemoEditorSystemComponent::Activate()
{
AzToolsFramework::EditorEntityContextNotificationBus::Handler::BusConnect();
}

void ROSConDemoEditorSystemComponent::Deactivate()
{
AzToolsFramework::EditorEntityContextNotificationBus::Handler::BusDisconnect();
}

void ROSConDemoEditorSystemComponent::OnStartPlayInEditor()
{
ROSConDemoSystemComponent::Activate();
}
void ROSConDemoEditorSystemComponent::OnStopPlayInEditorBegin()
{
ROSConDemoSystemComponent::Deactivate();
}

} // namespace ROS2
47 changes: 47 additions & 0 deletions Project/Gem/Source/ROSConDemoEditorSystemComponent.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* 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
*
*/
#pragma once

#include <ROSConDemoSystemComponent.h>

#include <AzToolsFramework/Entity/EditorEntityContextBus.h>

namespace ROSConDemo
{
/// System component for ROS2 editor
class ROSConDemoEditorSystemComponent
: public ROSConDemoSystemComponent
, private AzToolsFramework::EditorEntityContextNotificationBus::Handler
{

public:
AZ_COMPONENT(ROSConDemoEditorSystemComponent, "{96e4d699-8ebf-f2cc-9c6f-7791d697e1fa}", ROSConDemoSystemComponent);
static void Reflect(AZ::ReflectContext* context);

ROSConDemoEditorSystemComponent();
~ROSConDemoEditorSystemComponent();

private:
static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided);
static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible);
static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
static void GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent);

//////////////////////////////////////////////////////////////////////////
// Component overrides
void Activate() override;
void Deactivate() override;
//////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////
// EditorEntityContextNotificationBus overrides
void OnStartPlayInEditor() override;
void OnStopPlayInEditorBegin() override;
//////////////////////////////////////////////////////////////////////////
};
} // namespace ROSConDemo
38 changes: 6 additions & 32 deletions Project/Gem/Source/ROSConDemoModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,46 +6,20 @@
*
*/

#include "ApplePicker/ApplePickerComponent.h"
#include "ApplePicker/GatheringRowComponent.h"
#include "ApplePicker/KrakenEffectorComponent.h"
#include "DemoStatistics/DemoStatisticsComponent.h"
#include "FruitStorage/FruitStorageComponent.h"
#include "Manipulator/KrakenManipulatorController.h"
#include "KrakenCamera/FollowingCameraComponent.h"
#include "ROSConDemoSystemComponent.h"

#include "ROSConDemoModuleInterface.h"
#include <AzCore/Memory/SystemAllocator.h>
#include <AzCore/Module/Module.h>
#include <ROS2/ROS2Bus.h>


namespace ROSConDemo
{
class ROSConDemoModule : public AZ::Module
class ROSConDemoModule : public ROSConDemoModuleInterface
{
public:
AZ_RTTI(ROSConDemoModule, "{E38575E4-7D2F-4617-B938-416E8C1C07B4}", AZ::Module);
AZ_RTTI(ROSConDemoModule, "{E38575E4-7D2F-4617-B938-416E8C1C07B4}", ROSConDemoModuleInterface);
AZ_CLASS_ALLOCATOR(ROSConDemoModule, AZ::SystemAllocator, 0);

ROSConDemoModule()
: AZ::Module()
{
m_descriptors.insert(
m_descriptors.end(),
{ ROSConDemoSystemComponent::CreateDescriptor(),
AppleKraken::ApplePickerComponent::CreateDescriptor(),
AppleKraken::GatheringRowComponent::CreateDescriptor(),
AppleKraken::KrakenEffectorComponent::CreateDescriptor(),
AppleKraken::FruitStorageComponent::CreateDescriptor(),
AppleKraken::DemoStatisticsComponent::CreateDescriptor(),
AppleKraken::ManipulatorController::CreateDescriptor(),
AppleKraken::FollowingCameraComponent::CreateDescriptor() });
}

AZ::ComponentTypeList GetRequiredSystemComponents() const override
{
return AZ::ComponentTypeList{
azrtti_typeid<ROSConDemoSystemComponent>(),
};
}
};
} // namespace ROSConDemo

Expand Down
Loading