us.ihmc.robotics.robotSide.RobotSide.equals()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(12.5k)|赞(0)|评价(0)|浏览(75)

本文整理了Java中us.ihmc.robotics.robotSide.RobotSide.equals方法的一些代码示例,展示了RobotSide.equals的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RobotSide.equals方法的具体详情如下:
包路径:us.ihmc.robotics.robotSide.RobotSide
类名称:RobotSide
方法名:equals

RobotSide.equals介绍

暂无

代码示例

代码示例来源:origin: us.ihmc/IHMCHumanoidRobotics

public void setKeepHandInTaskspacePosition(RobotSide robotSide, boolean keepHandInTaskspacePosition)
{
 if(robotSide.equals(RobotSide.LEFT)) 
   keepLeftHandInTaskspacePosition = keepHandInTaskspacePosition;
 else 
   keepRightHandInTaskspacePosition = keepHandInTaskspacePosition;
}

代码示例来源:origin: us.ihmc/IHMCHumanoidRobotics

@Override
public boolean epsilonEquals(ArmTrajectoryMessage other, double epsilon)
{
 if (!this.robotSide.equals(other.robotSide) || this.jointTrajectoryMessages.length != other.jointTrajectoryMessages.length)
 {
   return false;
 }
 if (executionMode != other.executionMode)
   return false;
 if (executionMode == ExecutionMode.OVERRIDE && previousMessageId != other.previousMessageId)
   return false;
 for (int i = 0; i < this.jointTrajectoryMessages.length; i++)
 {
   if (!this.jointTrajectoryMessages[i].epsilonEquals(other.jointTrajectoryMessages[i], epsilon))
   {
    return false;
   }
 }
 return true;
}

代码示例来源:origin: us.ihmc/IHMCHumanoidRobotics

@Override
public boolean epsilonEquals(AtlasWristSensorCalibrationRequestPacket other, double epsilon)
{
 boolean ret = this.getRobotSide().equals(other.getRobotSide());
 return ret;
}

代码示例来源:origin: us.ihmc/IHMCHumanoidRobotics

@Override
  public boolean epsilonEquals(ObjectWeightPacket other, double epsilon)
  {
   boolean sameSide = robotSide.equals(other.getRobotSide());
   boolean sameWeight = weight == other.getWeight();
   return sameSide && sameWeight;
  }
}

代码示例来源:origin: us.ihmc/IHMCHumanoidRobotics

@Override
public boolean epsilonEquals(HandPowerCyclePacket other, double epsilon)
{
 boolean ret = this.getRobotSide().equals(other.getRobotSide());
 return ret;
}

代码示例来源:origin: us.ihmc/DarpaRoboticsChallenge

public HandControlThread(RobotSide robotSide)
{
 NetworkPorts port = robotSide.equals(RobotSide.LEFT) ? NetworkPorts.LEFT_HAND_PORT : NetworkPorts.RIGHT_HAND_PORT;
 String host = NetworkParameters.getHost(NetworkParameterKeys.networkManager);
 packetCommunicator = PacketCommunicator.createTCPPacketCommunicatorClient(host, port, new IHMCCommunicationKryoNetClassList(), true);
}

代码示例来源:origin: us.ihmc/robotiq-hand-drivers

public RobotiqHandCommunicator(RobotSide robotSide)
{
 NetworkParameterKeys key = robotSide.equals(RobotSide.LEFT) ? NetworkParameterKeys.leftHand : NetworkParameterKeys.rightHand;
 communicator = new JamodTCPMaster(NetworkParameters.getHost(key), PORT);
 communicator.setAutoReconnect(true);
}

代码示例来源:origin: us.ihmc/IHMCAvatarInterfaces

public HandControlThread(RobotSide robotSide)
{
 NetworkPorts port = robotSide.equals(RobotSide.LEFT) ? NetworkPorts.LEFT_HAND_PORT : NetworkPorts.RIGHT_HAND_PORT;
 String host = NetworkParameters.getHost(NetworkParameterKeys.networkManager);
 packetCommunicator = PacketCommunicator.createTCPPacketCommunicatorClient(host, port, new IHMCCommunicationKryoNetClassList(), true);
}

代码示例来源:origin: us.ihmc/RobotiqHandDrivers

