Skip to content

Commit d046f47

Browse files
authored
[add] add sensors (#691)
1 parent 9bbd9c4 commit d046f47

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

robosuite/robots/robot.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,10 +356,14 @@ def joint_pos_sin(obs_cache):
356356
def joint_vel(obs_cache):
357357
return np.array([self.sim.data.qvel[x] for x in self._ref_joint_vel_indexes])
358358

359-
sensors = [joint_pos, joint_pos_cos, joint_pos_sin, joint_vel]
360-
names = ["joint_pos", "joint_pos_cos", "joint_pos_sin", "joint_vel"]
359+
@sensor(modality=modality)
360+
def joint_acc(obs_cache):
361+
return np.array([self.sim.data.qacc[x] for x in self._ref_joint_vel_indexes])
362+
363+
sensors = [joint_pos, joint_pos_cos, joint_pos_sin, joint_vel, joint_acc]
364+
names = ["joint_pos", "joint_pos_cos", "joint_pos_sin", "joint_vel", "joint_acc"]
361365
# We don't want to include the direct joint pos sensor outputs
362-
actives = [True, True, True, True]
366+
actives = [True, True, True, True, True]
363367

364368
for arm in self.arms:
365369
arm_sensors, arm_sensor_names = self._create_arm_sensors(arm, modality=modality)

0 commit comments

Comments
 (0)