us.ihmc.robotics.dataStructures.variable.YoVariable.getName()方法的使用及代码示例

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

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

YoVariable.getName介绍

[英]Retrieves the name of this YoVariable.
[中]检索此变量的名称。

代码示例

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

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/IHMCRobotDataLogger

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/IHMCRoboticsToolkit

public boolean containsVariable(YoVariable<?> variable)
{
 String variableName = variable.getName();
 ArrayList<YoVariable<?>> arrayList = variablesMappedByName.get(variableName);
 if ((arrayList != null) && (arrayList.contains(variable)))
   return true;
 return false;
}

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

public synchronized String[] getVariableNames()
{
 String[] ret = new String[variables.size()];
 for (int i = 0; i < variables.size(); i++)
 {
   ret[i] = variables.get(i).getName();
 }
 return ret;
}

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

public void removeVariable(YoVariable<?> variable)
{
 String variableName = variable.getName();
 if (variablesMappedByName.containsKey(variableName))
 {
   ArrayList<YoVariable<?>> arrayList = variablesMappedByName.get(variableName);
   arrayList.remove(variable);
   variables.remove(variable);
 }
}

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

public void registerVariable(YoVariable<?> variable)
{
 String variableName = variable.getName();
 variableName = variableName.toLowerCase(); // Make everything case insensitive! Cannot have two YoVariables with same names except case.
 if (controlVarsHashMap.containsKey(variableName))
 {
   System.err.println("Error:  " + variable.getName() + " has already been registered in this registry! YoVariableRegistry nameSpace = " + nameSpace);
   // Sometimes RuntimeExceptions are not displayed, but the error out is still visible.
   throw new RuntimeException("Error:  " + variable.getName() + " has already been registered in this registry! YoVariableRegistry nameSpace = "
      + nameSpace);
 }
 controlVarsHashMap.put(variableName, variable);
 controlVars.add(variable);
 notifyListenersYoVariableWasRegistered(variable);
}

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

private static void registerVariable(YoVariableRegistry registry, YoVariable<?> variable)
{
 if (registry != null)
 {
   registry.registerVariable(variable);
 }
 else if (warnAboutNullRegistries)
 {
   System.err.println("[WARN] " + YoVariable.class.getSimpleName() + ": " + variable.getName() + " is getting created with a null registry");
 }
}

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

public void printOutCorruptorVariablesToOptimize()
{
 System.out.println();
 for (YoVariable<?> yoVariable : corruptorVariablesToOptimize)
 {
   System.out.println(yoVariable.getName() + " = " + formatNumber(yoVariable) + ";");
 }
}

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

public void printOutAllCorruptorVariables()
{
 System.out.println();
 for (YoVariable<?> yoVariable : corruptorVariables)
 {
   System.out.println(yoVariable.getName() + " = " + formatNumber(yoVariable) + ";");
 }
 
 System.out.println();
 for (YoVariable<?> yoVariable : torqueOffsetVariables)
 {
   System.out.println(yoVariable.getName() + " = " + formatNumber(yoVariable) + ";");
 }
}

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

public void addVariable(YoVariable<?> variable)
{
 String variableName = variable.getName();
 ArrayList<YoVariable<?>> arrayList = variablesMappedByName.get(variableName);
 if (arrayList == null)
 {
   arrayList = new ArrayList<YoVariable<?>>(1);
   variablesMappedByName.put(variable.getName(), arrayList);
 }
 if (!arrayList.contains(variable))
 {
   variables.add(variable);
   arrayList.add(variable);
   notifyListeners();
 }
}

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

private void printOutYoVariableNames()
{
 YoVariableRegistry rootRegistry = scs.getRootRegistry();
 ArrayList<YoVariable<?>> allVariablesIncludingDescendants = rootRegistry.getAllVariablesIncludingDescendants();
 for (YoVariable<?> yoVariable : allVariablesIncludingDescendants)
 {
   System.out.println(yoVariable.getName());
 }
}

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

private void recursivelyGetMatchingVariables(ArrayList<YoVariable<?>> ret, String[] regularExpressions)
{
 if (regularExpressions != null)
 {
   for (int i = 0; i < regularExpressions.length; i++)
   {
    Pattern pattern = Pattern.compile(regularExpressions[i]);
    for (int j = 0; j < controlVars.size(); j++)
    {
      YoVariable<?> var = controlVars.get(j);
      Matcher matcher = pattern.matcher(var.getName());
      if (matcher.matches())
      {
       ret.add(var);
      }
    }
   }
 }
 for (YoVariableRegistry child : children)
 {
   child.recursivelyGetMatchingVariables(ret, regularExpressions);
 }
}

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

public void setVariablesToOptimize(String[] containsToOptimizeCoM, String[] containsToOptimizeTorqueScores)
{
 corruptorVariablesToOptimize.clear();
 torqueScoresToOptimize.clear();
 for (YoVariable<?> variable : corruptorVariables)
 {
   for (String string : containsToOptimizeCoM)
   {
    if (variable.getName().contains(string))
    {
      corruptorVariablesToOptimize.add(variable);
      System.out.println("Adding " + variable.getName() + " to optimization variables.");
      break;
    }
   }
 } 
 for (DoubleYoVariable variable : torqueScoreVariables)
 {
   for (String string : containsToOptimizeTorqueScores)
   {
    if (variable.getName().contains(string))
    {
      torqueScoresToOptimize.add(variable);
      System.out.println("Adding " + variable.getName() + " to torqueScores to optimize.");
      break;
    }
   }
 }
}

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

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/IHMCRobotDataVisualizer

private void printOutYoVariableNames()
{
 YoVariableRegistry rootRegistry = scs.getRootRegistry();
 ArrayList<YoVariable<?>> allVariablesIncludingDescendants = rootRegistry.getAllVariablesIncludingDescendants();
 for (YoVariable<?> yoVariable : allVariablesIncludingDescendants)
 {
   System.out.println(yoVariable.getName());
 }
}

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

@Override
  public void variableChanged(YoVariable<?> v)
  {
   sendToBehavior(v.getName(), v.getValueAsDouble());
  }
});

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

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/IHMCRoboticsToolkit

Matcher matcher = pattern.matcher(var.getName());

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

@Override
  public void variableChanged(YoVariable<?> v)
  {
   sendToUI(v.getName(), v.getValueAsDouble());
  }
});

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

yoVariableDefinition.setName(variable.getName());
yoVariableDefinition.setRegistry(registryID);

相关文章