-
Notifications
You must be signed in to change notification settings - Fork 96
Cleaned up the DepthImageBodyCollisionFilter in java and in c++, moved it above the RapidHeightMapManager. Deleted the duplicate thread for the height map #798
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
Conversation
…eightMapData and the TerrainMapData individually
# Conflicts: # ihmc-footstep-planning/src/main/java/us/ihmc/footstepPlanning/FootstepPlannerRequest.java
…a higher level closer to where its used
# Conflicts: # ihmc-perception/src/main/java/us/ihmc/perception/gpuHeightMap/RapidHeightMapExtractorCUDA.java # ihmc-perception/src/main/java/us/ihmc/perception/gpuHeightMap/RapidHeightMapManager.java
# Conflicts: # ihmc-high-level-behaviors/src/main/java/us/ihmc/behaviors/activeMapping/ContinuousHikingProcess.java
…d it above the RapidHeightMapManager. Deleted the duplicate thread for the height map
# Conflicts: # ihmc-high-level-behaviors/src/main/java/us/ihmc/perception/RapidHeightMapAutonomyUpdateThread.java # ihmc-high-level-behaviors/src/main/java/us/ihmc/perception/RapidHeightMapThread.java # ihmc-perception/src/main/java/us/ihmc/perception/gpuHeightMap/RapidHeightMapManager.java
CameraIntrinsics depthIntrinsicsCopy = depthImageCopy.getIntrinsicsCopy(); | ||
|
||
// Process body collisions | ||
GpuMat depthImageWithoutBodyCollisions = new GpuMat(latestDepthImage.size(), latestDepthImage.type()); |
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.
Pulled the body collision filter outside of the height map manager
@@ -16,8 +22,15 @@ | |||
import static org.bytedeco.cuda.global.cudart.cudaFree; | |||
import static org.bytedeco.cuda.global.cudart.cudaStreamSynchronize; | |||
|
|||
public class CUDABodyCollisionFilter | |||
/** | |||
* This class removes the points of a depth image that are on parts of the body. |
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.
Nice
|
||
// Note: We get the expected number of collidables and allocate that memory amount on the GPU | ||
// By allocating once we don't have to free the memory in each call, just at the end | ||
numberOfCollidables = countSupportedCollidables(robotCollidables); | ||
numberOfCollidables = robotCollidables.size(); |
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.
We don't need to go through this method
@@ -391,7 +391,8 @@ public void destroy() | |||
planOffsetKernel.close(); | |||
|
|||
emptyGlobalHeightMapImage.close(); | |||
planOffsetKernelGridDim.close(); | |||
if (planOffsetKernelGridDim != null) |
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.
That was a problem when closing, it would throw an exception, not relavent to this PR
float* collidableGeometryPointer, | ||
int numCollidables, | ||
int numberOfAttributes) | ||
{ | ||
int x = Utils::getThreadCoordX(); | ||
int y = Utils::getThreadCoordY(); | ||
int x_index = blockIdx.x * blockDim.x + threadIdx.x; |
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.
Less code
|
||
public class RapidHeightMapThread | ||
public class RapidHeightMapThread extends RepeatingTaskThread |
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.
😍
int x = Utils::getThreadCoordX(); | ||
int y = Utils::getThreadCoordY(); | ||
int x_index = blockIdx.x * blockDim.x + threadIdx.x; | ||
int y_index = blockIdx.y * blockDim.y + threadIdx.y; |
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.
Shouldn't it be xIndex
and yIndex
? We don't really use snake case in our code
*row(col(collisionMask, x), collisionMaskPitch, y) = depthValue; | ||
unsigned short *matrixRow = (unsigned short *)((char *)collisionMaskMap + y_index * pitchCollisionMaskMap) + x_index; | ||
*matrixRow = depthValue; |
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.
Hmmm idk, using the row
col
functions seems much easier to read
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.
Noooooo I wrote a comment in IntelliJ and it didn't get added to the review 😭
RawImage depthImage = imageSensor.getImage(depthImageKey).get(); | ||
|
||
// Get everything we need from the image | ||
RawImage depthImageCopy = depthImage.get(); |
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 depthImageCopy
isn't actually a copy. It's the same reference to the depth image object, so the name is somewhat misleading.
Also, you shouldn't call get()
when you just got an image from the ImageSensor
. I know it's a bit confusing. Sorry 😅
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.
Talked over slack
No description provided.