Added visualization of site actuators.

PiperOrigin-RevId: 453609866
Change-Id: Icde220687f0c0e9e7fbbe0e3e56d995f823ffe07
This commit is contained in:
Alessio Quaglino
2022-06-07 23:58:31 -07:00
committed by Copybara-Service
parent 78c7e6e21f
commit 736e0b391b
2 changed files with 50 additions and 0 deletions
+25
View File
@@ -857,6 +857,31 @@ void mjv_addGeoms(const mjModel* m, mjData* d, const mjvOption* vopt,
FINISH
}
// site actuators
if (m->actuator_trntype[i]==mjTRN_SITE) {
// actuator size is site size scaled by 1.1
mju_scl3(sz, m->site_size+3*j, 1.1);
START
// make geom overlapping the actuated site
mjv_initGeom(thisgeom,
m->site_type[j], sz,
d->site_xpos + 3*j,
d->site_xmat + 9*j,
thisgeom->rgba);
// set interpolated color
f2f(thisgeom->rgba, rgba, 4);
// vopt->label
if (vopt->label==mjLABEL_ACTUATOR) {
makeLabel(m, mjOBJ_ACTUATOR, i, thisgeom->label);
}
FINISH
}
// spatial tendon actuators
else if (m->actuator_trntype[i]==mjTRN_TENDON && d->ten_wrapnum[j]) {
for (int k=d->ten_wrapadr[j]; k<d->ten_wrapadr[j]+d->ten_wrapnum[j]-1; k++) {
+25
View File
@@ -0,0 +1,25 @@
<mujoco>
<option density="1000">
<flag gravity="disable"/>
</option>
<worldbody>
<geom type="plane" size="10 10 .1" rgba="1 1 1 1"/>
<light pos="0 0 20"/>
<body name="body_stateless" pos="0 0 .5">
<freejoint/>
<geom type="box" size=".5 .5 .1" pos="0 0 .4"/>
<site name="capsule" pos=".5 .5 .5" rgba="0 0 1 1" size=".1 .1" type="capsule"/>
<site name="ellipsoid" pos=".5 -.5 .5" rgba="0 0 1 1" size=".1 .3 .1" type="ellipsoid" euler="0 0 -45"/>
<site name="cylinder" pos="0 0 .5" rgba="0 0 1 1" size=".2 .1" type="cylinder"/>
<site name="box" pos="-.5 -.5 .5" rgba="0 0 1 1" size=".1 .1 .2" type="box"/>
</body>
</worldbody>
<actuator>
<general name="ellipsoid" site="ellipsoid" gear="0 1 0 0 0 0" ctrllimited="true" ctrlrange="-100 100"/>
<general name="cylinder" site="cylinder" gear="0 0 0 0 0 1" ctrllimited="true" ctrlrange="-100 100"/>
<general name="box" site="box" dyntype="integrator" gear="0 0 1 0 0 0" ctrllimited="true" ctrlrange="-100 100"/>
<general name="capsule" site="capsule" dyntype="integrator" gear="0 0 1 0 0 0" ctrllimited="true" ctrlrange="-100 100"/>
</actuator>
</mujoco>