us.ihmc.yoVariables.variable.YoEnum类的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(8.7k)|赞(0)|评价(0)|浏览(168)

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

YoEnum介绍

[英]Enum implementation of the YoVariable class.

All abstract functions of YoVariable will be implemented using enum type for interpretation. Values will be interpreted, compared, and returned as enums rather than any native types.
[中]YoVariable类的枚举实现。
YoVariable的所有抽象函数都将使用枚举类型进行解释。值将作为枚举而不是任何本机类型进行解释、比较和返回。

代码示例

代码示例来源:origin: us.ihmc/simulation-construction-set-tools

public YoVariableTogglerOutlet(String name, YoVariableRegistry parent)
{
 toggleMode = new YoEnum<ToggleMode>(name, parent, ToggleMode.class);
 toggleMode.set(ToggleMode.NO_CHANGE);
}

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

/**
* Sets the internal value of this YoEnum to the current value of the passed YoEnum.
*
* @param value YoEnum value to set this variable's value to
* @param notifyListeners boolean determining whether or not to call {@link #notifyVariableChangedListeners()}
* @return boolean whether or not internal state differed from the passed value
*/
@Override public boolean setValue(YoEnum<T> value, boolean notifyListeners)
{
 return set(value.getEnumValue(), notifyListeners);
}

代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit

public FiniteStateMachineYoVariableTrigger(final FiniteStateMachine<?, ?, ?> stateMachine, String name, YoVariableRegistry registry,
     final Class<E> enumType)
  {
   final YoEnum<E> yoVariable = new YoEnum<>(name, registry, enumType, true);
   yoVariable.set(null);

   // Attach a change listener, firing state machine events for every callback.
   yoVariable.addVariableChangedListener(new VariableChangedListener()
   {
     @Override
     public void notifyOfVariableChange(YoVariable<?> v)
     {
      if (yoVariable.getEnumValue() != null)
      {
        stateMachine.trigger(enumType, yoVariable.getEnumValue());

        // Reset to null to be ready for another event.
        yoVariable.set(null);
      }
     }
   });
  }
}

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

/**
* Creates a new YoEnum with the same parameters as this one, and registers it to the passed {@link YoVariableRegistry}.
*
* @param newRegistry YoVariableRegistry to duplicate this YoEnum to
* @return the newly created and registered YoEnum
*/
@Override public YoEnum<T> duplicate(YoVariableRegistry newRegistry)
{
 YoEnum<T> retVar = new YoEnum<>(getName(), getDescription(), newRegistry, getEnumType(), getAllowNullValue());
 retVar.set(getEnumValue());
 return retVar;
}

代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit

public void doTransitionAction()
  {
   requestedState.set(null);
  }
};

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

@Override
public void starting(SimulationConstructionSet scs, Robot robot, YoVariableRegistry registry)
{
 registry.addChild(sliderBoardRegistry);
 final SliderBoardConfigurationManager sliderBoardConfigurationManager = new SliderBoardConfigurationManager(scs);
  for (StepprStandPrepSetpoints setpoint : StepprStandPrepSetpoints.values)
 {
   StandPrepVariables variables = new StandPrepVariables(setpoint, registry);
   StepprJoint aJoint = setpoint.getJoints()[0];
   sliderBoardConfigurationManager.setKnob(1, selectedJointPair, 0, StepprJoint.values.length);
   sliderBoardConfigurationManager.setSlider(1, variables.tau_d, -100.0, 100.0);
   sliderBoardConfigurationManager.setSlider(3, variables.damping, 0, 5 * aJoint.getRatio() * aJoint.getRatio());
      sliderBoardConfigurationManager.saveConfiguration(setpoint.toString());
   allSetpoints.put(setpoint, variables);
 }
 selectedJointPair.addVariableChangedListener(new VariableChangedListener()
 {
   @Override
   public void notifyOfVariableChange(YoVariable<?> v)
   {
    sliderBoardConfigurationManager.loadConfiguration(selectedJointPair.getEnumValue().toString());
   }
 });
 selectedJointPair.set(StepprStandPrepSetpoints.HIP_Y);
 StepprDashboard.createDashboard(scs, registry);
 scs.getDataBuffer().attachIndexChangedListener(this);
}

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

@Override
 public boolean testCondition(double time)
 {
   return footConstraintType.getEnumValue() == FootControlModule.ConstraintType.SWING;
 }
}

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

/**
* Create a new YoEnum. This will call {@link YoEnum(String, YoVariableRegistry, Class)} with the given values.
*
* @param name String uniquely identifying this YoEnum
* @param registry YoVariableRegistry for this YoEnum to register itself to after initialization
* @param enumType the class representing the type of the enum
*/
public static <T extends Enum<T>> YoEnum<T> create(String name, Class<T> enumType, YoVariableRegistry registry)
{
 return new YoEnum<>(name, registry, enumType);
}

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

