gpt4 book ai didi

us.ihmc.robotics.graphics.YoGraphicPlanarRegionsList类的使用及代码示例

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

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

YoGraphicPlanarRegionsList介绍

[英]YoGraphic that can display PlanarRegionsList locally, with SCS for instance, and remotely, with SCSVisualizer for instance. The implementation is complex because the overall number of vertices of a PlanarRegionsList tends to get really big overtime. Instead of creating a gazillion of YoVariables to store all vertices of any given PlanarRegionsList, a small buffer of vertices is used to update only a portion of the given PlanarRegionsList.

In addition to the complexity due to the constantly growing number of vertices, some synchronization has to be done when displaying this YoGraphic remotely. When the display thread is rendering at a slower pace than the YoVariables are being updated, without any synchronization, only portions of the meshes will be rendered.

Usage of this YoGraphic:

  • #submitPlanarRegionsListToRender(PlanarRegionsList) informs that a new PlanarRegionsList is to be processed to get eventually rendered. The method does not change YoVariables and does not compute any mesh. Up to MAX_PLANAR_REGIONS_LIST_DEQUE_SIZE PlanarRegionsList can be queued. Beyond that limit, new PlanarRegionsList will simply be ignored.
  • Once a PlanarRegionsList is submitted, #processPlanarRegionsListQueue() will pack a portion the PlanarRegionsList in this #vertexBuffer, #currentRegionId, and #currentRegionPose. Then #update() is called.
  • When rendering this YoGraphic locally, #update() simply computes the current mesh to be updated, if any. When rendering this YoGraphic remotely, #update() will in addition inform the WRITER version of the YoGraphic that it is ready to process a new mesh. This allows to amke sure that remote graphic are properly displayed.
    [中]YoGraphic可以在本地显示PlanarRegionList,例如SCS,也可以在远程显示,例如SCSVisualizer。实现是复杂的,因为PlanarRegionList的顶点总数往往会随着时间的推移而变得非常大。不是创建大量变量来存储任何给定PlanarRegionList的所有顶点,而是使用一个小的顶点缓冲区来仅更新给定PlanarRegionList的一部分。
    除了顶点数量不断增加带来的复杂性外,远程显示此图像时还必须进行一些同步。当显示线程的渲染速度低于更新变量的速度时,如果不进行任何同步,则只渲染部分网格。
    这本瑜伽书的用法:
    *#SubmitPlanarRegionList ToRender(PlanarRegionList)通知将处理新的PlanarRegionList以最终渲染。该方法不会更改变量,也不会计算任何网格。最多可排队最大平面区域列表大小平面区域列表。超过这个限制,新的PlanarRegionList将被忽略。
    *提交PlanarRegionList后,#ProcessPlanarRegionListQueue()将PlanarRegionList的一部分打包到这个#vertexBuffer、#currentRegionId和#currentRegionPose中。然后调用#update()。
    *在本地渲染此YoGraphic时,#update()只需计算要更新的当前网格(如果有)。远程渲染此YoGraphic时,#update()还会通知编写器版本的YoGraphic,它已准备好处理新网格。这样可以确保远程图形正确显示。

代码示例

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

/**
* Processes the queue of lists of planar regions to render and updates the graphics.
* This method need to called every update tick in the caller.
*/
public void processPlanarRegionsListQueue()
{
 processPlanarRegionsListQueue(true);
}

代码示例来源:origin: us.ihmc/robot-environment-awareness-application

public void handlePacket(PlanarRegionsListMessage message)
{
 if (message != null)
   yoGraphicPlanarRegionsList.submitPlanarRegionsListToRender(PlanarRegionMessageConverter.convertToPlanarRegionsList(message));
}

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

/** {@inheritDoc} */
@Override
public YoGraphicPlanarRegionsList duplicate(YoVariableRegistry newRegistry)
{
 return new YoGraphicPlanarRegionsList(getName(), getVariables(), getConstants());
}

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

public void clear()
{
 clear.set(true);
 planarRegionsListsDeque.clear();
 clearYoVariables();
 update();
}

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

yoGraphicPlanarRegionsList.submitPlanarRegionsListToRender(planarRegionsList);
yoGraphicPlanarRegionsList.processPlanarRegionsListQueue();
yoGraphicPlanarRegionsList.clear();

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

/**
* Create a YoGraphic for remote visualization.
* @param name name of this YoGraphic.
* @param yoVariables the list of YoVariables needed for this YoGraphic expected to be in the same order as packed in {@link #getVariables()}.
* @param constants the list of constants (variables that will never change) needed for this YoGraphic expected to be in the same order as packed in {@link #getConstants()}.
* @return a YoGraphic setup for remote visualization.
*/
static YoGraphicPlanarRegionsList createAsRemoteYoGraphic(String name, YoVariable<?>[] yoVariables, double[] constants)
{
 return new YoGraphicPlanarRegionsList(name, yoVariables, constants);
}

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

/**
* @return a new mesh given the current values of the YoVariables. The mesh belongs to a single region but can contain several polygons.
*/
private MeshDataHolder createCurrentMesh()
{
 ModifiableMeshDataHolder modifiableMeshDataHolder = new ModifiableMeshDataHolder();
 int firstVertexIndex = 0;
 boolean isDoneExtractingPolygons = false;
 while (!isDoneExtractingPolygons)
 {
   int numberOfVertices = findPolygonSize(firstVertexIndex);
   modifiableMeshDataHolder.add(createPolygonMesh(firstVertexIndex, numberOfVertices), true);
   firstVertexIndex += numberOfVertices + 1;
   if (firstVertexIndex >= vertexBufferSize)
   {
    isDoneExtractingPolygons = true;
   }
   else
   {
    isDoneExtractingPolygons = vertexBuffer.get(firstVertexIndex).containsNaN();
   }
 }
 return modifiableMeshDataHolder.createMeshDataHolder();
}

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

MeshDataHolder polygonMesh = createCurrentMesh();
polygonMesh.setName("PlanarRegion");
AppearanceDefinition appearance = getCurrentAppearance();

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

/**
* Submit a new list of planar regions to eventually render.
* This method does NOT update any YoVariables and does not update any graphics.
* Once a list of planar regions is submitted, the method {@link #processPlanarRegionsListQueue()} has to be called every update tick in the caller.
* @param planarRegionsList the list of planar regions to be eventually rendered.
*/
public void submitPlanarRegionsListToRender(PlanarRegionsList planarRegionsList)
{
 if (planarRegionsList == null)
 {
   //TODO: Clear the viz when the planarRegionsList is null;
      return;
 }
 if (planarRegionsListsDeque.size() > MAX_PLANAR_REGIONS_LIST_DEQUE_SIZE)
   return;
 // This YoGraphic modifies the planarRegionsList.
 // A full depth copy has to be created to prevent changing the argument.
 PlanarRegionsList copy = planarRegionsList.copy();
 PlanarRegionsList filteredPlanarRegionsList = filterEmptyRegionsAndEmptyPolygons(copy);
 if (filteredPlanarRegionsList != null)
   planarRegionsListsDeque.addLast(filteredPlanarRegionsList);
}

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

public RoboticsRemoteYoGraphicFactory()
  {
   registerBuilder(YoGraphicPlanarRegionsList.class,
           (name, vars, consts, appearance) -> YoGraphicPlanarRegionsList.createAsRemoteYoGraphic(name, vars, consts));
   registerBuilder(YoGraphicPolynomial3D.class, (name, vars, consts, appearance) -> YoGraphicPolynomial3D.createAsRemoteYoGraphic(name, vars, consts));
  }
}

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

currentRegionPose = new YoFramePose3D(name + "CurrentRegionPose", worldFrame, registry);
clearYoVariables();

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

yoGraphicPlanarRegionsList.submitPlanarRegionsListToRender(planarRegionsList);
yoGraphicPlanarRegionsList.processPlanarRegionsListQueue();
yoGraphicPlanarRegionsList.clear();

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

