diff --git a/dm_control/locomotion/walkers/assets/build_fruitfly/fruitfly.xml b/dm_control/locomotion/walkers/assets/build_fruitfly/fruitfly.xml
index a68e3e39..d23dd4e9 100644
--- a/dm_control/locomotion/walkers/assets/build_fruitfly/fruitfly.xml
+++ b/dm_control/locomotion/walkers/assets/build_fruitfly/fruitfly.xml
@@ -385,6 +385,7 @@
+
@@ -396,6 +397,7 @@
+
@@ -907,6 +909,8 @@
+
+
diff --git a/dm_control/locomotion/walkers/assets/build_fruitfly/make_fruitfly.py b/dm_control/locomotion/walkers/assets/build_fruitfly/make_fruitfly.py
index b31bcaf2..d7ab6f74 100644
--- a/dm_control/locomotion/walkers/assets/build_fruitfly/make_fruitfly.py
+++ b/dm_control/locomotion/walkers/assets/build_fruitfly/make_fruitfly.py
@@ -1020,6 +1020,7 @@ def main(argv: Sequence[str]):
model.sensor.add('velocimeter', name='velocimeter', site='thorax')
touch_sites = []
force_sites = []
+ # Sites for leg sensors.
for leg in legs:
for body in leg.find_all('body'):
if 'claw' in body.name:
@@ -1033,6 +1034,12 @@ def main(argv: Sequence[str]):
if 'tarsus_' in body.name:
site = body.insert('site', -1, name=body.name)
force_sites.append(site)
+ # Sites for wing sensors.
+ for body in thorax.find_all('body'):
+ if 'wing' in body.name:
+ site = body.insert('site', -1, name=body.name)
+ force_sites.append(site)
+ # Add force and touch sensors.
for site in force_sites:
model.sensor.add('force', name='force_' + site.name, site=site)
for site in touch_sites:
diff --git a/dm_control/locomotion/walkers/assets/fruitfly_v2/fruitfly.xml b/dm_control/locomotion/walkers/assets/fruitfly_v2/fruitfly.xml
index a68e3e39..d23dd4e9 100644
--- a/dm_control/locomotion/walkers/assets/fruitfly_v2/fruitfly.xml
+++ b/dm_control/locomotion/walkers/assets/fruitfly_v2/fruitfly.xml
@@ -385,6 +385,7 @@
+
@@ -396,6 +397,7 @@
+
@@ -907,6 +909,8 @@
+
+
diff --git a/dm_control/locomotion/walkers/fruitfly_v2.py b/dm_control/locomotion/walkers/fruitfly_v2.py
index e25bc57f..f06d7075 100644
--- a/dm_control/locomotion/walkers/fruitfly_v2.py
+++ b/dm_control/locomotion/walkers/fruitfly_v2.py
@@ -233,6 +233,10 @@ def _build(self,
if ('adhere' in actuator.name and
any_substr_in_str(name_substr['legs'], actuator.name)):
actuator.remove()
+ # Remove leg sensors.
+ for sensor in root.find_all('sensor'):
+ if any_substr_in_str(name_substr['legs'], sensor.name):
+ sensor.remove()
# Maybe retract and disable wings.
if not use_wings:
@@ -241,6 +245,10 @@ def _build(self,
for joint in wing_joints:
root.find('actuator', joint.name).remove()
self.observable_joints.remove(joint)
+ # Remove wing sensors.
+ for sensor in root.find_all('sensor'):
+ if any_substr_in_str(name_substr['wings'], sensor.name):
+ sensor.remove()
# Maybe disable mouth.
if not use_mouth: