1#![forbid(unsafe_code)]
2#![doc = include_str!("../README.md")]
3
4pub use use_actuator as actuator;
7pub use use_end_effector as end_effector;
8pub use use_frame as frame;
9pub use use_joint as joint;
10pub use use_kinematics_label as kinematics_label;
11pub use use_pose as pose;
12pub use use_robot as robot;
13pub use use_robot_id as robot_id;
14pub use use_robot_sensor as robot_sensor;
15pub use use_robot_subsystem as robot_subsystem;
16
17pub mod prelude {
19 pub use crate::actuator::{ActuatorKind, ActuatorName, ActuatorRating, ActuatorState};
20 pub use crate::end_effector::{EndEffectorKind, EndEffectorName, GripState, ToolMount};
21 pub use crate::frame::{FrameKind, FrameName, FrameRef, FrameRelation};
22 pub use crate::joint::{JointAxis, JointIndex, JointKind, JointLimit, JointName};
23 pub use crate::kinematics_label::{
24 DegreeOfFreedom, KinematicChainName, KinematicsKind, LinkName,
25 };
26 pub use crate::pose::{OrientationKind, Pose2Label, Pose3Label, PoseKind, PoseName};
27 pub use crate::robot::{RobotKind, RobotManufacturer, RobotModel, RobotName};
28 pub use crate::robot_id::{RobotId, RobotInstanceId, RobotSerialNumber};
29 pub use crate::robot_sensor::{
30 RobotSensorKind, RobotSensorName, SensorMount, SensorReadingKind,
31 };
32 pub use crate::robot_subsystem::{RobotSubsystemKind, RobotSubsystemName, SubsystemState};
33}
34
35#[cfg(test)]
36mod tests {
37 use super::{
38 actuator, end_effector, frame, joint, kinematics_label, pose, robot, robot_id,
39 robot_sensor, robot_subsystem,
40 };
41
42 #[test]
43 fn facade_exposes_composable_robotics_primitives() -> Result<(), Box<dyn std::error::Error>> {
44 let robot_name = robot::RobotName::new("inspection-arm")?;
45 let serial = robot_id::RobotSerialNumber::new("SN-42A")?;
46 let joint_name = joint::JointName::new("shoulder-pan")?;
47 let limit = joint::JointLimit::new(Some(-1.57), Some(1.57))?;
48 let actuator_name = actuator::ActuatorName::new("shoulder-servo")?;
49 let sensor_name = robot_sensor::RobotSensorName::new("wrist-camera")?;
50 let frame_ref =
51 frame::FrameRef::new(frame::FrameName::new("tool0")?, frame::FrameKind::Tool);
52 let pose_label = pose::Pose3Label::new("pick-ready")?;
53 let end_effector = end_effector::EndEffectorKind::Gripper;
54 let dof = kinematics_label::DegreeOfFreedom::new(6)?;
55 let subsystem_state = robot_subsystem::SubsystemState::Ready;
56
57 assert_eq!(robot_name.as_str(), "inspection-arm");
58 assert_eq!(serial.as_str(), "SN-42A");
59 assert_eq!(joint_name.as_str(), "shoulder-pan");
60 assert_eq!(limit.minimum(), Some(-1.57));
61 assert_eq!(actuator_name.as_str(), "shoulder-servo");
62 assert_eq!(sensor_name.as_str(), "wrist-camera");
63 assert_eq!(frame_ref.kind(), &frame::FrameKind::Tool);
64 assert_eq!(pose_label.as_str(), "pick-ready");
65 assert_eq!(end_effector.to_string(), "gripper");
66 assert_eq!(dof.get(), 6);
67 assert_eq!(subsystem_state.to_string(), "ready");
68 Ok(())
69 }
70}