pub mod cwru;
pub mod ims;
pub mod kuka_lwr;
pub mod femto_st;
pub mod panda_gaz;
pub mod dlr_justin;
pub mod ur10_kufieta;
pub mod cheetah3;
pub mod icub_pushrecovery;
pub mod droid;
pub mod openx;
pub mod anymal_parkour;
pub mod unitree_g1;
pub mod aloha_static;
pub mod icub3_sorrentino;
pub mod mobile_aloha;
pub mod so100;
pub mod aloha_static_tape;
pub mod aloha_static_screw_driver;
pub mod aloha_static_pingpong_test;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum DatasetId {
Cwru,
Ims,
KukaLwr,
FemtoSt,
PandaGaz,
DlrJustin,
Ur10Kufieta,
Cheetah3,
IcubPushRecovery,
Droid,
Openx,
AnymalParkour,
UnitreeG1,
AlohaStatic,
Icub3Sorrentino,
MobileAloha,
So100,
AlohaStaticTape,
AlohaStaticScrewDriver,
AlohaStaticPingpongTest,
}
impl DatasetId {
#[inline]
#[must_use]
pub const fn slug(self) -> &'static str {
match self {
Self::Cwru => "cwru",
Self::Ims => "ims",
Self::KukaLwr => "kuka_lwr",
Self::FemtoSt => "femto_st",
Self::PandaGaz => "panda_gaz",
Self::DlrJustin => "dlr_justin",
Self::Ur10Kufieta => "ur10_kufieta",
Self::Cheetah3 => "cheetah3",
Self::IcubPushRecovery => "icub_pushrecovery",
Self::Droid => "droid",
Self::Openx => "openx",
Self::AnymalParkour => "anymal_parkour",
Self::UnitreeG1 => "unitree_g1",
Self::AlohaStatic => "aloha_static",
Self::Icub3Sorrentino => "icub3_sorrentino",
Self::MobileAloha => "mobile_aloha",
Self::So100 => "so100",
Self::AlohaStaticTape => "aloha_static_tape",
Self::AlohaStaticScrewDriver => "aloha_static_screw_driver",
Self::AlohaStaticPingpongTest => "aloha_static_pingpong_test",
}
}
#[must_use]
pub fn from_slug(s: &str) -> Option<Self> {
debug_assert!(s.len() < 64, "slug unreasonably long");
match s {
"cwru" => Some(Self::Cwru),
"ims" => Some(Self::Ims),
"kuka_lwr" => Some(Self::KukaLwr),
"femto_st" => Some(Self::FemtoSt),
"panda_gaz" => Some(Self::PandaGaz),
"dlr_justin" => Some(Self::DlrJustin),
"ur10_kufieta" => Some(Self::Ur10Kufieta),
"cheetah3" => Some(Self::Cheetah3),
"icub_pushrecovery" => Some(Self::IcubPushRecovery),
"droid" => Some(Self::Droid),
"openx" => Some(Self::Openx),
"anymal_parkour" => Some(Self::AnymalParkour),
"unitree_g1" => Some(Self::UnitreeG1),
"aloha_static" => Some(Self::AlohaStatic),
"icub3_sorrentino" => Some(Self::Icub3Sorrentino),
"mobile_aloha" => Some(Self::MobileAloha),
"so100" => Some(Self::So100),
"aloha_static_tape" => Some(Self::AlohaStaticTape),
"aloha_static_screw_driver" => Some(Self::AlohaStaticScrewDriver),
"aloha_static_pingpong_test" => Some(Self::AlohaStaticPingpongTest),
unknown => {
debug_assert!(
unknown.len() < 64,
"slug input bound by callsite preconditions"
);
None
}
}
}
#[inline]
#[must_use]
pub const fn family(self) -> DatasetFamily {
match self {
Self::Cwru | Self::Ims | Self::FemtoSt => DatasetFamily::Phm,
Self::KukaLwr
| Self::PandaGaz
| Self::DlrJustin
| Self::Ur10Kufieta
| Self::Droid
| Self::Openx
| Self::AlohaStatic
| Self::MobileAloha
| Self::So100
| Self::AlohaStaticTape
| Self::AlohaStaticScrewDriver
| Self::AlohaStaticPingpongTest => DatasetFamily::Kinematics,
Self::Cheetah3
| Self::IcubPushRecovery
| Self::AnymalParkour
| Self::UnitreeG1
| Self::Icub3Sorrentino => DatasetFamily::Balancing,
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum DatasetFamily {
Phm,
Kinematics,
Balancing,
}
impl DatasetFamily {
#[inline]
#[must_use]
pub const fn label(self) -> &'static str {
match self {
Self::Phm => "PHM",
Self::Kinematics => "Kinematics",
Self::Balancing => "Balancing",
}
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn slug_roundtrips_for_every_dataset() {
for id in [
DatasetId::Cwru,
DatasetId::Ims,
DatasetId::KukaLwr,
DatasetId::FemtoSt,
DatasetId::PandaGaz,
DatasetId::DlrJustin,
DatasetId::Ur10Kufieta,
DatasetId::Cheetah3,
DatasetId::IcubPushRecovery,
DatasetId::Droid,
DatasetId::Openx,
DatasetId::AnymalParkour,
DatasetId::UnitreeG1,
DatasetId::AlohaStatic,
] {
let slug = id.slug();
assert_eq!(DatasetId::from_slug(slug), Some(id), "roundtrip failed for {slug}");
}
}
#[test]
fn unknown_slug_is_none() {
assert_eq!(DatasetId::from_slug("nope"), None);
assert_eq!(DatasetId::from_slug(""), None);
}
#[test]
fn kinematics_family_covers_four_arms() {
let arms = [DatasetId::KukaLwr, DatasetId::PandaGaz, DatasetId::DlrJustin, DatasetId::Ur10Kufieta];
for a in arms {
assert_eq!(a.family(), DatasetFamily::Kinematics);
}
}
#[test]
fn balancing_family_covers_two_platforms() {
assert_eq!(DatasetId::Cheetah3.family(), DatasetFamily::Balancing);
assert_eq!(DatasetId::IcubPushRecovery.family(), DatasetFamily::Balancing);
}
#[test]
fn phm_family_covers_three_bearing_datasets() {
assert_eq!(DatasetId::Cwru.family(), DatasetFamily::Phm);
assert_eq!(DatasetId::Ims.family(), DatasetFamily::Phm);
assert_eq!(DatasetId::FemtoSt.family(), DatasetFamily::Phm);
}
}