File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed
ihmc-high-level-behaviors/src/main/java/us/ihmc/perception
ihmc-perception/src/main/java/us/ihmc/sensors Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change 13
13
import us .ihmc .ros2 .ROS2Node ;
14
14
import us .ihmc .perception .heightMap .HeightMapData ;
15
15
import us .ihmc .perception .heightMap .HeightMapParameters ;
16
+ import us .ihmc .sensors .ImageSensor ;
16
17
import us .ihmc .sensors .realsense .RealSenseConfiguration ;
17
18
import us .ihmc .sensors .realsense .RealSenseImageSensor ;
18
19
@@ -85,12 +86,12 @@ public StandAloneRealsenseProcess(ROS2Node ros2Node,
85
86
d455PublishThread .addTopic (PerceptionAPI .D455_DEPTH_IMAGE , RealSenseImageSensor .DEPTH_IMAGE_KEY );
86
87
loopOnDemand (d455PublishThread , realsensePublishDemandNode );
87
88
88
- BlockingQueue <RawImage > rawImageCollection = new LinkedBlockingQueue <>(10 );
89
- d455Sensor .registerImageCollector ( rawImageCollection , RealSenseImageSensor .DEPTH_IMAGE_KEY );
89
+ BlockingQueue <RawImage > rawImageQueue = new LinkedBlockingQueue <>(ImageSensor . DEFAULT_IMAGE_QUEUE_CAPACITY );
90
+ d455Sensor .registerImageQueue ( rawImageQueue , RealSenseImageSensor .DEPTH_IMAGE_KEY );
90
91
rapidHeightMapThread = new RapidHeightMapThread (ros2Helper .getROS2Node (),
91
92
syncedRobot ,
92
93
robotCollisionModel ,
93
- rawImageCollection ,
94
+ rawImageQueue ,
94
95
controllerFootstepQueueMonitor ,
95
96
heightMapParameters ,
96
97
depthImageFilteringParameters );
Original file line number Diff line number Diff line change 14
14
15
15
public abstract class ImageSensor implements AutoCloseable
16
16
{
17
+ public static final int DEFAULT_IMAGE_QUEUE_CAPACITY = 8 ;
17
18
private static final double SECONDS_BETWEEN_RETRIES = 1.0 ; // Wait 1 second between retries for starting sensors
18
19
19
20
private final String sensorName ;
@@ -108,17 +109,18 @@ public ReferenceFrame getSensorFrame()
108
109
* Register an image queue for images of a particular key.
109
110
* <p>
110
111
* Every image grabbed by the sensor will be added to the passed in queue.
111
- * The code accessing the collection must call {@link RawImage#release()} on each image,
112
+ * The code taking from the queue must call {@link RawImage#release()} on each image,
112
113
* once it's done using the image.
113
114
* <p>
114
115
* If the queue becomes full (i.e. when {@code BlockingQueue#remainingCapacity() == 0})
115
116
* the oldest image will be removed so the new image can be added.
116
117
* Ensure a reasonable queue capacity is set to prevent memory leaks.
118
+ * {@link #DEFAULT_IMAGE_QUEUE_CAPACITY} can be used as a good default value.
117
119
*
118
120
* @param imageQueue Blocking queue into which the images will be added.
119
121
* @param imageKey The key for images to be collected.
120
122
*/
121
- public void registerImageCollector (BlockingQueue <RawImage > imageQueue , int imageKey )
123
+ public void registerImageQueue (BlockingQueue <RawImage > imageQueue , int imageKey )
122
124
{
123
125
if (imageQueues .containsKey (imageKey ))
124
126
imageQueues .get (imageKey ).add (imageQueue );
You can’t perform that action at this time.
0 commit comments