Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed one of the height map graphics and only allow for the RDXHeightMapRender in the UI #696

Merged
merged 3 commits into from
Feb 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import us.ihmc.rdx.ui.affordances.RDXInteractableReferenceFrame;
import us.ihmc.rdx.ui.gizmo.RDXSelectablePose3DGizmo;
import us.ihmc.rdx.ui.graphics.RDXBodyPathPlanGraphic;
import us.ihmc.rdx.ui.graphics.RDXHeightMapGraphicNew;
import us.ihmc.rdx.ui.graphics.RDXGridMapGraphic;
import us.ihmc.robotics.robotSide.RobotSide;
import us.ihmc.robotics.robotSide.SideDependentList;
import us.ihmc.sensorProcessing.heightMap.HeightMapData;
Expand All @@ -55,7 +55,7 @@ public class RDXGPUHeightMapBodyPathPlanningDemo
private RDXInteractableReferenceFrame robotInteractableReferenceFrame;
private RDXSelectablePose3DGizmo ousterPoseGizmo;
private RDXEnvironmentBuilder environmentBuilder;
private RDXHeightMapGraphicNew heightMapGraphic;
private RDXGridMapGraphic heightMapGraphic;
private SimpleGPUHeightMapParameters simpleGPUHeightMapParameters;
private SimpleGPUHeightMapUpdater simpleGPUHeightMapUpdater;
private RosMainNode ros1Node;
Expand Down Expand Up @@ -138,7 +138,7 @@ public void create()
heightMapUpdater = new AlternateHeightMapUpdater();
}

heightMapGraphic = new RDXHeightMapGraphicNew();
heightMapGraphic = new RDXGridMapGraphic();
baseUI.getPrimaryScene().addRenderableProvider(heightMapGraphic, RDXSceneLevel.VIRTUAL);
baseUI.getImGuiPanelManager().addPanel("Height Map", this::renderHeightMapImGuiWidgets);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,46 +5,38 @@
import com.badlogic.gdx.utils.IntMap;
import com.badlogic.gdx.utils.Pool;
import perception_msgs.msg.dds.HeightMapMessage;
import us.ihmc.sensorProcessing.globalHeightMap.GlobalHeightMap;
import us.ihmc.sensorProcessing.globalHeightMap.GlobalMapTile;
import us.ihmc.sensorProcessing.heightMap.HeightMapData;
import us.ihmc.sensorProcessing.heightMap.HeightMapMessageTools;
import us.ihmc.tools.thread.MissingThreadTools;
import us.ihmc.tools.thread.ResettableExceptionHandlingExecutorService;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;

/**
* Creates a graphic for the GPU Height Map to be visualized in the RDX UI. Each height value from the height map is turned into a 2cm polygon that is then
* visualized on the UI. The height value location will be in the center of the 2cm polygon that is visualized.
*/
public class RDXGlobalHeightMapGraphic implements RenderableProvider
{
private final IntMap<RDXHeightMapGraphicNew> globalMapRenderables = new IntMap<>();
private final IntMap<RDXGridMapGraphic> globalMapRenderables = new IntMap<>();

private final ResettableExceptionHandlingExecutorService executorService = MissingThreadTools.newSingleThreadExecutor(getClass().getSimpleName(), true, 1);

public void update()
{
for (RDXHeightMapGraphicNew mapRenderables : globalMapRenderables.values())
for (RDXGridMapGraphic mapRenderables : globalMapRenderables.values())
mapRenderables.update();
}

public void generateMeshesAsync(HeightMapMessage heightMapMessage, int tileKey)
{

RDXHeightMapGraphicNew graphic = getOrCreateHeightMapGraphic(tileKey);
RDXGridMapGraphic graphic = getOrCreateHeightMapGraphic(tileKey);
graphic.generateMeshesAsync(heightMapMessage);
}

private RDXHeightMapGraphicNew getOrCreateHeightMapGraphic(int tileKey)
private RDXGridMapGraphic getOrCreateHeightMapGraphic(int tileKey)
{
RDXHeightMapGraphicNew graphic = globalMapRenderables.get(tileKey);
RDXGridMapGraphic graphic = globalMapRenderables.get(tileKey);
if (graphic == null)
{
graphic = new RDXHeightMapGraphicNew();
graphic = new RDXGridMapGraphic();
globalMapRenderables.put(tileKey, graphic);
}

Expand All @@ -54,14 +46,14 @@ private RDXHeightMapGraphicNew getOrCreateHeightMapGraphic(int tileKey)
@Override
public void getRenderables(Array<Renderable> renderables, Pool<Renderable> pool)
{
for (RDXHeightMapGraphicNew mapRenderables : globalMapRenderables.values())
for (RDXGridMapGraphic mapRenderables : globalMapRenderables.values())
mapRenderables.getRenderables(renderables, pool);
}

public void destroy()
{
executorService.destroy();
for (RDXHeightMapGraphicNew mapRenderables : globalMapRenderables.values())
for (RDXGridMapGraphic mapRenderables : globalMapRenderables.values())
mapRenderables.destroy();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@
import java.util.function.IntFunction;
import java.util.function.IntToDoubleFunction;

/**
* This class has been replaced with a newer implementation called {@link RDXHeightMapGraphicNew}, please use that going forward and use this one only for
* reference
*/
@Deprecated
public class RDXGridMapGraphic implements RenderableProvider
{
Expand All @@ -59,10 +55,6 @@ public class RDXGridMapGraphic implements RenderableProvider

private static final double zForInPainting = 0.95;

public void clear()
{
}

public void update()
{
createModelFromMeshBuilders();
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ public class RDXSteppableRegionGraphic implements RenderableProvider

public void clear()
{
for (int i = 0; i < gridMapGraphics.size(); i++)
gridMapGraphics.get(i).clear();

regionGraphics.clear();
gridMapGraphics.clear();
}
Expand Down
Loading
Loading