public RobotiqHandCommunicator(RobotSide robotSide)
{
 NetworkParameterKeys key = robotSide.equals(RobotSide.LEFT) ? NetworkParameterKeys.leftHand : NetworkParameterKeys.rightHand;
 communicator = new JamodTCPMaster(NetworkParameters.getHost(key), PORT);
 communicator.setAutoReconnect(true);
}

代码示例来源:origin: us.ihmc/DarpaRoboticsChallenge

public HandCommandManager(Class<? extends Object> clazz, RobotSide robotSide)
{
 String networkParamProperty = System.getProperty("us.ihmc.networkParameterFile", NetworkParameters.defaultParameterFile);
 
 spawner.spawn(clazz, new String[] {"-Dus.ihmc.networkParameterFile=" + networkParamProperty}, new String[] { "-r", robotSide.getLowerCaseName() });
 NetworkPorts managerPort = robotSide.equals(RobotSide.LEFT) ? NetworkPorts.LEFT_HAND_MANAGER_PORT : NetworkPorts.RIGHT_HAND_MANAGER_PORT;
 handManagerPacketCommunicator = PacketCommunicator.createIntraprocessPacketCommunicator(managerPort, new IHMCCommunicationKryoNetClassList());
 NetworkPorts port = robotSide.equals(RobotSide.LEFT) ? NetworkPorts.LEFT_HAND_PORT : NetworkPorts.RIGHT_HAND_PORT;
 packetCommunicator = PacketCommunicator.createTCPPacketCommunicatorServer(port, new IHMCCommunicationKryoNetClassList());
 try
 {
   packetCommunicator.connect();
   handManagerPacketCommunicator.connect();
 }
 catch (IOException e)
 {
   throw new RuntimeException(e);
 }
}

代码示例来源:origin: us.ihmc/ihmc-footstep-planning

public boolean epsilonEquals(SimpleFootstep otherFootstep, double epsilon)
{
 this.foothold.update();
 otherFootstep.foothold.update();
 if (!this.robotSide.equals(otherFootstep.robotSide))
   return false;
 if (!this.soleFramePose.epsilonEquals(otherFootstep.soleFramePose, epsilon))
   return false;
 if (!this.foothold.epsilonEquals(otherFootstep.foothold, epsilon))
   return false;
 return true;
}

代码示例来源:origin: us.ihmc/ihmc-avatar-interfaces

public HandCommandManager(Class<? extends Object> clazz, RobotSide robotSide)
{
 String networkParamProperty = System.getProperty("us.ihmc.networkParameterFile", NetworkParameters.defaultParameterFile);
 
 spawner.spawn(clazz, new String[] {"-Dus.ihmc.networkParameterFile=" + networkParamProperty}, new String[] { "-r", robotSide.getLowerCaseName() });
 NetworkPorts managerPort = robotSide.equals(RobotSide.LEFT) ? NetworkPorts.LEFT_HAND_MANAGER_PORT : NetworkPorts.RIGHT_HAND_MANAGER_PORT;
 handManagerPacketCommunicator = PacketCommunicator.createIntraprocessPacketCommunicator(managerPort, new IHMCCommunicationKryoNetClassList());
 NetworkPorts port = robotSide.equals(RobotSide.LEFT) ? NetworkPorts.LEFT_HAND_PORT : NetworkPorts.RIGHT_HAND_PORT;
 packetCommunicator = PacketCommunicator.createTCPPacketCommunicatorServer(port, new IHMCCommunicationKryoNetClassList());
 try
 {
   packetCommunicator.connect();
   handManagerPacketCommunicator.connect();
 }
 catch (IOException e)
 {
   throw new RuntimeException(e);
 }
}

代码示例来源:origin: us.ihmc/IHMCAvatarInterfaces

