gpt4 book ai didi

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

转载 作者:知者 更新时间:2024-03-16 13:04:40 31 4
gpt4 key购买 nike

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

YoVariable介绍

[英]Title: Simulation Construction Set

Description: Package for Simulating Dynamic Robots and Mechanisms

YoVariables provide a simple, convenient mechanism for storing and manipulating robot data. While each essentially contains a double value YoVariables are designed for integration into the SCS GUI. Once registered, a variable will automatically become available to the GUI for graphing, modification and other data manipulation. Historical values of all registered YoVariables are stored in the DataBuffer which may be exported for later use.
[中]

代码示例

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

private double[] getCompleteMessageValues()
{
 double[] allVals = new double[allVariables.length];
 for (int i = 0; i < allVariables.length; i++)
 {
   allVals[i] = allVariables[i].getValueAsDouble();
 }
 return allVals;
}

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

@Override
  public void actionPerformed(ActionEvent e)
  {
   tareSensorsVar.setValueFromDouble(1.0);
  }
});

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

private static boolean areYoVariablesEqual(YoVariable<?> var1, YoVariable<?> var2)
{
  return StringUtils.equals(var1.getName(), var2.getName())  &&
      var1.getValueAsDouble() == var2.getValueAsDouble();
}

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

@Override
  public void notifyOfVariableChange(YoVariable<?> v)
  {
    if(v.getValueAsDouble()>currentLimit) v.setValueFromDouble(currentLimit);
    if(v.getValueAsDouble()<-currentLimit) v.setValueFromDouble(-currentLimit);        	 
  }
});

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

private void setupInitialRobot(double[] initialSetup)
{
 for (int i = 0; i < allVariables.length; i++)
 {
   double initialValue = initialSetup[i];
   YoVariable<?> variable = allVariables[i];
   System.out.println(variable.getName() + ": " + initialValue);
   variable.setValueFromDouble(initialValue);
 }
}

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

public String[] getCreatedVariableNames()
{
 String[] ret = new String[createdVariables.length];
 for (int i = 0; i < createdVariables.length; i++)
 {
   ret[i] = createdVariables[i].getName();
 }
 return ret;
}

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

yoVariableDefinition.setName(variable.getName());
String description = variable.getDescription();
if(description != null && description.length() > 255)
yoVariableDefinition.setIsParameter(variable.isParameter());
yoVariableDefinition.setMin(variable.getManualScalingMin());
yoVariableDefinition.setMax(variable.getManualScalingMax());
if (variable.isParameter())
 ParameterLoadStatus loadStatus = variable.getParameter().getLoadStatus();
 switch (loadStatus)
switch (variable.getYoVariableType())
   yoVariableDefinition.setEnumType(getOrAddEnumType(variable.getFullNameWithNameSpace() + ".EnumType", ((YoEnum<?>) variable).getEnumValuesAsString()));
 throw new RuntimeException("Unknown variable type: " + variable.getYoVariableType());

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

private void verifyYoVariablesAreEqual(YoVariable<?> variableOne, YoVariable<?> variableTwo)
{
 assertTrue(variableOne.getYoVariableType() == variableTwo.getYoVariableType());
 assertTrue(variableOne.getFullNameWithNameSpace().equals(variableTwo.getFullNameWithNameSpace()));
 assertEquals(variableOne.getValueAsDouble(), variableTwo.getValueAsDouble(), 1e-7);
}

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

@Test// timeout = 30000
public void testMirrorListenersAreCalledWhenOriginalChanges()
{
  YoVariableRegistry originalRegistry = createTestRegistry("OriginalRegistry", TEST_VARIABLE_COUNT);
  MirroredYoVariableRegistry mirroredYoVariableRegistry = new MirroredYoVariableRegistry(originalRegistry);
  ListenerCounter listenerCounter = new ListenerCounter();
  for (YoVariable<?> yoVariable : mirroredYoVariableRegistry.getAllVariables())
  {
    yoVariable.addVariableChangedListener(listenerCounter);
  }
  for (YoVariable<?> yoVariable : originalRegistry.getAllVariables())
  {
    yoVariable.setValueFromDouble(1.0);
  }
  mirroredYoVariableRegistry.updateMirror();
  assertEquals(listenerCounter.callCount, mirroredYoVariableRegistry.getAllVariables().size());
}

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

