Browse Source

Removed redundant and unnecessary UI settings

Signed-off-by: Paweł Budziszewski <[email protected]>
Signed-off-by: Michał Pełka <[email protected]>
Paweł Budziszewski 2 years ago
parent
commit
6deda3f194

+ 3 - 9
Project/Gem/Source/ApplePicker/KrakenEffectorComponent.cpp

@@ -52,6 +52,9 @@ namespace AppleKraken
         ApplePickingRequestBus::Handler::BusConnect(GetEntityId());
         ApplePickingRequestBus::Handler::BusConnect(GetEntityId());
         AZ::TickBus::Handler::BusConnect();
         AZ::TickBus::Handler::BusConnect();
 
 
+        EBUS_EVENT_ID_RESULT(m_appleProbe, m_manipulatorEntity, ManipulatorRequestBus, GetEffectorEntity);
+        EBUS_EVENT_ID_RESULT(m_restEntityId, m_manipulatorEntity, ManipulatorRequestBus, GetRestEntity);
+
         m_onTriggerHandleBeginHandler = AzPhysics::SimulatedBodyEvents::OnTriggerEnter::Handler(
         m_onTriggerHandleBeginHandler = AzPhysics::SimulatedBodyEvents::OnTriggerEnter::Handler(
             [&]([[maybe_unused]] AzPhysics::SimulatedBodyHandle bodyHandle, [[maybe_unused]] const AzPhysics::TriggerEvent& event)
             [&]([[maybe_unused]] AzPhysics::SimulatedBodyHandle bodyHandle, [[maybe_unused]] const AzPhysics::TriggerEvent& event)
             {
             {
@@ -101,10 +104,8 @@ namespace AppleKraken
                 ->Version(4)
                 ->Version(4)
                 ->Field("ReachEntity", &KrakenEffectorComponent::m_reachEntity)
                 ->Field("ReachEntity", &KrakenEffectorComponent::m_reachEntity)
                 ->Field("ManipulatorEntity", &KrakenEffectorComponent::m_manipulatorEntity)
                 ->Field("ManipulatorEntity", &KrakenEffectorComponent::m_manipulatorEntity)
-                ->Field("AppleProbe", &KrakenEffectorComponent::m_appleProbe)
                 ->Field("RootManipulatorFreeze", &KrakenEffectorComponent::m_rootEntityToFreeze)
                 ->Field("RootManipulatorFreeze", &KrakenEffectorComponent::m_rootEntityToFreeze)
                 ->Field("BaseLinkToKinematic", &KrakenEffectorComponent::m_baseLinkToKinematic)
                 ->Field("BaseLinkToKinematic", &KrakenEffectorComponent::m_baseLinkToKinematic)
-                ->Field("RestEntity", &KrakenEffectorComponent::m_restEntityId)
                 ->Field("PickStabilizeTime", &KrakenEffectorComponent::m_stabilize_time)
                 ->Field("PickStabilizeTime", &KrakenEffectorComponent::m_stabilize_time)
                 ->Field("MaxPickingTime", &KrakenEffectorComponent::m_maxPickingTime);
                 ->Field("MaxPickingTime", &KrakenEffectorComponent::m_maxPickingTime);
 
 
@@ -124,8 +125,6 @@ namespace AppleKraken
                         &KrakenEffectorComponent::m_manipulatorEntity,
                         &KrakenEffectorComponent::m_manipulatorEntity,
                         "Entity with manipulator",
                         "Entity with manipulator",
                         "The entity that has a component handling events from ManipulatorRequestBus")
                         "The entity that has a component handling events from ManipulatorRequestBus")
-                    ->DataElement(
-                        AZ::Edit::UIHandlers::EntityId, &KrakenEffectorComponent::m_appleProbe, "Entity to probe apples", "Sucking collider")
                     ->DataElement(
                     ->DataElement(
                         AZ::Edit::UIHandlers::EntityId,
                         AZ::Edit::UIHandlers::EntityId,
                         &KrakenEffectorComponent::m_rootEntityToFreeze,
                         &KrakenEffectorComponent::m_rootEntityToFreeze,
@@ -136,11 +135,6 @@ namespace AppleKraken
                         &KrakenEffectorComponent::m_baseLinkToKinematic,
                         &KrakenEffectorComponent::m_baseLinkToKinematic,
                         "BaseLinkToKinematic",
                         "BaseLinkToKinematic",
                         "BaseLinkToKinematic during manipulator movement")
                         "BaseLinkToKinematic during manipulator movement")
-                    ->DataElement(
-                        AZ::Edit::UIHandlers::EntityId,
-                        &KrakenEffectorComponent::m_restEntityId,
-                        "ManipulatorRestPoint",
-                        "ManipulatorRestPoint")
                     ->DataElement(
                     ->DataElement(
                         AZ::Edit::UIHandlers::EntityId,
                         AZ::Edit::UIHandlers::EntityId,
                         &KrakenEffectorComponent::m_stabilize_time,
                         &KrakenEffectorComponent::m_stabilize_time,

+ 17 - 8
Project/Gem/Source/Manipulator/KrakenManipulatorController.cpp

@@ -52,8 +52,7 @@ namespace AppleKraken
                 ->Field("RestEntity", &ManipulatorController::m_restEntity)
                 ->Field("RestEntity", &ManipulatorController::m_restEntity)
                 ->Field("m_effector", &ManipulatorController::m_effector)
                 ->Field("m_effector", &ManipulatorController::m_effector)
                 ->Field("max_errorXZ", &ManipulatorController::max_errorXZ)
                 ->Field("max_errorXZ", &ManipulatorController::max_errorXZ)
-                ->Field("max_errorY", &ManipulatorController::max_errorY)
-                ->Field("timeSetpointReach", &ManipulatorController::m_timeSetpointReach);
+                ->Field("max_errorY", &ManipulatorController::max_errorY);
 
 
             if (AZ::EditContext* ec = serialize->GetEditContext())
             if (AZ::EditContext* ec = serialize->GetEditContext())
             {
             {
@@ -70,12 +69,7 @@ namespace AppleKraken
                     ->DataElement(AZ::Edit::UIHandlers::EntityId, &ManipulatorController::m_effector, "Effector", "Effector")
                     ->DataElement(AZ::Edit::UIHandlers::EntityId, &ManipulatorController::m_effector, "Effector", "Effector")
                     ->DataElement(AZ::Edit::UIHandlers::EntityId, &ManipulatorController::m_restEntity, "Rest entity", "Rest Entity")
                     ->DataElement(AZ::Edit::UIHandlers::EntityId, &ManipulatorController::m_restEntity, "Rest entity", "Rest Entity")
                     ->DataElement(AZ::Edit::UIHandlers::EntityId, &ManipulatorController::max_errorXZ, "max_errorXZ", "max error XZ to retract nose")
                     ->DataElement(AZ::Edit::UIHandlers::EntityId, &ManipulatorController::max_errorXZ, "max_errorXZ", "max error XZ to retract nose")
-                    ->DataElement(AZ::Edit::UIHandlers::EntityId, &ManipulatorController::max_errorY, "max_errorY", "max error Y to retract nose")
-                    ->DataElement(
-                        AZ::Edit::UIHandlers::EntityId,
-                        &ManipulatorController::m_timeSetpointReach,
-                        "SetPoint Reach time",
-                        "SetPoint reach time");
+                    ->DataElement(AZ::Edit::UIHandlers::EntityId, &ManipulatorController::max_errorY, "max_errorY", "max error Y to retract nose");
             }
             }
         }
         }
     }
     }