public HandCommandManager(Class<? extends Object> clazz, RobotSide robotSide)
{
 String networkParamProperty = System.getProperty("us.ihmc.networkParameterFile", NetworkParameters.defaultParameterFile);
 
 spawner.spawn(clazz, new String[] {"-Dus.ihmc.networkParameterFile=" + networkParamProperty}, new String[] { "-r", robotSide.getLowerCaseName() });
 NetworkPorts managerPort = robotSide.equals(RobotSide.LEFT) ? NetworkPorts.LEFT_HAND_MANAGER_PORT : NetworkPorts.RIGHT_HAND_MANAGER_PORT;
 handManagerPacketCommunicator = PacketCommunicator.createIntraprocessPacketCommunicator(managerPort, new IHMCCommunicationKryoNetClassList());
 NetworkPorts port = robotSide.equals(RobotSide.LEFT) ? NetworkPorts.LEFT_HAND_PORT : NetworkPorts.RIGHT_HAND_PORT;
 packetCommunicator = PacketCommunicator.createTCPPacketCommunicatorServer(port, new IHMCCommunicationKryoNetClassList());
 try
 {
   packetCommunicator.connect();
   handManagerPacketCommunicator.connect();
 }
 catch (IOException e)
 {
   throw new RuntimeException(e);
 }
}

代码示例来源:origin: us.ihmc/IHMCHumanoidRobotics

public boolean epsilonEquals(ManualHandControlPacket other, double epsilon)
{
 boolean ret = this.getRobotSide().equals(other.getRobotSide());
 ret &= Math.abs(this.getIndex() - other.getIndex()) < epsilon;
 ret &= Math.abs(this.getMiddle() - other.getMiddle()) < epsilon;
 ret &= Math.abs(this.getThumb() - other.getThumb()) < epsilon;
 ret &= Math.abs(this.getSpread() - other.getSpread()) < epsilon;
 ret &= Math.abs(this.getControlType() - other.getControlType()) < epsilon;
 return ret;
}

代码示例来源:origin: us.ihmc/ihmc-footstep-planning

private void addSquareUp(ArrayList<FramePose2D> footstepList, FramePoint2D robotPosition)
{
 robotPosition.changeFrame(stanceFootFrame);
 if (Math.abs(robotPosition.getX()) > 0.001)
   throw new RuntimeException("Can not square up for given position.");
 robotPosition.changeFrame(stanceFootFrame);
 FramePose2D footstepPose = new FramePose2D(stanceFootFrame);
 footstepPose.setY(2.0*robotPosition.getY());
 if(lastStepSide.equals(RobotSide.LEFT) && footstepPose.getY() > 0)
   throw new RuntimeException("Left foot can not be placed on right side of right foot");
 if (lastStepSide.equals(RobotSide.RIGHT) && footstepPose.getY() < 0)
   throw new RuntimeException("Right foot can not be placed on left side of left foot");
 footstepPose.changeFrame(ReferenceFrame.getWorldFrame());
 footstepList.add(footstepPose);
 stanceFootFrame.setPoseAndUpdate(footstepPose);
 lastStepSide = lastStepSide.getOppositeSide();
}

代码示例来源:origin: us.ihmc/IHMCFootstepPlanning

private void addSquareUp(ArrayList<FramePose2d> footstepList, FramePoint2d robotPosition)
{
 robotPosition.changeFrame(stanceFootFrame);
 if (Math.abs(robotPosition.getX()) > 0.001)
   throw new RuntimeException("Can not square up for given position.");
 robotPosition.changeFrame(stanceFootFrame);
 FramePose2d footstepPose = new FramePose2d(stanceFootFrame);
 footstepPose.setY(2.0*robotPosition.getY());
 if(lastStepSide.equals(RobotSide.LEFT) && footstepPose.getY() > 0)
   throw new RuntimeException("Left foot can not be placed on right side of right foot");
 if (lastStepSide.equals(RobotSide.RIGHT) && footstepPose.getY() < 0)
   throw new RuntimeException("Right foot can not be placed on left side of left foot");
 footstepPose.changeFrame(ReferenceFrame.getWorldFrame());
 footstepList.add(footstepPose);
 stanceFootFrame.setPoseAndUpdate(footstepPose);
 lastStepSide = lastStepSide.getOppositeSide();
}

代码示例来源:origin: us.ihmc/IHMCFootstepPlanning

public boolean epsilonEquals(SimpleFootstep otherFootstep, double epsilon)
  {
   this.foothold.update();
   otherFootstep.foothold.update();

   if (!this.robotSide.equals(otherFootstep.robotSide))
     return false;
   if (!this.soleFramePose.epsilonEquals(otherFootstep.soleFramePose, epsilon))
     return false;
   if (!this.foothold.epsilonEquals(otherFootstep.foothold, epsilon))
     return false;
   return true;
  }
}

