(self)
return np.hstack((head_to_ball.dot(head_frame),
                      head_to_ball_vel.dot(head_frame)))
Returns the ball position and velocity in the frame of the head.
Returns the ball position and velocity in the frame of the head.
Returns the ball position and velocity in the frame of the head .
def ball_in_head_frame(self):
    """Returns the ball position and velocity in the frame of the head."""
    head_frame = self.named.data.site_xmat['head'].reshape(3, 3)
    head_pos = self.named.data.site_xpos['head']
    ball_pos = self.named.data.geom_xpos['ball']
    head_to_ball = ball_pos - head_pos
    head_vel, _ = self.data.object_velocity('head', 'site')
    ball_vel, _ = self.data.object_velocity('ball', 'geom')
    head_to_ball_vel = ball_vel - head_vel
    return np.hstack((head_to_ball.dot(head_frame),
                      head_to_ball_vel.dot(head_frame)))
def ball_in_head_frame ( self ) : head_frame = self . named . data . site_xmat [ 'head' ] . reshape ( 3 , 3 ) head_pos = self . named . data . site_xpos [ 'head' ] ball_pos = self . named . data . geom_xpos [ 'ball' ] head_to_ball = ball_pos - head_pos head_vel , _ = self . data . object_velocity ( 'head' , 'site' ) ball_vel , _ = self . data . object_velocity ( 'ball' , 'geom' ) head_to_ball_vel = ball_vel - head_vel return np . hstack ( ( head_to_ball . dot ( head_frame ) , head_to_ball_vel . dot ( head_frame ) ) )