Add contact labels showing which geom pairs are in contact.
PiperOrigin-RevId: 510422404 Change-Id: Ia73570098752e7c7175e4b5a5f2a0f8b08a6c006
This commit is contained in:
committed by
Copybara-Service
parent
a6730aa740
commit
2607e67f8d
@@ -20,6 +20,15 @@ Python bindings
|
|||||||
sizes that change between time steps depending on the number of active constraints, breaking strict correspondence
|
sizes that change between time steps depending on the number of active constraints, breaking strict correspondence
|
||||||
between joints and `efc_` rows.
|
between joints and `efc_` rows.
|
||||||
|
|
||||||
|
.. image:: images/changelog/contactlabel.png
|
||||||
|
:align: right
|
||||||
|
:width: 400px
|
||||||
|
|
||||||
|
Simulate
|
||||||
|
^^^^^^^^
|
||||||
|
|
||||||
|
- Added optional labels to contact visualization, indicating which two geoms are contacting (names if defined, ids
|
||||||
|
otherwise). This can be useful in cluttered scenes.
|
||||||
|
|
||||||
Version 2.3.2 (February 7, 2023)
|
Version 2.3.2 (February 7, 2023)
|
||||||
--------------------------------
|
--------------------------------
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 509 KiB |
@@ -1565,6 +1565,7 @@ typedef enum mjtLabel_ { // object labeling
|
|||||||
mjLABEL_SKIN, // skin labels
|
mjLABEL_SKIN, // skin labels
|
||||||
mjLABEL_SELECTION, // selected object
|
mjLABEL_SELECTION, // selected object
|
||||||
mjLABEL_SELPNT, // coordinates of selection point
|
mjLABEL_SELPNT, // coordinates of selection point
|
||||||
|
mjLABEL_CONTACTPOINT, // contact information
|
||||||
mjLABEL_CONTACTFORCE, // magnitude of contact force
|
mjLABEL_CONTACTFORCE, // magnitude of contact force
|
||||||
|
|
||||||
mjNLABEL // number of label types
|
mjNLABEL // number of label types
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ typedef enum mjtLabel_ { // object labeling
|
|||||||
mjLABEL_SKIN, // skin labels
|
mjLABEL_SKIN, // skin labels
|
||||||
mjLABEL_SELECTION, // selected object
|
mjLABEL_SELECTION, // selected object
|
||||||
mjLABEL_SELPNT, // coordinates of selection point
|
mjLABEL_SELPNT, // coordinates of selection point
|
||||||
|
mjLABEL_CONTACTPOINT, // contact information
|
||||||
mjLABEL_CONTACTFORCE, // magnitude of contact force
|
mjLABEL_CONTACTFORCE, // magnitude of contact force
|
||||||
|
|
||||||
mjNLABEL // number of label types
|
mjNLABEL // number of label types
|
||||||
|
|||||||
+3
-2
@@ -471,8 +471,9 @@ ENUMS: Mapping[str, EnumDecl] = dict([
|
|||||||
('mjLABEL_SKIN', 10),
|
('mjLABEL_SKIN', 10),
|
||||||
('mjLABEL_SELECTION', 11),
|
('mjLABEL_SELECTION', 11),
|
||||||
('mjLABEL_SELPNT', 12),
|
('mjLABEL_SELPNT', 12),
|
||||||
('mjLABEL_CONTACTFORCE', 13),
|
('mjLABEL_CONTACTPOINT', 13),
|
||||||
('mjNLABEL', 14),
|
('mjLABEL_CONTACTFORCE', 14),
|
||||||
|
('mjNLABEL', 15),
|
||||||
]),
|
]),
|
||||||
)),
|
)),
|
||||||
('mjtFrame',
|
('mjtFrame',
|
||||||
|
|||||||
@@ -74,7 +74,7 @@
|
|||||||
|
|
||||||
<worldbody>
|
<worldbody>
|
||||||
<light directional="true" diffuse=".8 .8 .8" pos="0 0 10" dir="0 0 -10"/>
|
<light directional="true" diffuse=".8 .8 .8" pos="0 0 10" dir="0 0 -10"/>
|
||||||
<geom pos="0 0 0" type="plane" size="3 3 .5" material="MatPlane"/>
|
<geom name="floor" type="plane" size="3 3 .5" material="MatPlane"/>
|
||||||
<geom class="border" fromto="-3 3 0 3 3 0" />
|
<geom class="border" fromto="-3 3 0 3 3 0" />
|
||||||
<geom class="border" fromto="-3 -3 0 3 -3 0" />
|
<geom class="border" fromto="-3 -3 0 3 -3 0" />
|
||||||
<geom class="border" fromto="3 3 0 3 -3 0" />
|
<geom class="border" fromto="3 3 0 3 -3 0" />
|
||||||
|
|||||||
@@ -634,7 +634,7 @@ void makerendering(mj::Simulate* sim, int oldstate) {
|
|||||||
2,
|
2,
|
||||||
&(sim->vopt.label),
|
&(sim->vopt.label),
|
||||||
"None\nBody\nJoint\nGeom\nSite\nCamera\nLight\nTendon\n"
|
"None\nBody\nJoint\nGeom\nSite\nCamera\nLight\nTendon\n"
|
||||||
"Actuator\nConstraint\nSkin\nSelection\nSel Pnt\nForce"
|
"Actuator\nConstraint\nSkin\nSelection\nSel Pnt\nContact\nForce"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
mjITEM_SELECT,
|
mjITEM_SELECT,
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ const char* mjLABELSTRING[mjNLABEL] = {
|
|||||||
"Skin",
|
"Skin",
|
||||||
"Selection",
|
"Selection",
|
||||||
"SelPoint",
|
"SelPoint",
|
||||||
|
"Contact",
|
||||||
"ContactForce"
|
"ContactForce"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -129,6 +129,17 @@ static void addContactGeom(const mjModel* m, mjData* d, const mjtByte* flags,
|
|||||||
f2f(thisgeom->rgba, m->vis.rgba.contactgap, 4);
|
f2f(thisgeom->rgba, m->vis.rgba.contactgap, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// label contacting geom names or ids
|
||||||
|
if (vopt->label==mjLABEL_CONTACTPOINT) {
|
||||||
|
const char* name1 = mj_id2name(m, mjOBJ_GEOM, con->geom1);
|
||||||
|
char id1[10];
|
||||||
|
mjSNPRINTF(id1, "%d", con->geom1);
|
||||||
|
const char* name2 = mj_id2name(m, mjOBJ_GEOM, con->geom2);
|
||||||
|
char id2[10];
|
||||||
|
mjSNPRINTF(id2, "%d", con->geom2);
|
||||||
|
mjSNPRINTF(thisgeom->label, "%s | %s", name1 ? name1 : id1 , name2 ? name2 : id2);
|
||||||
|
}
|
||||||
|
|
||||||
FINISH
|
FINISH
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -445,8 +445,9 @@ public enum mjtLabel : int{
|
|||||||
mjLABEL_SKIN = 10,
|
mjLABEL_SKIN = 10,
|
||||||
mjLABEL_SELECTION = 11,
|
mjLABEL_SELECTION = 11,
|
||||||
mjLABEL_SELPNT = 12,
|
mjLABEL_SELPNT = 12,
|
||||||
mjLABEL_CONTACTFORCE = 13,
|
mjLABEL_CONTACTPOINT = 13,
|
||||||
mjNLABEL = 14,
|
mjLABEL_CONTACTFORCE = 14,
|
||||||
|
mjNLABEL = 15,
|
||||||
}
|
}
|
||||||
public enum mjtFrame : int{
|
public enum mjtFrame : int{
|
||||||
mjFRAME_NONE = 0,
|
mjFRAME_NONE = 0,
|
||||||
|
|||||||
Reference in New Issue
Block a user