gpt4 book ai didi

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

转载 作者:知者 更新时间:2024-03-15 08:59:31 25 4
gpt4 key购买 nike

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

YoVariableList介绍

暂无

代码示例

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

private ArrayList<YoVariable<?>> getSimpleRobotRegExpVariables(String[] varNames, String[] regularExpressions, Robot robotModel)
{
 ArrayList<YoVariable<?>> currentlyMatched = robotModel.getAllVariables();
 YoVariableList tempList = new YoVariableList("temp");
 for (int i = 0; i < currentlyMatched.size(); i++)
 {
   YoVariable var = currentlyMatched.get(i);
   tempList.addVariable(var);
 }
 return tempList.getMatchingVariables(varNames, regularExpressions);
}

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

private YoVariableList createYoVariableList(String name, YoVariable<?>[] yoVariables)
{
 YoVariableList yoVariableList = new YoVariableList(name);
 yoVariableList.addVariables(yoVariables);
 return yoVariableList;
}

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

private void putVariablesInIndexMap()
{
 for (int i = 0; i < allVariables.size(); i++)
 {
   YoVariable<?> v = allVariables.getVariable(i);
   allVariablesIndexMap.put(v, i);
   System.out.println(i + " " + v.getFullNameWithNameSpace());
 }
}

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

public void addVariables(YoVariableList controlVars)
{
 ArrayList<YoVariable<?>> variables = controlVars.getVariables();
 this.addVariables(variables);
}

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

@Test// timeout = 30000
public void testWritingAndReadingALongStateFile() throws IOException
{
 File fileOne = new File("fileOne.state");
 if (fileOne.exists())
   fileOne.delete();
 long seed = 1776L;
 int numberOfVariables = 2000;    // 12000 for when testing long files for efficiency;
 Random random = new Random(seed);
 ArrayList<YoVariable<?>> variables = createALargeNumberOfVariables(random, numberOfVariables);
 YoVariableList originalVarList = new YoVariableList("originalVarList");
 originalVarList.addVariables(variables);
 writeALongStateFile(fileOne, variables);
 DataFileReader dataFileReader = new DataFileReader(fileOne);
 YoVariableList newVarList = new YoVariableList("newVarList");
 boolean createMissingVariables = true;
 boolean printErrorForMissingVariables = false;
 YoVariableRegistry registry = new YoVariableRegistry("root");
 dataFileReader.readState(newVarList, createMissingVariables, printErrorForMissingVariables, registry);
 assertEquals(originalVarList.size(), newVarList.size());
 for (int i = 0; i < originalVarList.size(); i++)
 {
   YoVariable<?> originalVariable = originalVarList.getVariable(i);
   YoVariable<?> newVariable = newVarList.getVariable(originalVariable.getName());
   assertFalse(originalVariable == newVariable);
   assertEquals(originalVariable.getValueAsDouble(), newVariable.getValueAsDouble(), 1e-7);
 }
 fileOne.delete();
}

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

YoVariableList varList = new YoVariableList("foo_" + count);
varList.addVariable(foo);

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

public void convertData() throws IOException
{
 File binaryFile = new File(binaryFilename);
 File asciiFile = new File(asciiFilename);
 int bufferSize = 16000;
 DataFileReader reader = new DataFileReader(binaryFile);
 YoVariableList newVars = new YoVariableList("Converter");
 DataBuffer dataBuffer = new DataBuffer(bufferSize);
 YoVariableRegistry rootRegistry = new YoVariableRegistry("root");
 reader.readData(newVars, rootRegistry, dataBuffer);
 DataFileWriter dataFileWriter = new DataFileWriter(asciiFile);
 boolean binary = false;
 boolean compress = false;
 ArrayList<YoVariable<?>> varsToWrite = newVars.getVariables();
 dataFileWriter.writeData("ConvertedData", 0.001, dataBuffer, varsToWrite, binary, compress);
}

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

public void addVariables(YoVariable<?>[] variables)
{
 for (int i = 0; i < variables.length; i++)
 {
   this.addVariable(variables[i]);
 }
}

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

@Override
  public void doAllRegistriesAndVariables(String[] registryNames, String[][] variableNames, float[][] initialValues)
  {
   if (registryNames.length != variableNames.length) throw new RuntimeException("registryNames.length != variableNames.length");
   if (registryNames.length != initialValues.length) throw new RuntimeException("registryNames.length != initialValues.length");
   
   doAllRegistries(registryNames, variableNames);

   allVariables = new YoVariableList("All Variables");
   for (int i=0; i<variableNames.length; i++)
   {
     addVariables(variableNames[i].length, variableNames[i], initialValues[i]);
   }
   putVariablesInIndexMap();

//      verifyRegistriesAndVariableListsAreConsistent(registryNames, variableNames);
   doneReceivingAllRegistriesAndVariables = true;
  }

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

public synchronized boolean hasVariableWithName(String name)
{
 if (getVariable(name) != null)
 {
   return true;
 }
 return false;
}

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

