-
Notifications
You must be signed in to change notification settings - Fork 95
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
Conversation
…istory of height maps
…verage and variance
…e feature on and off was added as well.
…hed everything upstream that was affected
...-avatar-interfaces/src/main/java/us/ihmc/avatar/drcRobot/CommunicationsSyncedRobotModel.java
Outdated
Show resolved
Hide resolved
@@ -18,6 +19,8 @@ public class ContinuousHikingAPI | |||
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<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"); |
There was a problem hiding this comment.
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
@@ -210,6 +213,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) |
There was a problem hiding this comment.
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
...haviors/src/libgdx/java/us/ihmc/rdx/simulation/sensors/RDXHighLevelDepthSensorSimulator.java
Show resolved
Hide resolved
@@ -56,6 +56,7 @@ public void doAction(double timeInState) | |||
message.setClearRemainingFootstepQueue(true); | |||
continuousPlanner.setLatestFootstepPlan(null); | |||
pauseWalkingPublisher.publish(message); | |||
debugger.resetVisualizationForUIPublisher(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clear visuals when standing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new messages affect this state, this way I can skip the entire CH process when desired.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filtered height map class
@@ -34,10 +34,12 @@ | |||
*/ | |||
public class RapidHeightMapManager | |||
{ | |||
static final HeightMapParameters heightMapParameters = new HeightMapParameters("GPU"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now we have one parameter set for the height map, not one each for the extractor type
setContactMap(other.contactMap); | ||
setTerrainCostMap(other.terrainCostMap); | ||
|
||
setSteppableRegionAssignmentMat(other.steppableRegionAssignmentMat); | ||
setSteppableRegionRingMat(other.steppableRegionRingMat); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was missing some stuff in the copy constructor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty simple but could prove useful in the future
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really feel like this PR should be split into four or so PRs... Maybe like this?
ROS2Helper
->ROS2Node
+ROS2Publisher
changes (this one might be controversial)- 3D CUDA kernel example + height map filter
- Cleanup + parameter changes
- Changes related to continuous hiking + UI
Otherwise I feel like getting this one merged will be difficult
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll review this PR a bit slowly, one piece at a time (sorry this might take a while).
I added comments about the height map filter. Logic looks good, just some cleanup and memory freeing stuff I noticed.
...eption/src/main/resources/us/ihmc/perception/gpuHeightMap/FilteredRapidHeightMapExtractor.cu
Outdated
Show resolved
Hide resolved
#define LAYERS 0 | ||
|
||
__global__ | ||
void filterRapidHeightMap(unsigned short * matrixPointer, size_t pitchA, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you give a better name to matrixPointer
? What sort of matrix is it? Seems like it holds some sort of history to me.
// Create a 2x2 with 5 layers | ||
int rows = 2; | ||
int cols = 2; | ||
int layers = 4; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment says 5 layers but layers = 4
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adresseed!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still looks the same to me
...erception/src/main/java/us/ihmc/perception/gpuHeightMap/FilteredRapidHeightMapExtractor.java
Outdated
Show resolved
Hide resolved
...erception/src/main/java/us/ihmc/perception/gpuHeightMap/FilteredRapidHeightMapExtractor.java
Outdated
Show resolved
Hide resolved
...erception/src/main/java/us/ihmc/perception/gpuHeightMap/FilteredRapidHeightMapExtractor.java
Outdated
Show resolved
Hide resolved
@@ -286,6 +287,9 @@ public void update(RigidBodyTransform sensorToWorldTransform, RigidBodyTransform | |||
error = cudaStreamSynchronize(stream); | |||
CUDATools.checkCUDAError(error); | |||
|
|||
if (heightMapParameters.getEnableAlphaFilter()) | |||
globalHeightMapImage = filteredRapidHeightMapExtractor.update(globalHeightMapImage); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should close the globalHeightMapImage
between the call to update
and the assignment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to free the CUDA memory of the globalHeightMapImage
before you reassign it with a new GpuMat
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, it's actually gonna be a bit more complicated since you don't always return a new GpuMat. Sometimes you return the passed in one, then you don't want to free anything... Hmmm... Maybe just always return a new GpuMat? Or do it OpenCV style where you pass in the "destination" GpuMat as a parameter to the update
method. That also leaves memory handling to whatever is calling update
.
...eption/src/main/resources/us/ihmc/perception/gpuHeightMap/FilteredRapidHeightMapExtractor.cu
Outdated
Show resolved
Hide resolved
...eption/src/main/resources/us/ihmc/perception/gpuHeightMap/FilteredRapidHeightMapExtractor.cu
Outdated
Show resolved
Hide resolved
...eption/src/main/resources/us/ihmc/perception/gpuHeightMap/FilteredRapidHeightMapExtractor.cu
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking pretty good with the height map filter. Just a few minor things I noticed.
...erception/src/main/java/us/ihmc/perception/gpuHeightMap/FilteredRapidHeightMapExtractor.java
Outdated
Show resolved
Hide resolved
...erception/src/main/java/us/ihmc/perception/gpuHeightMap/FilteredRapidHeightMapExtractor.java
Outdated
Show resolved
Hide resolved
...erception/src/main/java/us/ihmc/perception/gpuHeightMap/FilteredRapidHeightMapExtractor.java
Outdated
Show resolved
Hide resolved
...erception/src/main/java/us/ihmc/perception/gpuHeightMap/FilteredRapidHeightMapExtractor.java
Outdated
Show resolved
Hide resolved
...tstep-planning/src/main/java/us/ihmc/footstepPlanning/communication/ContinuousHikingAPI.java
Outdated
Show resolved
Hide resolved
ihmc-high-level-behaviors/src/libgdx/java/us/ihmc/rdx/perception/RDXContinuousHikingPanel.java
Outdated
Show resolved
Hide resolved
...high-level-behaviors/src/libgdx/java/us/ihmc/rdx/perception/RDXStancePoseSelectionPanel.java
Outdated
Show resolved
Hide resolved
{ | ||
MovingReferenceFrame midFeetZUpFrame = syncedRobotModel.getReferenceFrames().getMidFeetZUpFrame(); | ||
FramePose3D midFeetZUpPose = new FramePose3D(midFeetZUpFrame, midFeetZUpFrame.getTransformToWorldFrame()); | ||
SideDependentList<FramePose3D> goalPoses = new SideDependentList<>(new FramePose3D(syncedRobotModel.getReferenceFrames().getMidFeetZUpFrame()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like you're not getting anything out of this side dependent list. Why not just have two variables leftGoalPose
and rightGoalPose
?
FramePose3DReadOnly soleFramePose; | ||
if (controllerQueueMonitor.getNumberOfIncompleteFootsteps() > 0) | ||
{ | ||
LogTools.info("Yes this queue is not empty"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want to keep this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Formatter, rip
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't mean the formatting, I mean the logging
(although the formatting is awful too)
ihmc-perception/src/main/java/us/ihmc/perception/gpuHeightMap/RapidHeightMapManager.java
Outdated
Show resolved
Hide resolved
ihmc-perception/src/main/java/us/ihmc/perception/gpuHeightMap/RapidHeightMapManager.java
Outdated
Show resolved
Hide resolved
ros2Node.createSubscription(HumanoidControllerAPI.getTopic(HighLevelStateChangeStatusMessage.class, robotName), message -> | ||
{ | ||
if (message.takeNextData().getEndHighLevelControllerName() == HighLevelStateChangeStatusMessage.WALKING) | ||
{ | ||
resetHeightMapRequested.set(); | ||
} | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ros2Node.createSubscription(HumanoidControllerAPI.getTopic(HighLevelStateChangeStatusMessage.class, robotName), message -> | |
{ | |
if (message.takeNextData().getEndHighLevelControllerName() == HighLevelStateChangeStatusMessage.WALKING) | |
{ | |
resetHeightMapRequested.set(); | |
} | |
}); | |
ros2Node.createSubscription2(HumanoidControllerAPI.getTopic(HighLevelStateChangeStatusMessage.class, robotName), message -> | |
{ | |
if (message.getEndHighLevelControllerName() == HighLevelStateChangeStatusMessage.WALKING) | |
{ | |
resetHeightMapRequested.set(); | |
} | |
}); |
This is a Bhav level PR lol, a bunch of random changes that are grouped together. Most of the file changes come from refactoring things to different places. Here is a list of the changes:
-------------------------------- Package Change ------------------------------
RapidHeightMapManager
toihmc-perception
moduleControllerQueueFootstepMonitor
toihmc-humanoid-robots
module-------------------------------- Refactor Parameters ------------------------------
RapidHeightMapExtractor.getHeightMapParameters()
to get called in theRapidHeightMapManager.getHeightMapParameters()
which allows for only one set of parameters to be created.ROS2Helper
toROS2Node
for the height map pipeline.-------------------------------- Height Map Kernels -----------------------------------
FilteredRapidHeightMapExtractor
class that has a kernel that performs a weighted moving average on the height map as a filter. In this implementation its post-processing the height map. What should really be done is pre-processing the height map. (Change for the future if its a problem)FilteredRapidHeightMapExtractor
CUDAExample3DKernel
to show how to pass a 3D array into the kernels-------------------------------- RDX UI Changes -----------------------------
-------------------------------- Continuous Hiking Changes -----------------------------
ContinuousHikingLogger
useless by removing the usage fromControllerQueueFootstepMonitor
so should come back to that but its not pressing.