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 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
114 changes: 101 additions & 13 deletions Robot_Adapter/Convert/ToRobot/Properties/Support.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

using RobotOM;
using BH.oM.Structure.Constraints;
using System.Collections.Generic;

namespace BH.Adapter.Robot
{
Expand All @@ -33,22 +34,109 @@ 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;

switch (constraint.TranslationX)
{
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;
}

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.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.RotationX)
{
case DOFType.Fixed:
suppData.RX = 1;
break;
case DOFType.FixedPositive:
suppData.SetOneDir(IRobotNodeSupportFixingDirection.I_NSFD_RX, IRobotNodeSupportOneDirectionFixingType.I_NSODFT_PLUS);
break;
case DOFType.FixedNegative:
suppData.SetOneDir(IRobotNodeSupportFixingDirection.I_NSFD_RX, IRobotNodeSupportOneDirectionFixingType.I_NSODFT_MINUS);
break;
default:
suppData.RX = 0;
break;
}

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

switch (constraint.RotationZ)
{
case DOFType.Fixed:
suppData.UZ = 1;
MayaAroraJonsson marked this conversation as resolved.
Show resolved Hide resolved

Choose a reason for hiding this comment

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

Suggested change
suppData.UZ = 1;
suppData.RZ = 1;

break;
case DOFType.FixedPositive:
suppData.SetOneDir(IRobotNodeSupportFixingDirection.I_NSFD_RZ, IRobotNodeSupportOneDirectionFixingType.I_NSODFT_PLUS);
break;
case DOFType.FixedNegative:
suppData.SetOneDir(IRobotNodeSupportFixingDirection.I_NSFD_RZ, IRobotNodeSupportOneDirectionFixingType.I_NSODFT_MINUS);
break;
default:
suppData.RZ = 0;
break;
}

}


/***************************************************/
}
/***************************************************/
}


Expand Down