'Return the unfiltered & noiseless observation. By default, it computes
based on the declarations in the xml file.'

def get_raw_obs(self):

    if (self._cached_obs is not None):
        return self._cached_obs
    obs = []
    for state in self.extra_data.states:
        new_obs = None
        if state.body:
            body = find_body(self.world, state.body)
            if (state.local is not None):
                l = state.local
                position = body.GetWorldPoint(l)
                linearVel = body.GetLinearVelocityFromLocalPoint(l)
            else:
                position = body.position
                linearVel = body.linearVelocity
            if (state.to is not None):
                to = find_body(self.world, state.to)
            if (state.typ == 'xpos'):
                new_obs = position[0]
            elif (state.typ == 'ypos'):
                new_obs = position[1]
            elif (state.typ == 'xvel'):
                new_obs = linearVel[0]
            elif (state.typ == 'yvel'):
                new_obs = linearVel[1]
            elif (state.typ == 'apos'):
                new_obs = body.angle
            elif (state.typ == 'avel'):
                new_obs = body.angularVelocity
            elif (state.typ == 'dist'):
                new_obs = np.linalg.norm((position - to.position))
            elif (state.typ == 'angle'):
                diff = (to.position - position)
                abs_angle = np.arccos((diff.dot((0, 1)) / np.linalg.norm(diff)))
                new_obs = (body.angle + abs_angle)
            else:
                raise NotImplementedError
        elif state.joint:
            joint = find_joint(self.world, state.joint)
            if (state.typ == 'apos'):
                new_obs = joint.angle
            elif (state.typ == 'avel'):
                new_obs = joint.speed
            else:
                raise NotImplementedError
        elif state.com:
            com_quant = self._compute_com_pos_vel(*state.com)
            if (state.typ == 'xpos'):
                new_obs = com_quant[0]
            elif (state.typ == 'ypos'):
                new_obs = com_quant[1]
            elif (state.typ == 'xvel'):
                new_obs = com_quant[2]
            elif (state.typ == 'yvel'):
                new_obs = com_quant[3]
            else:
                print state.typ
                raise NotImplementedError
        else:
            raise NotImplementedError
        if (state.transform is not None):
            if (state.transform == 'id'):
                pass
            elif (state.transform == 'sin'):
                new_obs = np.sin(new_obs)
            elif (state.transform == 'cos'):
                new_obs = np.cos(new_obs)
            else:
                raise NotImplementedError
        obs.append(new_obs)
    self._cached_obs = np.array(obs)
    return self._cached_obs
