Physical Management Module API Specification
Core Classes
PhysicalObjectManager
- Purpose: Central manager for physical objects
- Methods:
create_object(object_id, name, object_type, x, y, z, **properties) -> PhysicalObject
get_object_status(object_id) -> Optional[ObjectStatus]
update_object_location(object_id, x, y, z) -> bool
get_nearby_objects(x, y, z, radius) -> List[PhysicalObject]
get_objects_by_type(object_type) -> List[PhysicalObject]
save_state(file_path) -> None
load_state(file_path) -> None
get_statistics() -> Dict[str, Any]
PhysicalObject
- Purpose: Represents a physical object
- Properties:
id: str - Unique identifier
name: str - Human-readable name
object_type: ObjectType - Type classification
location: Tuple[float, float, float] - 3D coordinates
properties: Dict[str, Any] - Custom properties
status: ObjectStatus - Current status
- Methods:
update_location(x, y, z) -> None
update_status(status) -> None
to_dict() -> Dict[str, Any]
ObjectRegistry
- Purpose: Registry for managing object collections
- Methods:
register_object(obj) -> None
unregister_object(object_id) -> Optional[PhysicalObject]
get_object(object_id) -> Optional[PhysicalObject]
get_objects_by_type(object_type) -> List[PhysicalObject]
get_objects_in_area(x, y, z, radius) -> List[PhysicalObject]
save_to_file(file_path) -> None
load_from_file(file_path) -> None
Physics Simulation
PhysicsSimulator
- Purpose: Physics simulation engine
- Methods:
add_force_field(force_field) -> None
add_constraint(constraint) -> None
register_object(object_id, mass, position, velocity) -> None
update_physics(delta_time) -> None
get_object_state(object_id) -> Optional[Dict[str, Any]]
set_object_position(object_id, position) -> bool
get_simulation_stats() -> Dict[str, Any]
Vector3D
- Purpose: 3D vector for physics calculations
- Methods:
magnitude() -> float
normalize() -> Vector3D
- Arithmetic operations:
+, -, *
ForceField
- Purpose: Force field affecting objects
- Methods:
calculate_force(object_position) -> Vector3D
Sensor Integration
SensorManager
- Purpose: Manages sensor data and device integration
- Methods:
register_device(device) -> None
unregister_device(device_id) -> Optional[DeviceInterface]
add_reading(reading) -> None
get_latest_reading(sensor_type) -> Optional[SensorReading]
get_readings_by_type(sensor_type, start_time, end_time) -> List[SensorReading]
subscribe_to_sensor(sensor_type, callback) -> None
unsubscribe_from_sensor(sensor_type, callback) -> None
export_readings(file_path, sensor_type) -> None
get_statistics() -> Dict[str, Any]
SensorReading
- Purpose: Represents a sensor reading
- Properties:
sensor_id: str
sensor_type: SensorType
value: float
unit: str
timestamp: float
metadata: Dict[str, Any]
Enums
ObjectType
- SENSOR, ACTUATOR, DEVICE, CONTAINER, VEHICLE, STRUCTURE
ObjectStatus
- ACTIVE, INACTIVE, MAINTENANCE, ERROR, OFFLINE
SensorType
- TEMPERATURE, HUMIDITY, PRESSURE, MOTION, LIGHT, PROXIMITY, GPS, ACCELEROMETER, GYROSCOPE, MAGNETOMETER
DeviceStatus
- CONNECTED, DISCONNECTED, ERROR, UNKNOWN
Utility Classes
PhysicalConstants
- Static constants for physics calculations
UnitConverter
- Static methods for unit conversions
CoordinateSystem
- Static methods for coordinate transformations
Navigation Links