public void registerYovaribleForAutoSendToBehavior(YoVariable var)
{
 var.addVariableChangedListener(new VariableChangedListener()
 {
   @Override
   public void notifyOfVariableChange(YoVariable<?> v)
   {
    sendToBehavior(v.getName(), v.getValueAsDouble());
   }
 });
}

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

@Override
public String getFullVariableNameWithNameSpace()
{
 return variable.getFullNameWithNameSpace();
}

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

String name = variable.getName();
NameSpace nameSpace = variable.getNameSpace();
YoVariableType yoVariableType = variable.getYoVariableType();
YoVariableRegistry registry = rootRegistry.getOrCreateAndAddRegistry(nameSpace);

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

private void testAccess(YoVariable<?> v)
{
 Thread currentThread = Thread.currentThread();
 switch (currentThread.getName())
 {
 case "AWT-EventQueue-0":
 case "SCS simulation thread":
   System.out.println("[" + getClass().getSimpleName() + "] Variable " + v.getName() + " was changed from the UI.");
   return;
 }
 if (accessorThread == null)
 {
   accessorThread = currentThread;
 }
 if (!currentThread.equals(accessorThread))
 {
   try
   {
    throw new Exception("Variable " + v.getFullNameWithNameSpace() + " changed by thread " + currentThread + ", expected: " + accessorThread);
   }
   catch(Exception e)
   {
    if (DEBUG)
    {
      e.printStackTrace();
    }
   }
 }
}

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

public void writeCSV(PrintWriter writer)
{
  writer.print(variable.getNameSpace());
  writer.print(',');
  writer.print(variable.getName());
  writer.print(',');
  writer.print(minimum);
  writer.print(',');
  writer.print(maximum);
  writer.print(',');
  writer.print(average);
  writer.print(',');
  writer.print(maximum - minimum);
  writer.println();
}

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

private void writeVariableNamesToBeVerified(ArrayList<YoVariable<?>> variables) throws IOException
{
 dataOutputStream.writeInt(variables.size());
 dataOutputStream.flush();
 for (YoVariable<?> yoVariable : variables)
 {
   dataOutputStream.writeUTF(yoVariable.getFullNameWithNameSpace());
   dataOutputStream.writeInt(yoVariable.getYoVariableType().ordinal());
   dataOutputStream.flush();
      try
   {
    Thread.sleep(1); // Give the other side some time to process it.
   } 
   catch (InterruptedException e)
   {
   }
 }
}

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

public void setVariableInThisBox(YoVariable<?> variableInThisBox)
{
 activeEntryContainer.bindToVariable(variableInThisBox);
 this.variableInThisBox = variableInThisBox;
 String toolTip = variableInThisBox.getDescription();
 if ((toolTip == null) || toolTip.equals(""))
   toolTip = variableInThisBox.getFullNameWithNameSpace();
 this.setToolTipText(toolTip);
}

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

private void verifyTypesAreEqual(YoVariable<?> variableOne, YoVariable<?> variableTwo)
  {
   if (variableOne.getYoVariableType() != variableTwo.getYoVariableType())
     throw new RuntimeException("variableOne.getYoVariableType() != variableTwo.getYoVariableType()");
  }
}

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

/**
*
* @return the namespace of this parameter
*/
public NameSpace getNameSpace()
{
 return getVariable().getNameSpace();
}

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

@Override
 public void notifyOfVariableChange(YoVariable<?> v)
 {
   if (v.getValueAsDouble() < minVelocityX)
     v.setValueFromDouble(minVelocityX, false);
   if (v.getValueAsDouble() > maxVelocityX)
     v.setValueFromDouble(maxVelocityX, false);
 }
});

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

@Override
public String getVariableName()
{
 return variable.getName();
}

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com