本文整理了Java中us.ihmc.yoVariables.variable.YoEnum.addVariableChangedListener()
方法的一些代码示例,展示了YoEnum.addVariableChangedListener()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YoEnum.addVariableChangedListener()
方法的具体详情如下:
包路径:us.ihmc.yoVariables.variable.YoEnum
类名称:YoEnum
方法名:addVariableChangedListener
暂无
代码示例来源:origin: us.ihmc/simulation-construction-set-tools
public void registerWithVariableChangedListener(VariableChangedListener changedListener)
{
toggleMode.addVariableChangedListener(changedListener);
}
代码示例来源:origin: us.ihmc/simulation-construction-set-tools
protected EnumYoVariableDependentInputManager(final YoEnum<T> yoEnum, Class<T> enumType)
{
this.enumValues = enumType.getEnumConstants();
this.yoEnum = yoEnum;
yoEnum.addVariableChangedListener(new VariableChangedListener()
{
@Override
public void notifyOfVariableChange(YoVariable<?> v)
{
updateListeners(yoEnum);
}
});
}
代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit
/**
* Creates a new event trigger from the given {@code yoTrigger}.
* <p>
* An event is fired at the state machine every time {@code yoTrigger} changes value.
* </p>
*
* @param yoTrigger the variable to use for firing events.
* @return this factory for chaining operations.
*/
public <E extends Enum<E>> EventBasedStateMachineFactory<K, S> buildYoEventTrigger(YoEnum<E> yoTrigger)
{
EventTrigger eventTrigger = buildEventTrigger();
yoTrigger.addVariableChangedListener(new VariableChangedListener()
{
@Override
public void notifyOfVariableChange(YoVariable<?> v)
{
E newEvent = yoTrigger.getEnumValue();
if (newEvent != null)
{
eventTrigger.fireEvent(yoTrigger.getEnumValue());
yoTrigger.set(null);
}
}
});
return this;
}
代码示例来源: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/valkyrie
requestHighLevelControlMode.addVariableChangedListener(new VariableChangedListener()
代码示例来源:origin: us.ihmc/valkyrie
private YoSwitchableFilterModeIMUHandleHolder(final SwitchableFilterModeIMUHandle handle, IMUDefinition imuDefinition, YoVariableRegistry parentRegistry)
{
super(handle, imuDefinition, parentRegistry);
this.handle = handle;
filterTypeToUse = new YoEnum<>(handle.getName() + "_filterTypeToUse", parentRegistry, MicroStrainData.MicrostrainFilterType.class);
filterTypeToUse.addVariableChangedListener(new VariableChangedListener()
{
@Override
public void notifyOfVariableChange(YoVariable<?> v)
{
handle.setFilterTypeToUse(filterTypeToUse.getEnumValue());
}
});
filterTypeToUse.set(MicroStrainData.MicrostrainFilterType.COMPLIMENTARY_FILTER);
}
}
代码示例来源:origin: us.ihmc/valkyrie
private YoMicroStrainIMUHandleHolder(MicroStrainIMUHandle handle, IMUDefinition imuDefinition, YoVariableRegistry parentRegistry)
{
super(handle, imuDefinition, parentRegistry);
this.microStrainIMUHandle = handle;
filterTypeToUse = new YoEnum<>(handle.getName() + "_filterTypeToUse", parentRegistry, MicrostrainFilterType.class);
filterTypeToUse.addVariableChangedListener(new VariableChangedListener()
{
@Override
public void notifyOfVariableChange(YoVariable<?> v)
{
microStrainIMUHandle.setFilterTypeToReturn(filterTypeToUse.getEnumValue());
}
});
filterTypeToUse.set(MicrostrainFilterType.COMPLIMENTARY_FILTER);
}
代码示例来源: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/robot-environment-awareness-application
private void createGroundTypeListener(final SimulationConstructionSet scs)
{
final YoEnum<GroundType> groundType = new YoEnum<>("GroundType", scs.getRootRegistry(), GroundType.class, false);
groundType.set(DEFAULT_GROUND);
final EnumMap<GroundType, Graphics3DObject> environmentsGraphics = new EnumMap<>(GroundType.class);
environmentsGraphics.put(GroundType.OBSTACLE_COURSE, new DefaultCommonAvatarEnvironment().getTerrainObject3D().getLinkGraphics());
environmentsGraphics.put(GroundType.FLAT, new FlatGroundEnvironment().getTerrainObject3D().getLinkGraphics());
environmentsGraphics.put(GroundType.NOTHING, new Graphics3DObject());
environmentsGraphics.put(GroundType.CINDER_BLOCKS, new CinderBlockFieldEnvironment().getTerrainObject3D().getLinkGraphics());
environmentsGraphics.put(GroundType.BLOCK, createBlock());
environmentsGraphics.put(GroundType.BLOCKS, createBlocks());
environmentsGraphics.put(GroundType.BLOCKS2, createBlocks2());
environmentsGraphics.put(GroundType.L_SHAPE, createLShapedGround());
VariableChangedListener listener = new VariableChangedListener()
{
private Graphics3DNode groundGraphicsNode = null;
@Override
public void notifyOfVariableChange(YoVariable<?> v)
{
if (groundGraphicsNode != null)
scs.removeGraphics3dNode(groundGraphicsNode);
groundGraphicsNode = scs.addStaticLinkGraphics(environmentsGraphics.get(groundType.getEnumValue()));
}
};
groundType.addVariableChangedListener(listener);
listener.notifyOfVariableChange(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/valkyrie
secondaryJoint.set(YoEnum.NULL_VALUE);
selectedJoint.addVariableChangedListener(new VariableChangedListener()
代码示例来源:origin: us.ihmc/acsell
selectedJoint.addVariableChangedListener(new VariableChangedListener()
代码示例来源:origin: us.ihmc/acsell
selectedJoint.addVariableChangedListener(new VariableChangedListener()
代码示例来源:origin: us.ihmc/ihmc-avatar-interfaces-test
YoEnum<HighLevelControllerName> currentState = (YoEnum<HighLevelControllerName>) scs.getVariable("highLevelControllerNameCurrentState");
currentState.set(HighLevelControllerName.DO_NOTHING_BEHAVIOR);
currentState.addVariableChangedListener(v -> currentState.set(HighLevelControllerName.DO_NOTHING_BEHAVIOR));
assertTrue(drcSimulationTestHelper.simulateAndBlockAndCatchExceptions(0.5));
script.setPerformAssertions(true);
代码示例来源:origin: us.ihmc/ihmc-common-walking-control-modules-test
swingTimeRemaining.addVariableChangedListener(variableChangedListener);
yoICP.attachVariableChangedListener(variableChangedListener);
yoSupportSide.addVariableChangedListener(variableChangedListener);
代码示例来源:origin: us.ihmc/acsell
selectedJointPair.addVariableChangedListener(new VariableChangedListener()
代码示例来源:origin: us.ihmc/acsell
selectedJointPair.addVariableChangedListener(new VariableChangedListener()
代码示例来源:origin: us.ihmc/ihmc-avatar-interfaces
sliderBoardMode.addVariableChangedListener(listener);
listener.notifyOfVariableChange(null);
内容来源于网络,如有侵权,请联系作者删除!