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

Initial implementation for square up and walk-to-goal for CH process #694

Merged
merged 32 commits into from
Feb 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
f4cb234
Added an example of how to create a 3d matrix
PotatoPeeler3000 Feb 11, 2025
a8294a6
Remove unused code for testing
PotatoPeeler3000 Feb 11, 2025
7f03cda
Fixed 3d cuda example and return the average to the cpu
PotatoPeeler3000 Feb 11, 2025
c5b1f13
Using cudaMalloc3D
TomaszTB Feb 11, 2025
06c1006
Started writing a test to have this example be used in a class
PotatoPeeler3000 Feb 11, 2025
94dac47
Fixed FilteredRapidHeightMapExtractor to compute the average of the h…
PotatoPeeler3000 Feb 11, 2025
29920f7
Updated the kernel to compute the height estimate based on a moving a…
PotatoPeeler3000 Feb 12, 2025
ab8ee1a
Alpha filter (ish) is working on the height map, UI button to turn th…
PotatoPeeler3000 Feb 12, 2025
8c0cd8e
Tuned filter a little bit
PotatoPeeler3000 Feb 13, 2025
03f2c43
Merge branch 'refs/heads/develop' into feature/3d-kernel-example
PotatoPeeler3000 Feb 15, 2025
582910a
Update environments for the UI
PotatoPeeler3000 Feb 15, 2025
da4c67b
Switched from ROS2Helper to ROS2Node for StoredPropertySets and switc…
PotatoPeeler3000 Feb 19, 2025
f2d2dd8
Using createSubscription2 where applicable (#679)
TomaszTB Feb 19, 2025
7210f10
Merge branch 'develop' into feature/one-ui
PotatoPeeler3000 Feb 20, 2025
c51203a
Switch height map to use ros2Node to remove ros2Helper
PotatoPeeler3000 Feb 20, 2025
4f5fdd7
Implemented square up and walk to goal as a message within CH
PotatoPeeler3000 Feb 22, 2025
b5b09e3
Fix translation for when robot isn't facing forward
PotatoPeeler3000 Feb 22, 2025
6221b64
Cleanup UI look so there is less scrolling involved
PotatoPeeler3000 Feb 22, 2025
bdd6eb4
Moved the RapidHeightMapManager into the perception package to reduce…
PotatoPeeler3000 Feb 24, 2025
b98358d
Add reset method for visuals
PotatoPeeler3000 Feb 24, 2025
d1205fa
Merge branch 'feature/3d-kernel-example' into feature/new-ch-messages
PotatoPeeler3000 Feb 24, 2025
3109bc8
Cleanup files and remove testing lines
PotatoPeeler3000 Feb 24, 2025
a78af41
Moved publisher to constructor
PotatoPeeler3000 Feb 24, 2025
539411a
Merge branch 'develop' into feature/new-ch-messages
PotatoPeeler3000 Feb 24, 2025
5431014
Change planar region to use ros2helper still, merge conflict
PotatoPeeler3000 Feb 24, 2025
9bec35b
Cleanup code mainly for height map filter
PotatoPeeler3000 Feb 24, 2025
e22e2e6
Cleanup filtered kernel
PotatoPeeler3000 Feb 26, 2025
7fb78e1
Check error after mem copy
PotatoPeeler3000 Feb 26, 2025
4025d10
Change error checking
PotatoPeeler3000 Feb 26, 2025
7873a70
Change error checking
PotatoPeeler3000 Feb 26, 2025
9adb15d
Cleanup fields
PotatoPeeler3000 Feb 26, 2025
8c04fc1
Merge branch 'develop' into feature/new-ch-messages
PotatoPeeler3000 Feb 27, 2025
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 @@ -4,6 +4,7 @@
import behavior_msgs.msg.dds.ContinuousWalkingStatusMessage;
import controller_msgs.msg.dds.FootstepDataListMessage;
import ihmc_common_msgs.msg.dds.PoseListMessage;
import std_msgs.msg.dds.Empty;
import us.ihmc.communication.property.StoredPropertySetROS2TopicPair;
import us.ihmc.ros2.ROS2Topic;

Expand All @@ -16,8 +17,10 @@ public class ContinuousHikingAPI

// Commands supported for the Continuous Hiking Process
public static final ROS2Topic<ContinuousHikingCommandMessage> CONTINUOUS_HIKING_COMMAND = IHMC_ROOT.withModule(moduleName).withType(ContinuousHikingCommandMessage.class).withSuffix("command");
public static final ROS2Topic<std_msgs.msg.dds.Empty> CLEAR_GOAL_FOOTSTEPS = IHMC_ROOT.withModule(moduleName).withType(std_msgs.msg.dds.Empty.class).withSuffix("clear_goal_footsteps");
public static final ROS2Topic<Empty> CLEAR_GOAL_FOOTSTEPS = IHMC_ROOT.withModule(moduleName).withType(Empty.class).withSuffix("clear_goal_footsteps");
public static final ROS2Topic<PoseListMessage> PLACED_GOAL_FOOTSTEPS = IHMC_ROOT.withModule(moduleName).withType(PoseListMessage.class).withSuffix("placed_goal_footsteps");
public static final ROS2Topic<PoseListMessage> ROTATE_GOAL_FOOTSTEPS = IHMC_ROOT.withModule(moduleName).withType(PoseListMessage.class).withSuffix("rotate_goal_footsteps");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New messages to walk the robot around with little user input

public static final ROS2Topic<Empty> SQUARE_UP_STEP = IHMC_ROOT.withModule(moduleName).withType(Empty.class).withSuffix("rotate_goal_footsteps");

// Statuses supported from the Continuous Hiking Process
public static final ROS2Topic<ContinuousWalkingStatusMessage> CONTINUOUS_WALKING_STATUS = IHMC_ROOT.withModule(moduleName).withType(ContinuousWalkingStatusMessage.class).withSuffix("status");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import us.ihmc.perception.BytedecoImage;
import us.ihmc.perception.camera.CameraIntrinsics;
import us.ihmc.perception.gpuHeightMap.RapidHeightMapExtractor;
import us.ihmc.perception.gpuHeightMap.RapidHeightMapManager;
import us.ihmc.perception.heightMap.TerrainMapData;
import us.ihmc.perception.opencl.OpenCLManager;
import us.ihmc.robotics.robotSide.RobotSide;
Expand All @@ -39,12 +40,17 @@ public void testMonteCarloFootstepPlanning()
CameraIntrinsics depthImageIntrinsics = new CameraIntrinsics();
BytedecoImage heightMapBytedecoImage = new BytedecoImage(depthImageIntrinsics.getWidth(), depthImageIntrinsics.getHeight(), opencv_core.CV_16UC1);
heightMapBytedecoImage.createOpenCLImage(openCLManager, OpenCL.CL_MEM_READ_WRITE);
RapidHeightMapExtractor heightMapExtractor = new RapidHeightMapExtractor(openCLManager, heightMapBytedecoImage, cameraIntrinsics, 1);

RapidHeightMapExtractor heightMapExtractor = new RapidHeightMapExtractor(openCLManager,
heightMapBytedecoImage,
cameraIntrinsics,
1,
RapidHeightMapManager.getHeightMapParameters());

LogTools.info("Initializing");

RapidHeightMapExtractor.getHeightMapParameters().setInternalGlobalWidthInMeters(4.0);
RapidHeightMapExtractor.getHeightMapParameters().setInternalGlobalCellSizeInMeters(0.02);
RapidHeightMapManager.getHeightMapParameters().setInternalGlobalWidthInMeters(4.0);
RapidHeightMapManager.getHeightMapParameters().setInternalGlobalCellSizeInMeters(0.02);
heightMapExtractor.initialize();
heightMapExtractor.reset();

Expand All @@ -56,7 +62,7 @@ public void testMonteCarloFootstepPlanning()
HeightMapTerrainGeneratorTools.fillWithSteppingStones(heightMap, 0.4f, 0.4f, 0.3f, 0.25f, 3);

heightMapExtractor.getInternalGlobalHeightMapImage().writeOpenCLImage(openCLManager);
heightMapExtractor.populateParameterBuffers(RapidHeightMapExtractor.getHeightMapParameters(), cameraIntrinsics, new Point3D());
heightMapExtractor.populateParameterBuffers(RapidHeightMapManager.getHeightMapParameters(), cameraIntrinsics, new Point3D());
heightMapExtractor.computeContactMap();
heightMapExtractor.readContactMapImage();

Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import imgui.type.ImFloat;
import org.bytedeco.opencv.opencv_core.Mat;
import us.ihmc.communication.ros2.ROS2Helper;
import us.ihmc.perception.gpuHeightMap.RapidHeightMapManager;
import us.ihmc.perception.gpuHeightMap.HeatMapGenerator;
import us.ihmc.perception.gpuHeightMap.RapidHeightMapExtractor;
import us.ihmc.perception.HumanoidPerceptionModule;
import us.ihmc.perception.heightMap.TerrainMapData;
import us.ihmc.rdx.imgui.RDXPanel;
Expand Down Expand Up @@ -219,16 +219,16 @@ public void initializeHeightMapUI(ROS2Helper ros2Helper)
// RDXImagePanel.DO_NOT_FLIP_Y);

depthImagePanel = new RDXBytedecoImagePanel("Depth Image",
RapidHeightMapExtractor.getHeightMapParameters().getCropWindowSize(),
RapidHeightMapExtractor.getHeightMapParameters().getCropWindowSize(),
RapidHeightMapManager.getHeightMapParameters().getCropWindowSize(),
RapidHeightMapManager.getHeightMapParameters().getCropWindowSize(),
RDXImagePanel.DO_NOT_FLIP_Y);
localHeightMapPanel = new RDXBytedecoImagePanel("Local Height Map",
RapidHeightMapExtractor.getHeightMapParameters().getCropWindowSize(),
RapidHeightMapExtractor.getHeightMapParameters().getCropWindowSize(),
RapidHeightMapManager.getHeightMapParameters().getCropWindowSize(),
RapidHeightMapManager.getHeightMapParameters().getCropWindowSize(),
RDXImagePanel.FLIP_Y);
croppedHeightMapPanel = new RDXBytedecoImagePanel("Cropped Height Map",
RapidHeightMapExtractor.getHeightMapParameters().getCropWindowSize(),
RapidHeightMapExtractor.getHeightMapParameters().getCropWindowSize(),
RapidHeightMapManager.getHeightMapParameters().getCropWindowSize(),
RapidHeightMapManager.getHeightMapParameters().getCropWindowSize(),
RDXImagePanel.FLIP_Y);
snapNormalZMapPanel = new RDXBytedecoImagePanel("Normal Z",
humanoidPerception.getRapidHeightMapExtractor().getSnapNormalZImage().getBytedecoOpenCVMat().cols(),
Expand All @@ -251,12 +251,12 @@ public void initializeHeightMapUI(ROS2Helper ros2Helper)
// humanoidPerception.getRapidHeightMapExtractor().getSensorCroppedHeightMapImage().rows(),
// RDXImagePanel.DO_NOT_FLIP_Y);
terrainCostImagePanel = new RDXBytedecoImagePanel("Terrain Cost Image",
RapidHeightMapExtractor.getHeightMapParameters().getCropWindowSize(),
RapidHeightMapExtractor.getHeightMapParameters().getCropWindowSize(),
RapidHeightMapManager.getHeightMapParameters().getCropWindowSize(),
RapidHeightMapManager.getHeightMapParameters().getCropWindowSize(),
RDXImagePanel.FLIP_Y);
contactMapImagePanel = new RDXBytedecoImagePanel("Contact Map Image",
RapidHeightMapExtractor.getHeightMapParameters().getCropWindowSize(),
RapidHeightMapExtractor.getHeightMapParameters().getCropWindowSize(),
RapidHeightMapManager.getHeightMapParameters().getCropWindowSize(),
RapidHeightMapManager.getHeightMapParameters().getCropWindowSize(),
RDXImagePanel.FLIP_Y);

addChild(localHeightMapPanel.getImagePanel());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public class RDXStancePoseSelectionPanel extends RDXPanel implements RenderableP
private final RDXBaseUI baseUI;
private final ImGuiUniqueLabelMap labels = new ImGuiUniqueLabelMap(getClass());
private final ROS2Publisher<PoseListMessage> publisher;
private final ROS2Publisher<PoseListMessage> turningPublisher;

private ModelInstance pickPointSphere;

Expand Down Expand Up @@ -73,6 +74,7 @@ public RDXStancePoseSelectionPanel(RDXBaseUI baseUI, ROS2Node ros2Node, StancePo
stancePoseCalculatorParametersTuner.create(stancePoseCalculator.getStancePoseParameters());

publisher = ros2Node.createPublisher(ContinuousHikingAPI.PLACED_GOAL_FOOTSTEPS);
turningPublisher = ros2Node.createPublisher(ContinuousHikingAPI.ROTATE_GOAL_FOOTSTEPS);

SegmentDependentList<RobotSide, ArrayList<Point2D>> contactPoints = new SideDependentList<>();
contactPoints.set(RobotSide.LEFT, PlannerTools.createFootContactPoints(0.2, 0.1, 0.08));
Expand Down Expand Up @@ -210,6 +212,11 @@ else if (dScroll < 0.0)
latestPickPoint.getOrientation().setYawPitchRoll(latestFootstepYaw + deltaYaw, 0.0, 0.0);
}
}
if (input.isWindowHovered() && input.mouseReleasedWithoutDrag(ImGuiMouseButton.Middle) && calculateStancePose.get() && selectionActive)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Middle click allows for this feature to plan-to-goal rather then add it to the CH goal queue

{
setRotateGoalFootsteps();
selectionActive = false;
}

if (input.isWindowHovered() & input.mouseReleasedWithoutDrag(ImGuiMouseButton.Left) && calculateStancePose.get() && selectionActive)
{
Expand Down Expand Up @@ -254,6 +261,18 @@ public void destroy()
rightSpheres.clear();
}

private void setRotateGoalFootsteps()
{
List<Pose3D> poses = new ArrayList<>();
poses.add(new Pose3D(stancePoses.get(RobotSide.LEFT)));
poses.add(new Pose3D(stancePoses.get(RobotSide.RIGHT)));

PoseListMessage poseListMessage = new PoseListMessage();
MessageTools.packPoseListMessage(poses, poseListMessage);

turningPublisher.publish(poseListMessage);
}

private void setGoalFootsteps()
{
List<Pose3D> poses = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ public class RDXHighLevelDepthSensorSimulator extends RDXPanel

private Thread publishImagesThread;
private volatile boolean publishImagesRunning;
private ROS2Publisher<ImageMessage> depthImagePublisher;

public RDXHighLevelDepthSensorSimulator(String sensorName,
ReferenceFrame sensorFrame,
Expand Down Expand Up @@ -233,6 +234,9 @@ public void setupForROS2ImageMessages(ROS2Node ros2Node, ROS2Topic<ImageMessage>
{
this.ros2Node = ros2Node;
this.ros2Helper = new ROS2Helper(ros2Node);

depthImagePublisher = ros2Node.createPublisher(ros2DepthTopic);

this.ros2DepthTopic = ros2DepthTopic;
this.ros2ColorTopic = ros2ColorTopic;

Expand Down Expand Up @@ -572,7 +576,8 @@ public void publishROS2DepthImageMessage()
sensorPose.setToZero(sensorFrame);
sensorPose.changeFrame(ReferenceFrame.getWorldFrame());
OpenCVTools.compressImagePNG(depthImageMat, compressedDepthPointer);
PerceptionMessageTools.publishCompressedDepthImage(compressedDepthPointer, ros2DepthTopic, depthImageMessage, ros2Helper, sensorPose, now, depthSequenceNumber++,

PerceptionMessageTools.publishCompressedDepthImage(compressedDepthPointer, depthImageMessage, depthImagePublisher, sensorPose, now, depthSequenceNumber++,
depthSensorSimulator.getImageHeight(), depthSensorSimulator.getImageWidth(), 0.001f);

});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import us.ihmc.rdx.shader.RDXShader;
import us.ihmc.rdx.shader.RDXUniform;

import java.nio.FloatBuffer;

/**
* Renders a height map as a point cloud. The height map is stored as a 16-bit grayscale image.
Expand All @@ -29,13 +28,6 @@
* 0 is the metric -3.2768f height, and 65536 is the 3.2768f height.
* The height is scaled up by 10,000 for storage as 16-bit value (short)
*/

/**
* This has been updated to use {@link us.ihmc.rdx.ui.graphics.RDXHeightMapGraphicNew}, please use that going forward, this implementation has bugs with
* interacting with collisions
* from the mouse
*/
@Deprecated
public class RDXHeightMapRenderer implements RenderableProvider
{
private Renderable renderable;
Expand Down Expand Up @@ -142,11 +134,6 @@ public void update(RigidBodyTransform zUpFrameToWorld,
renderable.meshPart.mesh.setVertices(intermediateVertexBuffer, 0, totalCells * FLOATS_PER_CELL);
}

public FloatBuffer getVertexBuffer()
{
return renderable.meshPart.mesh.getVerticesBuffer();
}

@Override
public void getRenderables(Array<Renderable> renderables, Pool<Renderable> pool)
{
Expand Down
Loading
Loading