@@ -177,6 +171,11 @@ namespace AppleKraken
                 component_y->SetSetpoint(setpoint_y);
                 component_y->SetSetpoint(setpoint_y);
             }
             }
         }
         }
+        //auto currentPosition = GetPosition();
+        AZ_Printf("ManipulatorController", "#### [%f, %f, %f]  [%f, %f, %f]\n",setpoint_x, setpoint_y, setpoint_z, 
+                getMotorizedJoint(m_entityX)->GetCurrentPosition(),
+                getMotorizedJoint(m_entityY)->GetCurrentPosition(),
+                getMotorizedJoint(m_entityZ)->GetCurrentPosition());
     }
     }
 
 
     void ManipulatorController::PickApple(const AZ::Vector3 position)
     void ManipulatorController::PickApple(const AZ::Vector3 position)
@@ -228,4 +227,14 @@ namespace AppleKraken
         return m_noseRetrievingSuccess;
         return m_noseRetrievingSuccess;
     }
     }
 
 
+    AZ::EntityId ManipulatorController::GetEffectorEntity()
+    {
+        return m_effector;
+    }
+
+    AZ::EntityId ManipulatorController::GetRestEntity()
+    {
+        return m_restEntity;
+    }
+
 } // namespace AppleKraken
 } // namespace AppleKraken