selectedJoint = new YoEnum<>("selectedJoint", "", registry, false, jointNameArray);
System.out.println(Arrays.toString(selectedJoint.getEnumValuesAsString()));
previousSelectedJoint = new YoEnum<>("previousSelectedJoint", "", registry, true, jointNameArray);
previousSelectedJoint.set(YoEnum.NULL_VALUE);
secondaryJoint = new YoEnum<>("secondaryJoint", "", registry, true, jointNameArray);
secondaryJoint.set(YoEnum.NULL_VALUE);
selectedJoint.addVariableChangedListener(new VariableChangedListener()
selectedJoint.notifyVariableChangedListeners();

代码示例来源:origin: us.ihmc/simulation-construction-set-tools

private void addGoalMarkerRobot()
{
 goalMarkerRobot.setGravity(0.0);
 environmentRobots.add(goalMarkerRobot);
 YoVariableRegistry robotsYoVariableRegistry = goalMarkerRobot.getRobotsYoVariableRegistry();
 YoEnum<GoalMarkerLocation> goalMarkerLocationYoEnum = YoEnum.create("DesiredGoalMarkerLocation", GoalMarkerLocation.class, robotsYoVariableRegistry);
 goalMarkerLocationYoEnum.addVariableChangedListener(new GoalMarkerLocationUpdater());
 goalMarkerLocationYoEnum.set(GoalMarkerLocation.TOP_OF_STAIRS);
}

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

@Override
  public void actionPerformed(ActionEvent e)
  {
   int newOrdinal = fromComboBoxIndexToEnumOrdinalMap.get(requestControlModeComboBox.getSelectedIndex());
   int currentOrdinal = requestHighLevelControlMode.getOrdinal();
   if (newOrdinal != currentOrdinal)
   {
     requestHighLevelControlMode.set(newOrdinal);
   }
  }
});

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

@Override
void setToString(String valueString)
{
 if("null".equalsIgnoreCase(valueString))
 {
   this.value.set(YoEnum.NULL_VALUE);
   return;
 }
 
 for(int i = 0; i < this.value.getEnumValuesAsString().length; i++)
 {
   if(this.value.getEnumValuesAsString()[i].equals(valueString))
   {
    this.value.set(i);
    return;
   }
 }
 
 throw new RuntimeException("Cannot set enum value to " + valueString + ", undefined enum constant"); 
}

代码示例来源:origin: us.ihmc/ihmc-common-walking-control-modules-test

YoArtifactPolygon captureRegionArtifact = new YoArtifactPolygon("CaptureRegion", yoCaptureRegion, Color.BLACK, false);
yoGraphicsListRegistry.registerArtifact("Capture", captureRegionArtifact);
final YoEnum<RobotSide> yoSupportSide = new YoEnum<>("supportSide", registry, RobotSide.class);
final YoDouble swingTimeRemaining = new YoDouble("swingTimeRemaining", registry);
final YoFramePoint2D yoICP = new YoFramePoint2D("ICP", worldFrame, registry);
swingTimeRemaining.addVariableChangedListener(variableChangedListener);
yoICP.attachVariableChangedListener(variableChangedListener);
yoSupportSide.addVariableChangedListener(variableChangedListener);

代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit

private static <T extends Enum<T>> String getFormattedEnumYoVariable(final YoEnum<T> yoEnum)
{
 String enumValueName = yoEnum.getEnumValue() != null ? yoEnum.getEnumValue().name() : "null";
 return yoEnum.getName() + ":" + enumValueName;
}

代码示例来源:origin: us.ihmc/simulation-construction-set-tools

public void registerWithVariableChangedListener(VariableChangedListener changedListener)
{
 toggleMode.addVariableChangedListener(changedListener);
}

代码示例来源:origin: us.ihmc/ihmc-robot-data-logger

case ENUM:
 yoVariableDefinition.setType(YoType.EnumYoVariable);
 if (((YoEnum<?>) variable).isBackedByEnum())
   yoVariableDefinition.setEnumType(getOrAddEnumType(((YoEnum<?>) variable).getEnumType().getCanonicalName(), ((YoEnum<?>) variable).getEnumValuesAsString()));
   yoVariableDefinition.setEnumType(getOrAddEnumType(variable.getFullNameWithNameSpace() + ".EnumType", ((YoEnum<?>) variable).getEnumValuesAsString()));
 yoVariableDefinition.setAllowNullValues(((YoEnum<?>) variable).getAllowNullValue());
 break;
default:

代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit

private TrajectoryColorType getCurrentColorType()
{
 return TrajectoryColorType.values[currentColorType.getOrdinal()];
}

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

/**
* Calls {@link #set(T, boolean)} with the given value and true.
*
* @param enumValue enum to set this YoEnum's internal enum state to
*/
public void set(T enumValue)
{
 set(enumValue, true);
}

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

selectedJoint.addVariableChangedListener(new VariableChangedListener()
selectedJoint.set(WandererJoint.RIGHT_KNEE_Y);

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

@Override
 public boolean testCondition(double timeInState)
 {
   return footConstraintType.getEnumValue() == ConstraintType.SWING;
 }
}

相关文章