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

Adding switch statements to incorporate FixedPositive and FixedNegative Constraint6DOF #549

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
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
84 changes: 72 additions & 12 deletions Robot_Adapter/Convert/ToRobot/Properties/Support.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,78 @@ public static partial class Convert

public static void ToRobot(IRobotNodeSupportData suppData, Constraint6DOF constraint)
{
suppData.UX = constraint.TranslationX == DOFType.Fixed ? 1 : 0;
suppData.UY = constraint.TranslationY == DOFType.Fixed ? 1 : 0;
suppData.UZ = constraint.TranslationZ == DOFType.Fixed ? 1 : 0;
suppData.RX = constraint.RotationX == DOFType.Fixed ? 1 : 0;
suppData.RY = constraint.RotationY == DOFType.Fixed ? 1 : 0;
suppData.RZ = constraint.RotationZ == DOFType.Fixed ? 1 : 0;
suppData.KX = constraint.TranslationalStiffnessX;
suppData.KY = constraint.TranslationalStiffnessY;
suppData.KZ = constraint.TranslationalStiffnessZ;
suppData.HX = constraint.RotationalStiffnessX;
suppData.HY = constraint.RotationalStiffnessY;
suppData.HZ = constraint.RotationalStiffnessZ;
//if (constraint.TranslationZ == DOFType.Fixed)
// suppData.UZ = 1;
//else if (constraint.TranslationZ == DOFType.FixedPositive)
// suppData.SetOneDir(IRobotNodeSupportFixingDirection.I_NSFD_UZ, IRobotNodeSupportOneDirectionFixingType.I_NSODFT_PLUS);
//else if (constraint.TranslationZ == DOFType.FixedNegative)
// suppData.SetOneDir(IRobotNodeSupportFixingDirection.I_NSFD_UZ, IRobotNodeSupportOneDirectionFixingType.I_NSODFT_MINUS);
//else
// suppData.UZ = 0;


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
//if (constraint.TranslationZ == DOFType.Fixed)
// suppData.UZ = 1;
//else if (constraint.TranslationZ == DOFType.FixedPositive)
// suppData.SetOneDir(IRobotNodeSupportFixingDirection.I_NSFD_UZ, IRobotNodeSupportOneDirectionFixingType.I_NSODFT_PLUS);
//else if (constraint.TranslationZ == DOFType.FixedNegative)
// suppData.SetOneDir(IRobotNodeSupportFixingDirection.I_NSFD_UZ, IRobotNodeSupportOneDirectionFixingType.I_NSODFT_MINUS);
//else
// suppData.UZ = 0;

Remove commented code,

switch (constraint.TranslationZ)
{
case DOFType.Fixed:
suppData.UZ = 1;
break;
case DOFType.FixedPositive:
suppData.SetOneDir(IRobotNodeSupportFixingDirection.I_NSFD_UZ, IRobotNodeSupportOneDirectionFixingType.I_NSODFT_PLUS);
break;
case DOFType.FixedNegative:
suppData.SetOneDir(IRobotNodeSupportFixingDirection.I_NSFD_UZ, IRobotNodeSupportOneDirectionFixingType.I_NSODFT_MINUS);
break;
default:
suppData.UZ = 0;
break;
}

switch (constraint.TranslationY)
{
case DOFType.Fixed:
suppData.UY = 1;
break;
case DOFType.FixedPositive:
suppData.SetOneDir(IRobotNodeSupportFixingDirection.I_NSFD_UY, IRobotNodeSupportOneDirectionFixingType.I_NSODFT_PLUS);
break;
case DOFType.FixedNegative:
suppData.SetOneDir(IRobotNodeSupportFixingDirection.I_NSFD_UY, IRobotNodeSupportOneDirectionFixingType.I_NSODFT_MINUS);
break;
default:
suppData.UY = 0;
break;
}

switch (constraint.TranslationX)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
switch (constraint.TranslationX)
switch (constraint.TranslationX)

Can these be in order of X,Y and Z. We also need to add the rotations.

{
case DOFType.Fixed:
suppData.UX = 1;
break;
case DOFType.FixedPositive:
suppData.SetOneDir(IRobotNodeSupportFixingDirection.I_NSFD_UX, IRobotNodeSupportOneDirectionFixingType.I_NSODFT_PLUS);
break;
case DOFType.FixedNegative:
suppData.SetOneDir(IRobotNodeSupportFixingDirection.I_NSFD_UX, IRobotNodeSupportOneDirectionFixingType.I_NSODFT_MINUS);
break;
default:
suppData.UX = 0;
break;
}

//suppData.UX = constraint.TranslationX == DOFType.Fixed ? 1 : 0;
//suppData.UY = constraint.TranslationY == DOFType.Fixed ? 1 : 0;
//suppData.UZ = constraint.TranslationZ == DOFType.Fixed ? 1 : 0;
//suppData.RX = constraint.RotationX == DOFType.Fixed ? 1 : 0;
//suppData.RY = constraint.RotationY == DOFType.Fixed ? 1 : 0;
//suppData.RZ = constraint.RotationZ == DOFType.Fixed ? 1 : 0;


//suppData.KX = constraint.TranslationalStiffnessX;
//suppData.KY = constraint.TranslationalStiffnessY;
//suppData.KZ = constraint.TranslationalStiffnessZ;
//suppData.HX = constraint.RotationalStiffnessX;
//suppData.HY = constraint.RotationalStiffnessY;
//suppData.HZ = constraint.RotationalStiffnessZ;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
//suppData.UX = constraint.TranslationX == DOFType.Fixed ? 1 : 0;
//suppData.UY = constraint.TranslationY == DOFType.Fixed ? 1 : 0;
//suppData.UZ = constraint.TranslationZ == DOFType.Fixed ? 1 : 0;
//suppData.RX = constraint.RotationX == DOFType.Fixed ? 1 : 0;
//suppData.RY = constraint.RotationY == DOFType.Fixed ? 1 : 0;
//suppData.RZ = constraint.RotationZ == DOFType.Fixed ? 1 : 0;
//suppData.KX = constraint.TranslationalStiffnessX;
//suppData.KY = constraint.TranslationalStiffnessY;
//suppData.KZ = constraint.TranslationalStiffnessZ;
//suppData.HX = constraint.RotationalStiffnessX;
//suppData.HY = constraint.RotationalStiffnessY;
//suppData.HZ = constraint.RotationalStiffnessZ;

Remove commented code,

}

/***************************************************/
Expand Down