-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'development' of https://github.com/o3de/o3de-extras int…
…o moudgils/gitflow_230418_o3de_extra Signed-off-by: moudgils <[email protected]>
- Loading branch information
Showing
25 changed files
with
569 additions
and
400 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
Gems/ROS2/Code/Include/ROS2/Manipulation/JointMotorControllerComponent.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* 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 <AzCore/Component/Component.h> | ||
#include <AzCore/Component/EntityBus.h> | ||
#include <AzCore/Component/TickBus.h> | ||
#include <AzCore/Serialization/SerializeContext.h> | ||
#include <ImGuiBus.h> | ||
#include <ROS2/Manipulation/JointMotorControllerConfiguration.h> | ||
|
||
namespace ROS2 | ||
{ | ||
class JointMotorControllerComponent | ||
: public AZ::Component | ||
, public AZ::TickBus::Handler | ||
, public ImGui::ImGuiUpdateListenerBus::Handler | ||
, public AZ::EntityBus::Handler | ||
{ | ||
public: | ||
JointMotorControllerComponent() = default; | ||
JointMotorControllerComponent(const JointMotorControllerComponent& other) = default; | ||
JointMotorControllerComponent(JointMotorControllerComponent&& other) = default; | ||
~JointMotorControllerComponent() = default; | ||
AZ_COMPONENT(JointMotorControllerComponent, "{88e725fc-29d8-45b9-b3e8-bd268ad9f413}"); | ||
|
||
// Component overrides | ||
void Activate() override; | ||
void Deactivate() override; | ||
|
||
static void Reflect(AZ::ReflectContext* context); | ||
|
||
// ImGui::ImGuiUpdateListenerBus overrides | ||
void OnImGuiUpdate() override; | ||
|
||
// EntityBus overrides | ||
void OnEntityActivated(const AZ::EntityId& entityId) override; | ||
|
||
protected: | ||
AZ::EntityComponentIdPair m_jointComponentIdPair; //!< Joint component managed by the motorized joint. | ||
float m_currentPosition{ 0.0f }; //!< Last measured position. | ||
float m_currentSpeed{ 0.0f }; //!< Last measured speed. | ||
|
||
JointMotorControllerConfiguration m_jointMotorControllerConfiguration; | ||
|
||
private: | ||
virtual float CalculateMotorSpeed([[maybe_unused]] float deltaTime) | ||
{ | ||
return 0.0f; | ||
}; | ||
|
||
virtual void DisplayControllerParameters(){}; | ||
|
||
// AZ::TickBus overrides | ||
void OnTick(float deltaTime, AZ::ScriptTimePoint time) override; | ||
}; | ||
} // namespace ROS2 |
27 changes: 27 additions & 0 deletions
27
Gems/ROS2/Code/Include/ROS2/Manipulation/JointMotorControllerConfiguration.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* 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 <AzCore/RTTI/RTTI.h> | ||
#include <AzCore/Serialization/SerializeContext.h> | ||
|
||
namespace ROS2 | ||
{ | ||
struct JointMotorControllerConfiguration | ||
{ | ||
AZ_TYPE_INFO(JointMotorControllerConfiguration, "{4358971c-36bd-4e13-8427-74ebba6c6760}"); | ||
static void Reflect(AZ::ReflectContext* context); | ||
|
||
bool IsDebugModeVisible() const; | ||
|
||
bool m_isDebugController{ false }; //!< Is it a debug controller. | ||
|
||
bool m_debugMode{ false }; //!< Is debug mode activated. | ||
}; | ||
|
||
} // namespace ROS2 |
30 changes: 30 additions & 0 deletions
30
Gems/ROS2/Code/Include/ROS2/Manipulation/ManualMotorControllerComponent.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* 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 <AzCore/Serialization/SerializeContext.h> | ||
#include <ROS2/Manipulation/JointMotorControllerComponent.h> | ||
|
||
namespace ROS2 | ||
{ | ||
class ManualMotorControllerComponent : public JointMotorControllerComponent | ||
{ | ||
public: | ||
AZ_COMPONENT(ManualMotorControllerComponent, "{0817634e-4862-4245-a66e-72d1a6939705}", JointMotorControllerComponent); | ||
|
||
ManualMotorControllerComponent(); | ||
~ManualMotorControllerComponent() = default; | ||
static void Reflect(AZ::ReflectContext* context); | ||
|
||
private: | ||
float m_setSpeed{ 0.0f }; | ||
|
||
float CalculateMotorSpeed([[maybe_unused]] float deltaTime) override; | ||
void DisplayControllerParameters() override; | ||
}; | ||
} // namespace ROS2 |
93 changes: 0 additions & 93 deletions
93
Gems/ROS2/Code/Include/ROS2/Manipulation/MotorizedJointComponent.h
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
Gems/ROS2/Code/Include/ROS2/Manipulation/PidMotorControllerComponent.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* 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 <AzCore/Serialization/SerializeContext.h> | ||
#include <AzFramework/Entity/EntityDebugDisplayBus.h> | ||
#include <ROS2/Manipulation/JointMotorControllerComponent.h> | ||
#include <ROS2/Manipulation/PidMotorControllerBus.h> | ||
#include <ROS2/Utilities/Controllers/PidConfiguration.h> | ||
|
||
namespace ROS2 | ||
{ | ||
class PidMotorControllerComponent | ||
: public JointMotorControllerComponent | ||
, public PidMotorControllerRequestBus::Handler | ||
{ | ||
public: | ||
AZ_COMPONENT(PidMotorControllerComponent, "{ac1d057f-a6ad-4a26-b44f-0ebda2f5f526}", JointMotorControllerComponent); | ||
|
||
PidMotorControllerComponent() = default; | ||
~PidMotorControllerComponent() = default; | ||
static void Reflect(AZ::ReflectContext* context); | ||
|
||
// Component overrides | ||
void Activate() override; | ||
void Deactivate() override; | ||
|
||
// PidMotorControllerBus overrides | ||
void SetSetpoint(float setpoint) override; | ||
float GetSetpoint() override; | ||
float GetCurrentMeasurement() override; | ||
float GetError() override; | ||
|
||
private: | ||
Controllers::PidConfiguration m_pidPos; //!< PID controller for position. | ||
float m_zeroOffset{ 0.0f }; //!< Offset added to setpoint. | ||
float m_setPoint{ 0.0f }; //!< Desired local position. | ||
float m_error{ 0.0f }; //!< Current error (difference between control value and measurement). | ||
|
||
// JointMotorControllerComponent overrides | ||
float CalculateMotorSpeed([[maybe_unused]] float deltaTime) override; | ||
void DisplayControllerParameters() override; | ||
}; | ||
} // namespace ROS2 |
Oops, something went wrong.