Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support in JointsManipulationComponent for classic prismatic joints #409

Merged
merged 3 commits into from
Jul 20, 2023
Merged
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@
#include <ROS2/Utilities/ROS2Names.h>
#include <Source/ArticulationLinkComponent.h>
#include <Source/HingeJointComponent.h>
#include <Source/PrismaticJointComponent.h>

namespace ROS2
{
namespace Internal
{
void AddHingeJointInfo(const AZ::EntityComponentIdPair& idPair, const AZStd::string& jointName, ManipulationJoints& joints)
void Add1DOFJointInfo(const AZ::EntityComponentIdPair& idPair, const AZStd::string& jointName, ManipulationJoints& joints)
{
if (joints.find(jointName) != joints.end())
{
Expand Down Expand Up @@ -118,10 +119,12 @@ namespace ROS2
const AZStd::string jointName(frameComponent->GetJointName().GetCStr());

auto* hingeComponent = Utils::GetGameOrEditorComponent<PhysX::HingeJointComponent>(entity);
auto* prismaticComponent = Utils::GetGameOrEditorComponent<PhysX::PrismaticJointComponent>(entity);
Antoni-Robotec marked this conversation as resolved.
Show resolved Hide resolved
auto* articulationComponent = Utils::GetGameOrEditorComponent<PhysX::ArticulationLinkComponent>(entity);
bool classicJoint = hingeComponent && prismaticComponent;
AZ_Warning(
"JointsManipulationComponent",
(hingeComponent && supportsClassicJoints) || !hingeComponent,
(classicJoint && supportsClassicJoints) || !classicJoint,
"Found classic joints but the controller does not support them!");
AZ_Warning(
"JointsManipulationComponent",
Expand All @@ -132,7 +135,14 @@ namespace ROS2
if (supportsClassicJoints && hingeComponent)
{
auto idPair = AZ::EntityComponentIdPair(hingeComponent->GetEntityId(), hingeComponent->GetId());
Internal::AddHingeJointInfo(idPair, jointName, manipulationJoints);
Internal::Add1DOFJointInfo(idPair, jointName, manipulationJoints);
}

// See if there is a Prismatic Joint in the entity, add it to map.
if (supportsClassicJoints && prismaticComponent)
{
auto idPair = AZ::EntityComponentIdPair(prismaticComponent->GetEntityId(), prismaticComponent->GetId());
Internal::Add1DOFJointInfo(idPair, jointName, manipulationJoints);
}

// See if there is an Articulation Link in the entity, add it to map.
Expand Down