API Reference¶
Complete API documentation for pib3.
Module Overview¶
pib3
├── Core Functions
│ ├── generate_trajectory() # One-shot image to trajectory
│ ├── image_to_sketch() # Image to 2D strokes
│ └── sketch_to_trajectory() # 2D strokes to 3D trajectory
│
├── Core Types
│ ├── Joint # Enum for joint names (IDE autocomplete)
│ ├── AIModel # Enum for AI models (YOLOV8N, HAND, POSE, etc.)
│ ├── Stroke # Single continuous line
│ ├── Sketch # Collection of strokes
│ └── Trajectory # Robot joint positions
│
├── AI/Camera Types
│ ├── Detection # Object detection result
│ ├── HandLandmarks # Hand tracking with finger angles
│ ├── FingerAngles # Finger bend angles → servo values
│ ├── PoseKeypoints # Body pose estimation
│ └── CameraFrame # Single camera frame
│
├── Configuration
│ ├── TrajectoryConfig # Main configuration
│ ├── PaperConfig # Drawing surface settings
│ ├── IKConfig # IK solver settings
│ └── ImageConfig # Image processing settings
│
├── Backends
│ ├── Robot / RealRobotBackend # Real robot via rosbridge
│ │ ├── robot.ai # AI subsystem (simplified API)
│ │ └── robot.camera # Camera subsystem (simplified API)
│ └── Webots / WebotsBackend # Webots simulator
│
├── Kinematics
│ ├── PibLeft / PibRight # DH models for arm kinematics
│ └── camera_to_base() # Coordinate transformations
│
└── Hand Poses
├── HandPose # Preset hand poses (enum)
├── LEFT_HAND_JOINTS # Left hand joint list
└── RIGHT_HAND_JOINTS # Right hand joint list
Quick Reference¶
Main Functions¶
| Function | Description |
|---|---|
generate_trajectory() |
Convert image directly to trajectory |
image_to_sketch() |
Convert image to 2D strokes |
sketch_to_trajectory() |
Convert strokes to 3D trajectory |
play_audio() |
Play raw audio data |
play_file() |
Play audio from WAV file |
speak() |
Text-to-speech synthesis |
Core Types¶
| Type | Description |
|---|---|
Stroke |
Single continuous drawing line |
Sketch |
Collection of strokes |
Trajectory |
Robot joint positions over time |
Joint |
Enum for joint names with IDE autocomplete |
AIModel |
Enum for AI models with IDE autocomplete |
Backends¶
| Backend | Description |
|---|---|
RealRobotBackend |
Control real PIB robot |
WebotsBackend |
Webots simulator |
AI/Camera Subsystems¶
| Subsystem | Description |
|---|---|
robot.ai |
AI inference with auto-managed subscriptions |
robot.camera |
Camera streaming with auto-managed subscriptions |
Import Examples¶
import pib3
from pib3 import Robot, Joint, Trajectory
# Generate trajectory
trajectory = pib3.generate_trajectory("image.png")
# Control robot with IDE tab completion
with Robot(host="172.26.34.149") as robot:
robot.set_joint(Joint.ELBOW_LEFT, 50.0)
robot.run_trajectory(trajectory)
Documentation Sections¶
-
Stroke, Sketch - Data structures for 2D drawings
-
All configuration dataclasses and options
-
Image to sketch conversion functions
-
Trajectory class and IK functions
-
Robot and Webots backends
-
Calibration and utility tools
-
Hand position presets and functions
-
Audio playback, TTS, and recording
-
Simplified AI inference and camera APIs
-
DH models and coordinate transformations