代码示例来源:origin: us.ihmc/IHMCHumanoidRobotics

@Override
public boolean epsilonEquals(FootstepPlanningRequestPacket other, double epsilon)
{
 if (!initialStanceSide.equals(other.initialStanceSide))
   return false;
 if (!stanceFootPositionInWorld.epsilonEquals(other.stanceFootPositionInWorld, (float) epsilon))
   return false;
 if (!RotationTools.quaternionEpsilonEquals(stanceFootOrientationInWorld, other.stanceFootOrientationInWorld, (float) epsilon))
   return false;
 if (!goalPositionInWorld.epsilonEquals(other.goalPositionInWorld, (float) epsilon))
   return false;
 if (!RotationTools.quaternionEpsilonEquals(goalOrientationInWorld, other.goalOrientationInWorld, (float) epsilon))
   return false;
 return true;
}

代码示例来源:origin: us.ihmc/RobotiqHandDrivers

@Override
public double[][] getFingerJointAngles(RobotSide robotSide)
{
 thumbJointAngles[0] = (response.getFingerAPosition().getRegisterValue() & 0xFF) * (25.0/72) * Math.PI / 0xFF; //62.5 degrees
 thumbJointAngles[1] = (response.getFingerAPosition().getRegisterValue() & 0xFF) * (0.5) * Math.PI / 0xFF; //90 degrees
 thumbJointAngles[2] = 0.0;
 jointAngles[2] = thumbJointAngles;
 
 middleFingerJointAngles[0] = -((double)(response.getScissorPosition().getRegisterValue() & 0xFF) * (8.0/45) / 0xFF - (4.0/45)) * Math.PI; //32 degrees
 middleFingerJointAngles[1] = (double)(response.getFingerBPosition().getRegisterValue() & 0xFF) * (25.0/72) * Math.PI / 0xFF; //62.5 degrees
 middleFingerJointAngles[2] = (double)(response.getFingerBPosition().getRegisterValue() & 0xFF) * (0.5) * Math.PI / 0xFF; //90 degrees
 middleFingerJointAngles[3] = 0.0;
 jointAngles[robotSide.equals(RobotSide.LEFT) ? 1 : 0] = middleFingerJointAngles;
 
 indexFingerJointAngles[0] = ((double)(response.getScissorPosition().getRegisterValue() & 0xFF) * (8.0/45) / 0xFF - (4.0/45)) * Math.PI; //32 degrees
 indexFingerJointAngles[1] = (double)(response.getFingerCPosition().getRegisterValue() & 0xFF) * (25.0/72) * Math.PI / 0xFF; //62.5 degrees
 indexFingerJointAngles[2] = (double)(response.getFingerCPosition().getRegisterValue() & 0xFF) * (0.5) * Math.PI / 0xFF; //90 degrees
 indexFingerJointAngles[3] = 0.0;
 jointAngles[robotSide.equals(RobotSide.LEFT) ? 0 : 1] = indexFingerJointAngles;
 
 return jointAngles;
}

代码示例来源:origin: us.ihmc/ihmc-avatar-interfaces-test

private String areFootstepsEqual(int footstepNumber, SimpleFootstep actual, SimpleFootstep expected)
{
 String errorMessage = "";
 if (!actual.getRobotSide().equals(expected.getRobotSide()))
 {
   errorMessage += "Footsteps " + footstepNumber + " are different robot sides: " + actual.getRobotSide() + " and " + expected.getRobotSide() + ".\n";
 }
 FramePose3D poseA = new FramePose3D();
 FramePose3D poseB = new FramePose3D();
 actual.getSoleFramePose(poseA);
 expected.getSoleFramePose(poseB);
 if (!poseA.epsilonEquals(poseB, 1e-5))
 {
   errorMessage += "Footsteps " + footstepNumber + " have different poses: \n \t" + poseA.toString() + "\n and \n\t " + poseB.toString() + ".\n";
 }
 if (!actual.epsilonEquals(expected, 1e-5))
 {
   errorMessage += "Footsteps " + footstepNumber + " are not equal: \n \t" + actual.toString() + "\n and \n\t " + expected.toString() + ".\n";
 }
 return errorMessage;
}

相关文章