public FootstepPlanningToolboxController(RobotContactPointParameters<RobotSide> contactPointParameters, FootstepPlannerParameters footstepPlannerParameters,
                    VisibilityGraphsParameters visibilityGraphsParameters, StatusMessageOutputManager statusOutputManager,
                    YoVariableRegistry parentRegistry, YoGraphicsListRegistry graphicsListRegistry, double dt)
{
 super(statusOutputManager, parentRegistry);
 this.dt = dt;
 this.yoGraphicPlanarRegionsList = new YoGraphicPlanarRegionsList("FootstepPlannerToolboxPlanarRegions", 200, 30, registry);
 SideDependentList<ConvexPolygon2D> contactPointsInSoleFrame;
 if (contactPointParameters == null)
   contactPointsInSoleFrame = PlannerTools.createDefaultFootPolygons();
 else
   contactPointsInSoleFrame = createFootPolygonsFromContactPoints(contactPointParameters);
 footstepPlanningParameters = new YoFootstepPlannerParameters(registry, footstepPlannerParameters);
 this.visibilityGraphsParameters = new YoVisibilityGraphParameters(visibilityGraphsParameters, registry);
 plannerMap.put(FootstepPlannerType.PLANAR_REGION_BIPEDAL, createPlanarRegionBipedalPlanner(contactPointsInSoleFrame));
 plannerMap.put(FootstepPlannerType.PLAN_THEN_SNAP, new PlanThenSnapPlanner(new TurnWalkTurnPlanner(), contactPointsInSoleFrame));
 plannerMap.put(FootstepPlannerType.A_STAR, createAStarPlanner(contactPointsInSoleFrame));
 plannerMap
    .put(FootstepPlannerType.SIMPLE_BODY_PATH, new SplinePathWithAStarPlanner(footstepPlanningParameters, contactPointsInSoleFrame, parentRegistry, null));
 plannerMap.put(FootstepPlannerType.VIS_GRAPH_WITH_A_STAR,
         new VisibilityGraphWithAStarPlanner(footstepPlanningParameters, this.visibilityGraphsParameters, contactPointsInSoleFrame,
                           graphicsListRegistry, parentRegistry));
 activePlanner.set(FootstepPlannerType.PLANAR_REGION_BIPEDAL);
 graphicsListRegistry.registerYoGraphic("footstepPlanningToolbox", yoGraphicPlanarRegionsList);
 isDone.set(true);
 planId.set(FootstepPlanningRequestPacket.NO_PLAN_ID);
}

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

clearYoVariables();
return;
if (planarRegionsListsDeque.isEmpty())
 clearYoVariables();
 return;
   clearYoVariables();
   return;
update();

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

yoGraphicPlanarRegionsList.submitPlanarRegionsListToRender(planarRegionsList.get());
yoGraphicPlanarRegionsList.processPlanarRegionsListQueue();
yoGraphicPlanarRegionsList.clear();

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

/**
* Submit a new list of planar regions to eventually render.
* This method does NOT update any YoVariables and does not update any graphics.
* Once a list of planar regions is submitted, the method {@link #processPlanarRegionsListQueue()} has to be called every update tick in the caller.
* @param planarRegionsList the list of planar regions to be eventually rendered.
* @param requestedAppearance appearance to render the planar regions
*/   
public void submitPlanarRegionsListToRender(PlanarRegionsList planarRegionsList, Color requestedColor)
{
 for(int i = 0; i < planarRegionsList.getNumberOfPlanarRegions(); i++)
 {
   int index = i + currentMeshIndex.getIntegerValue();         
   if(index < 0 || index >= planarRegionsColorBuffer.length)
    break;
   planarRegionsColorBuffer[index].set(requestedColor.getRGB());
 }
 
 submitPlanarRegionsListToRender(planarRegionsList);
}

代码示例来源:origin: us.ihmc/robot-environment-awareness-application

yoGraphicPlanarRegionsList.processPlanarRegionsListQueue();

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

this.statusOutputManager = statusOutputManager;
this.tickDurationMs = tickDurationMs;
this.yoGraphicPlanarRegionsList = new YoGraphicPlanarRegionsList("FootstepPlannerPlanarRegions", 200, 30, registry);
goalRecommendationHandler = new PlannerGoalRecommendationHandler(allStepPlanningStages, stepPlanningStagesInProgress);

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