Skip to content

Commit 787a0c5

Browse files
committed
Include FoundationPose detections in behavior scene.
1 parent 126a546 commit 787a0c5

File tree

10 files changed

+73
-9
lines changed

10 files changed

+73
-9
lines changed

ihmc-high-level-behaviors/src/libgdx/java/us/ihmc/rdx/behaviorTree/scene/RDXBehaviorTreeScene.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
import us.ihmc.euclid.referenceFrame.ReferenceFrame;
2020
import us.ihmc.euclid.transform.RigidBodyTransform;
2121
import us.ihmc.humanoidRobotics.frames.HumanoidReferenceFrames;
22+
import us.ihmc.perception.detections.foundationPose.IsaacROSFoundationPoseInstantDetection;
2223
import us.ihmc.perception.detections.foundationPose.IsaacROSFoundationPoseObject;
24+
import us.ihmc.perception.detections.yolo.YOLOv8InstantDetection;
2325
import us.ihmc.rdx.RDX3DSituatedText;
2426
import us.ihmc.rdx.imgui.ImGuiTools;
2527
import us.ihmc.rdx.imgui.ImGuiUniqueLabelMap;
@@ -149,10 +151,16 @@ private void renderImGuiWidgets()
149151

150152
private static void renderPersistentDetection(PersistentDetectionStatusMessage message)
151153
{
152-
String text = "%s %.2f Hz Size: %d ID.%s".formatted(message.getObjectClassAsString(),
153-
message.getDecayingFrequency(),
154-
message.getHistorySize(),
155-
message.getIdAsString());
154+
String type = "(?)";
155+
if (message.getDetectionTypeAsString().equals(IsaacROSFoundationPoseInstantDetection.class.getSimpleName()))
156+
type = "(FoundationPose)";
157+
if (message.getDetectionTypeAsString().equals(YOLOv8InstantDetection.class.getSimpleName()))
158+
type = "(YOLOv8)";
159+
String text = "%s %s %.2f Hz Size: %d ID.%s".formatted(type,
160+
message.getObjectClassAsString(),
161+
message.getDecayingFrequency(),
162+
message.getHistorySize(),
163+
message.getIdAsString());
156164
if (message.getIsStable())
157165
ImGui.text(text);
158166
else

ihmc-high-level-behaviors/src/main/java/us/ihmc/behaviors/behaviorTree/scene/BehaviorTreeSceneExecutor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public BehaviorTreeSceneExecutor(CRDTInfo crdtInfo,
5151
{
5252
IsaacROSFoundationPoseCommunicator mustardCommunicator = foundationPose.get(IsaacROSFoundationPoseObject.MUSTARD);
5353
mustardCommunicator.enable(true);
54-
// mustardCommunicator.addResultCallback(instantDetectionQueue::add);
54+
mustardCommunicator.addResultCallback(detection -> instantDetectionQueue.add(List.of(detection)));
5555
}
5656
}
5757

ihmc-high-level-behaviors/src/main/java/us/ihmc/behaviors/behaviorTree/scene/PersistentDetectionMessageTool.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public void toMessage(ROS2SyncedRobotModel syncedRobot, Instant now, PersistentD
1919
{
2020
String last4Digits = String.format("%04d", Math.abs(persistentDetection.getID().getLeastSignificantBits() % 10000));
2121
message.setId(last4Digits);
22+
message.setDetectionType(persistentDetection.getMostRecentDetection().getClass().getSimpleName());
2223
message.setObjectClass(persistentDetection.getDetectedObjectClass());
2324
message.setDecayingFrequency(persistentDetection.getDetectionFrequencyDecaying(now));
2425
message.setHistorySize(persistentDetection.getHistorySize());

ihmc-interfaces/src/main/generated-idl/behavior_msgs/msg/PersistentDetectionStatusMessage_.idl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ module behavior_msgs
1919
* Last 4 digits of UUID as a string
2020
*/
2121
string id;
22+
/**
23+
* Instant detection simple class name (e.g. YOLO, FoundationPose)
24+
*/
25+
string detection_type;
2226
/**
2327
* Object class name (e.g., "bottle")
2428
*/

ihmc-interfaces/src/main/generated-java/behavior_msgs/msg/dds/BehaviorTreeSceneObjectStateMessagePubSubType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class BehaviorTreeSceneObjectStateMessagePubSubType implements us.ihmc.pu
1515
@Override
1616
public final java.lang.String getDefinitionChecksum()
1717
{
18-
return "59f3ee4575c5da2b173882d0133c914881e2de3cd86237a2f6517024c9cf86ee";
18+
return "e940223f873a88665fe841f33f1757063f4481eb711220e7c17b1308e0473324";
1919
}
2020

2121
@Override

ihmc-interfaces/src/main/generated-java/behavior_msgs/msg/dds/BehaviorTreeSceneStateMessagePubSubType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class BehaviorTreeSceneStateMessagePubSubType implements us.ihmc.pubsub.T
1515
@Override
1616
public final java.lang.String getDefinitionChecksum()
1717
{
18-
return "122728bd60171e37f199997f54bd44adc02031acdd2ef58413fd3589f74fc285";
18+
return "1999b399810645f1d7a12a0760852f6eb6ebda0543c9cdce644001de4de3658d";
1919
}
2020

2121
@Override

ihmc-interfaces/src/main/generated-java/behavior_msgs/msg/dds/BehaviorTreeStateMessagePubSubType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class BehaviorTreeStateMessagePubSubType implements us.ihmc.pubsub.TopicD
1515
@Override
1616
public final java.lang.String getDefinitionChecksum()
1717
{
18-
return "838a7377a92ce1ec67ef85e387ffd1f7aaeecbaaa278e7f05cf5a57c918c085e";
18+
return "50bb84905811aae33d6d9e25e6fb7f2a14b1035b419e50086bc01bf3a11e641a";
1919
}
2020

2121
@Override

ihmc-interfaces/src/main/generated-java/behavior_msgs/msg/dds/PersistentDetectionStatusMessage.java

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ public class PersistentDetectionStatusMessage extends Packet<PersistentDetection
1515
* Last 4 digits of UUID as a string
1616
*/
1717
public java.lang.StringBuilder id_;
18+
/**
19+
* Instant detection simple class name (e.g. YOLO, FoundationPose)
20+
*/
21+
public java.lang.StringBuilder detection_type_;
1822
/**
1923
* Object class name (e.g., "bottle")
2024
*/
@@ -43,6 +47,7 @@ public class PersistentDetectionStatusMessage extends Packet<PersistentDetection
4347
public PersistentDetectionStatusMessage()
4448
{
4549
id_ = new java.lang.StringBuilder(255);
50+
detection_type_ = new java.lang.StringBuilder(255);
4651
object_class_ = new java.lang.StringBuilder(255);
4752
transform_to_world_ = new controller_msgs.msg.dds.RigidBodyTransformMessage();
4853
transform_to_camera_ = new controller_msgs.msg.dds.RigidBodyTransformMessage();
@@ -59,6 +64,9 @@ public void set(PersistentDetectionStatusMessage other)
5964
id_.setLength(0);
6065
id_.append(other.id_);
6166

67+
detection_type_.setLength(0);
68+
detection_type_.append(other.detection_type_);
69+
6270
object_class_.setLength(0);
6371
object_class_.append(other.object_class_);
6472

@@ -96,6 +104,30 @@ public java.lang.StringBuilder getId()
96104
return id_;
97105
}
98106

107+
/**
108+
* Instant detection simple class name (e.g. YOLO, FoundationPose)
109+
*/
110+
public void setDetectionType(java.lang.String detection_type)
111+
{
112+
detection_type_.setLength(0);
113+
detection_type_.append(detection_type);
114+
}
115+
116+
/**
117+
* Instant detection simple class name (e.g. YOLO, FoundationPose)
118+
*/
119+
public java.lang.String getDetectionTypeAsString()
120+
{
121+
return getDetectionType().toString();
122+
}
123+
/**
124+
* Instant detection simple class name (e.g. YOLO, FoundationPose)
125+
*/
126+
public java.lang.StringBuilder getDetectionType()
127+
{
128+
return detection_type_;
129+
}
130+
99131
/**
100132
* Object class name (e.g., "bottle")
101133
*/
@@ -203,6 +235,8 @@ public boolean epsilonEquals(PersistentDetectionStatusMessage other, double epsi
203235

204236
if (!us.ihmc.idl.IDLTools.epsilonEqualsStringBuilder(this.id_, other.id_, epsilon)) return false;
205237

238+
if (!us.ihmc.idl.IDLTools.epsilonEqualsStringBuilder(this.detection_type_, other.detection_type_, epsilon)) return false;
239+
206240
if (!us.ihmc.idl.IDLTools.epsilonEqualsStringBuilder(this.object_class_, other.object_class_, epsilon)) return false;
207241

208242
if (!us.ihmc.idl.IDLTools.epsilonEqualsPrimitive(this.decaying_frequency_, other.decaying_frequency_, epsilon)) return false;
@@ -228,6 +262,8 @@ public boolean equals(Object other)
228262

229263
if (!us.ihmc.idl.IDLTools.equals(this.id_, otherMyClass.id_)) return false;
230264

265+
if (!us.ihmc.idl.IDLTools.equals(this.detection_type_, otherMyClass.detection_type_)) return false;
266+
231267
if (!us.ihmc.idl.IDLTools.equals(this.object_class_, otherMyClass.object_class_)) return false;
232268

233269
if(this.decaying_frequency_ != otherMyClass.decaying_frequency_) return false;
@@ -250,6 +286,8 @@ public java.lang.String toString()
250286
builder.append("PersistentDetectionStatusMessage {");
251287
builder.append("id=");
252288
builder.append(this.id_); builder.append(", ");
289+
builder.append("detection_type=");
290+
builder.append(this.detection_type_); builder.append(", ");
253291
builder.append("object_class=");
254292
builder.append(this.object_class_); builder.append(", ");
255293
builder.append("decaying_frequency=");

ihmc-interfaces/src/main/generated-java/behavior_msgs/msg/dds/PersistentDetectionStatusMessagePubSubType.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class PersistentDetectionStatusMessagePubSubType implements us.ihmc.pubsu
1515
@Override
1616
public final java.lang.String getDefinitionChecksum()
1717
{
18-
return "8056427588c7403fb501d01e29914d9e9697c32902d4f0d896bcc3c3ac936615";
18+
return "0f320bdc9036f03ba8aaa3d0dbd41d80d15abfc1a1e1ab7d54d2cefbf44908cb";
1919
}
2020

2121
@Override
@@ -52,6 +52,7 @@ public static int getMaxCdrSerializedSize(int current_alignment)
5252
{
5353
int initial_alignment = current_alignment;
5454

55+
current_alignment += 4 + us.ihmc.idl.CDR.alignment(current_alignment, 4) + 255 + 1;
5556
current_alignment += 4 + us.ihmc.idl.CDR.alignment(current_alignment, 4) + 255 + 1;
5657
current_alignment += 4 + us.ihmc.idl.CDR.alignment(current_alignment, 4) + 255 + 1;
5758
current_alignment += 8 + us.ihmc.idl.CDR.alignment(current_alignment, 8);
@@ -79,6 +80,8 @@ public final static int getCdrSerializedSize(behavior_msgs.msg.dds.PersistentDet
7980

8081
current_alignment += 4 + us.ihmc.idl.CDR.alignment(current_alignment, 4) + data.getId().length() + 1;
8182

83+
current_alignment += 4 + us.ihmc.idl.CDR.alignment(current_alignment, 4) + data.getDetectionType().length() + 1;
84+
8285
current_alignment += 4 + us.ihmc.idl.CDR.alignment(current_alignment, 4) + data.getObjectClass().length() + 1;
8386

8487
current_alignment += 8 + us.ihmc.idl.CDR.alignment(current_alignment, 8);
@@ -104,6 +107,10 @@ public static void write(behavior_msgs.msg.dds.PersistentDetectionStatusMessage
104107
cdr.write_type_d(data.getId());else
105108
throw new RuntimeException("id field exceeds the maximum length: %d > %d".formatted(data.getId().length(), 255));
106109

110+
if(data.getDetectionType().length() <= 255)
111+
cdr.write_type_d(data.getDetectionType());else
112+
throw new RuntimeException("detection_type field exceeds the maximum length: %d > %d".formatted(data.getDetectionType().length(), 255));
113+
107114
if(data.getObjectClass().length() <= 255)
108115
cdr.write_type_d(data.getObjectClass());else
109116
throw new RuntimeException("object_class field exceeds the maximum length: %d > %d".formatted(data.getObjectClass().length(), 255));
@@ -121,6 +128,7 @@ public static void write(behavior_msgs.msg.dds.PersistentDetectionStatusMessage
121128
public static void read(behavior_msgs.msg.dds.PersistentDetectionStatusMessage data, us.ihmc.idl.CDR cdr)
122129
{
123130
cdr.read_type_d(data.getId());
131+
cdr.read_type_d(data.getDetectionType());
124132
cdr.read_type_d(data.getObjectClass());
125133
data.setDecayingFrequency(cdr.read_type_6());
126134

@@ -137,6 +145,7 @@ public static void read(behavior_msgs.msg.dds.PersistentDetectionStatusMessage d
137145
public final void serialize(behavior_msgs.msg.dds.PersistentDetectionStatusMessage data, us.ihmc.idl.InterchangeSerializer ser)
138146
{
139147
ser.write_type_d("id", data.getId());
148+
ser.write_type_d("detection_type", data.getDetectionType());
140149
ser.write_type_d("object_class", data.getObjectClass());
141150
ser.write_type_6("decaying_frequency", data.getDecayingFrequency());
142151
ser.write_type_2("history_size", data.getHistorySize());
@@ -151,6 +160,7 @@ public final void serialize(behavior_msgs.msg.dds.PersistentDetectionStatusMessa
151160
public final void deserialize(us.ihmc.idl.InterchangeSerializer ser, behavior_msgs.msg.dds.PersistentDetectionStatusMessage data)
152161
{
153162
ser.read_type_d("id", data.getId());
163+
ser.read_type_d("detection_type", data.getDetectionType());
154164
ser.read_type_d("object_class", data.getObjectClass());
155165
data.setDecayingFrequency(ser.read_type_6("decaying_frequency"));
156166
data.setHistorySize(ser.read_type_2("history_size"));

ihmc-interfaces/src/main/messages/ihmc_interfaces/behavior_msgs/msg/PersistentDetectionStatusMessage.msg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
# Last 4 digits of UUID as a string
44
string id
55

6+
# Instant detection simple class name (e.g. YOLO, FoundationPose)
7+
string detection_type
8+
69
# Object class name (e.g., "bottle")
710
string object_class
811

0 commit comments

Comments
 (0)