+ 2 - 0
Project/Gem/Source/Manipulator/KrakenManipulatorController.h

@@ -42,6 +42,8 @@ namespace AppleKraken
         void RetrieveNose() override;
         void RetrieveNose() override;
         int GetStatus() override;
         int GetStatus() override;
         bool IsNoseRetreived() override;
         bool IsNoseRetreived() override;
+        AZ::EntityId GetEffectorEntity() override;
+        AZ::EntityId GetRestEntity() override;
 
 
         void ResetTimer();
         void ResetTimer();
 
 

+ 14 - 0
Project/Gem/Source/Manipulator/ManipulatorRequestBus.cpp

@@ -43,6 +43,18 @@ namespace AppleKraken
         CallResult(p, FN_IsNoseRetreived);
         CallResult(p, FN_IsNoseRetreived);
         return p;
         return p;
     }
     }
+    AZ::EntityId ManipulatorRequestHandler::GetEffectorEntity()
+    {
+        AZ::EntityId p;
+        CallResult(p, FN_GetEffectorEntity);
+        return p;
+    }
+    AZ::EntityId ManipulatorRequestHandler::GetRestEntity()
+    {
+        AZ::EntityId p;
+        CallResult(p, FN_GetRestEntity);
+        return p;
+    }
 
 
 
 
     void ManipulatorRequestHandler::Reflect(AZ::ReflectContext* context)
     void ManipulatorRequestHandler::Reflect(AZ::ReflectContext* context)
@@ -55,6 +67,8 @@ namespace AppleKraken
                 ->Event("GetPosition", &ManipulatorRequestBus::Events::GetPosition)
                 ->Event("GetPosition", &ManipulatorRequestBus::Events::GetPosition)
                 ->Event("Retrieve", &ManipulatorRequestBus::Events::Retrieve)
                 ->Event("Retrieve", &ManipulatorRequestBus::Events::Retrieve)
                 ->Event("GetStatus", &ManipulatorRequestBus::Events::GetStatus)
                 ->Event("GetStatus", &ManipulatorRequestBus::Events::GetStatus)
+                ->Event("GetEffectorEntity", &ManipulatorRequestBus::Events::GetEffectorEntity)
+                ->Event("GetRestEntity", &ManipulatorRequestBus::Events::GetRestEntity)
                 ->Event("IsNoseRetreived", &ManipulatorRequestBus::Events::IsNoseRetreived)
                 ->Event("IsNoseRetreived", &ManipulatorRequestBus::Events::IsNoseRetreived)
                 ->Event("RetrieveNose", &ManipulatorRequestBus::Events::RetrieveNose);
                 ->Event("RetrieveNose", &ManipulatorRequestBus::Events::RetrieveNose);
         }
         }

+ 9 - 1
Project/Gem/Source/Manipulator/ManipulatorRequestBus.h

@@ -26,6 +26,8 @@ namespace AppleKraken
         virtual void RetrieveNose() = 0;
         virtual void RetrieveNose() = 0;
         virtual int GetStatus() = 0;
         virtual int GetStatus() = 0;
         virtual bool IsNoseRetreived() = 0;
         virtual bool IsNoseRetreived() = 0;
+        virtual AZ::EntityId GetEffectorEntity() = 0;
+        virtual AZ::EntityId GetRestEntity() = 0;
     };
     };
 
 
     using ManipulatorRequestBus = AZ::EBus<ManipulatorRequest>;
     using ManipulatorRequestBus = AZ::EBus<ManipulatorRequest>;
@@ -45,7 +47,9 @@ namespace AppleKraken
             Retrieve,
             Retrieve,
             RetrieveNose,
             RetrieveNose,
             GetStatus,
             GetStatus,
-            IsNoseRetreived);
+            IsNoseRetreived,
+            GetEffectorEntity,
+            GetRestEntity);
 
 
         virtual void PickApple(const AZ::Vector3 position) override;
         virtual void PickApple(const AZ::Vector3 position) override;
 
 
@@ -59,6 +63,10 @@ namespace AppleKraken
 
 
         virtual bool IsNoseRetreived() override;
         virtual bool IsNoseRetreived() override;
 
 
+        virtual AZ::EntityId GetEffectorEntity() override;
+
+        virtual AZ::EntityId GetRestEntity() override;
+
         static void Reflect(AZ::ReflectContext* context);
         static void Reflect(AZ::ReflectContext* context);
     };
     };
 } // namespace AppleKraken
 } // namespace AppleKraken