MCPcopy Create free account
hub / github.com/google-deepmind/dm_control / ball_in_head_frame

Method ball_in_head_frame

dm_control/suite/dog.py:213–223  ·  view source on GitHub ↗

Returns the ball position and velocity in the frame of the head.

(self)

Source from the content-addressed store, hash-verified

211 return self.named.data.sensordata[['foot_L', 'foot_R', 'hand_L', 'hand_R']]
212
213 def ball_in_head_frame(self):
214 """Returns the ball position and velocity in the frame of the head."""
215 head_frame = self.named.data.site_xmat['head'].reshape(3, 3)
216 head_pos = self.named.data.site_xpos['head']
217 ball_pos = self.named.data.geom_xpos['ball']
218 head_to_ball = ball_pos - head_pos
219 head_vel, _ = self.data.object_velocity('head', 'site')
220 ball_vel, _ = self.data.object_velocity('ball', 'geom')
221 head_to_ball_vel = ball_vel - head_vel
222 return np.hstack((head_to_ball.dot(head_frame),
223 head_to_ball_vel.dot(head_frame)))
224
225 def target_in_head_frame(self):
226 """Returns the target position in the frame of the head."""

Callers 1

Calls 1

object_velocityMethod · 0.80

Tested by

no test coverage detected