use rapier2d::dynamics::{ImpulseJointHandle, RigidBodyHandle};
use rlevo_core::base::State;
use super::observation::BipedalWalkerObservation;
#[derive(Debug, Clone)]
pub struct BipedalWalkerState {
pub hull_handle: RigidBodyHandle,
pub leg1_upper_handle: RigidBodyHandle,
pub leg1_lower_handle: RigidBodyHandle,
pub leg2_upper_handle: RigidBodyHandle,
pub leg2_lower_handle: RigidBodyHandle,
pub hip1_joint: ImpulseJointHandle,
pub knee1_joint: ImpulseJointHandle,
pub hip2_joint: ImpulseJointHandle,
pub knee2_joint: ImpulseJointHandle,
pub leg1_contact: bool,
pub leg2_contact: bool,
pub last_obs: BipedalWalkerObservation,
}
impl State<1> for BipedalWalkerState {
type Observation = BipedalWalkerObservation;
fn shape() -> [usize; 1] {
[24]
}
fn is_valid(&self) -> bool {
self.last_obs.is_finite()
}
fn numel(&self) -> usize {
24
}
fn observe(&self) -> BipedalWalkerObservation {
self.last_obs.clone()
}
}