private void createVarListsIncludingChildren(HashMap<String, YoVariableList> allVarLists)
{
 // Add mine:
 YoVariableList myVarList = this.createVarList();
 if (allVarLists.containsKey(myVarList.getName()))
 {
   YoVariableList varList = allVarLists.get(myVarList.getName());
   varList.addVariables(myVarList);
 }
 else
 {
   allVarLists.put(myVarList.getName(), myVarList);
 }
 // Add all the children recursively:
 for (YoVariableRegistry child : children)
 {
   child.createVarListsIncludingChildren(allVarLists);
 }
}

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

Random random = new Random(seed);
ArrayList<YoVariable<?>> variables = createALargeNumberOfVariables(random, numberOfVariables);
YoVariableList originalVarList = new YoVariableList("originalVarList");
originalVarList.addVariables(variables);
YoVariableList newVarList = new YoVariableList("newVarList");
YoVariableRegistry registry = new YoVariableRegistry("rootRegistry");
dataFileReader.readData(newVarList, registry, newDataBuffer);
assertEquals(originalVarList.size(), newVarList.size());
for (int i = 0; i < originalVarList.size(); i++)
  YoVariable<?> originalVariable = originalVarList.getVariable(i);
  YoVariable<?> newVariable = newVarList.getVariable(originalVariable.getName());

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

public void addVariables(ArrayList<YoVariable<?>> list)
{
 for (YoVariable<?> variable : list)
 {
   this.addVariable(variable);
 }
}

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

private void testDataWriteReadIsTheSame(DataBuffer dataBuffer, ArrayList<YoVariable<?>> allVariables, boolean binary, boolean compress,
    boolean spreadsheetFormatted, Robot robot) throws IOException, URISyntaxException
{
 String filename = TEST_DIRECTORY + "testFile.data";
 if (spreadsheetFormatted)
   filename = filename + ".csv";
 if (compress)
   filename = filename + ".gz";
 URL resource = getClass().getClassLoader().getResource(filename);
 File testFile = new File(resource.getFile());
 String model = "testModel";
 double recordDT = 0.001;
 DataFileWriter dataFileWriter = new DataFileWriter(testFile);
 if (spreadsheetFormatted)
 {
   dataFileWriter.writeSpreadsheetFormattedData(dataBuffer, allVariables);
 }
 else
 {
   dataFileWriter.writeData(model, recordDT, dataBuffer, allVariables, binary, compress, robot);
 }
 DataFileReader dataFileReader = new DataFileReader(testFile);
 DataBuffer readBackBuffer = new DataBuffer(dataBuffer.getBufferSize());
 YoVariableRegistry readBackRegistry = new YoVariableRegistry("rootRegistry");
 YoVariableList newVars = new YoVariableList("newVars");
 dataFileReader.readData(newVars, readBackRegistry, readBackBuffer);
 boolean dataIsEqual = readBackBuffer.checkIfDataIsEqual(dataBuffer, 1e-7);
 assertTrue(dataIsEqual);
}

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

YoVariable<?> var = getVariable(name);

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

public ArrayList<YoVariable<?>> getVars(String[] varNames, String[] regularExpressions)
{
 YoVariableList tempList = new YoVariableList("temp");
 for (int i = 0; i < entries.size(); i++)
 {
   YoVariable<?> var = (entries.get(i)).getVariable();
   tempList.addVariable(var);
 }
 return tempList.getMatchingVariables(varNames, regularExpressions);
}

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

public YoVariableList createVarList()
{
 YoVariableList ret = new YoVariableList(this.nameSpace.getName());
 ret.addVariables(controlVars);
 return ret;
}

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

private void updateLogVarsCount()
{
 logVarsCount = 0;
 int numberToIterate = allVariables.size();
 
 for (int i=0; i<numberToIterate; i++)
 {
   YoVariable<?> var = allVariables.getVariable(i);
   if (var.getYoVariableRegistry().isLogged())
    logVarsCount++;
 }
}

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

private void addVariableAndSetInitialValue(float initialValue, String fullVariableName, YoVariable<?> variable)
{
 System.out.println("Found var: " + fullVariableName);
 allVariables.addVariable(variable);
 variable.setValueFromDouble(initialValue);
}

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

private void addVariables(int nvars, String[] vars, float[] vals)
{
 for (int i = 0; i < nvars; i++)
 {
   // System.out.println("Looking for var " + vars[i]);
   String fullVariableName = vars[i];
   YoVariable<?> v = rootRegistry.getVariable(fullVariableName);
   if (allVariables.getVariable(fullVariableName) != null)
   {
    System.err.println("Robot has repeat variable names! Already registered " + fullVariableName);
    System.err.flush();
    System.exit(-1);
   }
   if (v != null)
   {
    addVariableAndSetInitialValue(vals[i], fullVariableName, v);
   }
   else
   {
    createAndAddVariableAndSetInitialValue(vals[i], fullVariableName);
   }
 }
}

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