Update for new HRIStudio build

This commit is contained in:
2025-08-07 01:29:00 -04:00
parent 3acdccf9a7
commit 0e835f2ee3
29 changed files with 2978 additions and 362 deletions

340
docs/plugins.md Normal file
View File

@@ -0,0 +1,340 @@
# HRIStudio Robot Plugins
This document explains how robot plugins work in HRIStudio and provides guidance for plugin developers.
## Overview
HRIStudio uses a plugin-based architecture to support different robot platforms. Each plugin defines:
- Robot capabilities and specifications
- Available actions for experiment design
- ROS2 integration details
- Communication protocols
## Plugin Structure
### Core Components
1. **Robot Definition**: Basic information about the robot platform
2. **Action Library**: Operations that can be performed during experiments
3. **ROS2 Integration**: Message types, topics, and communication setup
4. **Assets**: Images, models, and visual resources
### Plugin Lifecycle
1. **Repository Registration**: Plugin repositories are added to HRIStudio
2. **Plugin Discovery**: Available plugins are fetched from repositories
3. **Study Installation**: Plugins are installed for specific studies
4. **Experiment Integration**: Actions become available in the experiment designer
5. **Trial Execution**: Actions are executed during live trials
## Action System
### Action Types
Actions are the building blocks of experiments. HRIStudio supports four main categories:
#### Movement Actions
- Robot locomotion and positioning
- Navigation and path planning
- Velocity control and stopping
#### Interaction Actions
- Speech synthesis and audio playback
- Gesture and animation control
- Display and lighting effects
#### Sensor Actions
- Data collection from sensors
- Environmental monitoring
- State queries and feedback
#### Logic Actions
- Conditional operations
- Loops and iteration
- Variable manipulation
### Parameter Schema
Each action defines parameters using JSON Schema format:
```json
{
"type": "object",
"properties": {
"speed": {
"type": "number",
"minimum": 0,
"maximum": 1.0,
"default": 0.5,
"description": "Movement speed as fraction of maximum"
}
},
"required": ["speed"]
}
```
### ROS2 Integration
Actions can integrate with ROS2 through:
- **Topics**: Publishing messages for robot control
- **Services**: Synchronous request/response operations
- **Actions**: Long-running operations with feedback
## Plugin Development
### Basic Plugin Structure
```json
{
"robotId": "my-robot",
"name": "My Robot",
"description": "Custom robot for research",
"platform": "ROS2",
"version": "1.0.0",
"pluginApiVersion": "1.0",
"hriStudioVersion": ">=0.1.0",
"trustLevel": "community",
"category": "mobile-robot",
"manufacturer": {
"name": "Research Lab",
"website": "https://example.com"
},
"assets": {
"thumbnailUrl": "assets/my-robot/thumb.png"
},
"actions": []
}
```
### Creating Actions
Each action needs:
1. **Unique ID**: Snake_case identifier
2. **Clear Name**: Human-readable title
3. **Category**: One of the four main types
4. **Parameters**: JSON Schema definition
5. **ROS2 Config**: Communication details
Example action:
```json
{
"id": "move_forward",
"name": "Move Forward",
"description": "Move the robot forward by a specified distance",
"category": "movement",
"icon": "arrow-up",
"timeout": 30000,
"retryable": true,
"parameterSchema": {
"type": "object",
"properties": {
"distance": {
"type": "number",
"minimum": 0.1,
"maximum": 5.0,
"default": 1.0,
"description": "Distance to move in meters"
}
},
"required": ["distance"]
},
"ros2": {
"messageType": "geometry_msgs/msg/Twist",
"topic": "/cmd_vel",
"payloadMapping": {
"type": "transform",
"transformFn": "transformToTwist"
}
}
}
```
### Asset Management
Plugins should include visual assets:
- **Thumbnail**: 200x150px preview image
- **Main Image**: High-resolution robot photo
- **Angle Views**: Front, side, top perspectives
- **Logo**: Manufacturer or robot series logo
Assets are served relative to the repository URL.
### Testing Plugins
Before publishing, test your plugin:
1. Validate JSON syntax and schema
2. Verify all asset URLs are accessible
3. Test ROS2 message formats
4. Check parameter validation
5. Ensure timeout values are reasonable
## Integration with HRIStudio
### Repository Management
Administrators can add plugin repositories in HRIStudio:
1. Navigate to Admin > Plugin Repositories
2. Add repository URL
3. Set trust level and enable sync
4. Plugins become available for installation
### Study-Level Installation
Researchers install plugins for specific studies:
1. Go to Study > Plugins
2. Browse available plugins
3. Install required plugins
4. Configure plugin settings
### Experiment Design
Installed plugin actions appear in the experiment designer:
1. Drag actions from the block library
2. Configure parameters in the properties panel
3. Connect actions to create experiment flow
4. Test and validate the experiment protocol
### Trial Execution
During trials, HRIStudio:
1. Establishes ROS2 connections
2. Validates action parameters
3. Sends commands to robots
4. Monitors execution status
5. Logs all events for analysis
## Best Practices
### Plugin Design
- Use clear, descriptive action names
- Provide comprehensive parameter validation
- Include helpful descriptions for all parameters
- Choose appropriate timeout values
- Make actions atomic and focused
### ROS2 Integration
- Follow ROS2 naming conventions
- Use appropriate QoS settings
- Handle connection failures gracefully
- Implement proper error reporting
- Document message format requirements
### Asset Management
- Use consistent image dimensions
- Optimize file sizes for web delivery
- Provide high-quality thumbnails
- Include multiple viewing angles
- Ensure assets load quickly
### Documentation
- Document all action behaviors
- Provide usage examples
- Explain parameter effects
- Include troubleshooting tips
- Maintain version compatibility notes
## Repository Hosting
### File Structure
```
repository/
├── repository.json # Repository metadata
├── index.html # Web interface
├── plugins/
│ ├── index.json # Plugin list
│ └── robot-name.json # Individual plugins
└── assets/
├── repository-icon.png
└── robot-name/
├── thumb.png
├── main.jpg
└── angles/
```
### Hosting Requirements
- HTTPS enabled
- CORS headers configured
- Static file serving
- Reliable uptime
- Fast response times
### Version Management
- Use semantic versioning
- Maintain backward compatibility
- Document breaking changes
- Provide migration guides
- Archive old versions
## Security Considerations
### Trust Levels
- **Official**: Signed and verified plugins
- **Verified**: Community plugins that passed review
- **Community**: User-contributed, use with caution
### Validation
- All plugins are validated against schema
- Parameters are sanitized before execution
- ROS2 messages are type-checked
- Network communications are monitored
### Permissions
- Plugins run with limited permissions
- Robot access is study-scoped
- Actions can be disabled by administrators
- Audit logs track all plugin activities
## Troubleshooting
### Common Issues
1. **Plugin Not Loading**: Check JSON syntax and schema compliance
2. **Assets Not Found**: Verify asset URLs and file paths
3. **ROS2 Connection Failed**: Check topic names and message types
4. **Action Timeout**: Increase timeout or check robot connectivity
5. **Parameter Validation**: Ensure all required parameters are provided
### Debug Tools
- Use browser developer tools for network issues
- Check HRIStudio logs for plugin errors
- Validate JSON files with online tools
- Test ROS2 connections independently
- Monitor robot topics and services
## Contributing
To contribute to the official plugin repository:
1. Fork the repository
2. Create a new plugin file
3. Add assets and documentation
4. Test thoroughly
5. Submit a pull request
For questions or support, contact the HRIStudio development team.

View File

@@ -1,227 +1,243 @@
# Plugin Schema Documentation
# HRIStudio Plugin Schema Documentation
This document describes the schema for HRIStudio robot plugins.
This document describes the schema for HRIStudio robot plugins, including both repository metadata and individual plugin definitions.
## Repository Metadata
## Repository Metadata (`repository.json`)
The repository itself is defined by a `repository.json` file with the following structure:
The repository metadata file defines the plugin repository and its capabilities:
```json
{
"id": string,
"name": string,
"description": string?,
"id": "string (required) - Unique repository identifier",
"name": "string (required) - Display name",
"description": "string (optional) - Repository description",
"apiVersion": "string (required) - Repository API version",
"pluginApiVersion": "string (required) - Plugin API version supported",
"urls": {
"repository": string (URL),
"git": string (URL)?
"repository": "string (URL, required) - Repository base URL",
"git": "string (URL, optional) - Git repository URL"
},
"official": boolean,
"official": "boolean (required) - Whether this is an official repository",
"trust": "string (enum: official|verified|community, required)",
"author": {
"name": string,
"email": string (email)?,
"url": string (URL)?,
"organization": string?
"name": "string (required)",
"email": "string (email, optional)",
"url": "string (URL, optional)",
"organization": "string (optional)"
},
"maintainers": [
{
"name": string,
"email": string (email)?,
"url": string (URL)?
"name": "string (required)",
"email": "string (email, optional)",
"url": "string (URL, optional)"
}
]?,
"homepage": string (URL)?,
"license": string,
"defaultBranch": string,
"lastUpdated": string (ISO date),
"trust": "official" | "verified" | "community",
"assets": {
"icon": string?,
"logo": string?,
"banner": string?
},
],
"homepage": "string (URL, optional)",
"license": "string (required) - License identifier",
"defaultBranch": "string (required) - Default Git branch",
"lastUpdated": "string (ISO date, required)",
"categories": [
{
"id": "string (required) - Category identifier",
"name": "string (required) - Display name",
"description": "string (required) - Category description"
}
],
"compatibility": {
"hristudio": {
"min": string,
"recommended": string?
"min": "string (semver, required) - Minimum HRIStudio version",
"recommended": "string (semver, optional) - Recommended version"
},
"ros2": {
"distributions": string[],
"recommended": string?
}?
"distributions": "string[] (optional) - Supported ROS2 distributions",
"recommended": "string (optional) - Recommended distribution"
}
},
"tags": string[],
"assets": {
"icon": "string (path, optional) - Repository icon",
"logo": "string (path, optional) - Repository logo",
"banner": "string (path, optional) - Repository banner"
},
"tags": "string[] (required) - Repository tags",
"stats": {
"plugins": number
}?
"plugins": "number (required) - Number of plugins"
}
}
```
## Plugin Schema
Each plugin is defined in a JSON file with the following top-level structure:
Each plugin is defined in a JSON file with HRIStudio-specific extensions:
### Core Properties
```json
{
"robotId": string,
"name": string,
"description": string?,
"platform": string,
"version": string,
"manufacturer": object,
"documentation": object,
"assets": object,
"specs": object,
"ros2Config": object,
"actions": array
"robotId": "string (required) - Unique robot identifier",
"name": "string (required) - Display name",
"description": "string (optional) - Robot description",
"platform": "string (required) - Robot platform (e.g., 'ROS2')",
"version": "string (required) - Plugin version (semver)",
"pluginApiVersion": "string (required) - Plugin API version",
"hriStudioVersion": "string (required) - Minimum HRIStudio version",
"trustLevel": "string (enum: official|verified|community, required)",
"category": "string (required) - Plugin category identifier"
}
```
## Core Properties
### Required Properties
- `robotId`: Unique identifier for the robot (e.g., "turtlebot3-burger")
- `name`: Display name of the robot
- `platform`: Robot platform/framework (e.g., "ROS2")
- `version`: Plugin version (semver format)
### Optional Properties
- `description`: Detailed description of the robot
## Manufacturer Information
### Manufacturer Information
```json
"manufacturer": {
"name": string,
"website": string (URL)?,
"support": string (URL)?
"name": "string (required)",
"website": "string (URL, optional)",
"support": "string (URL, optional)"
}
```
## Documentation Links
### Documentation Links
```json
"documentation": {
"mainUrl": string (URL),
"apiReference": string (URL)?,
"wikiUrl": string (URL)?,
"videoUrl": string (URL)?
"mainUrl": "string (URL, required)",
"apiReference": "string (URL, optional)",
"wikiUrl": "string (URL, optional)",
"videoUrl": "string (URL, optional)"
}
```
## Assets Configuration
### Assets Configuration
```json
"assets": {
"thumbnailUrl": string,
"logo": string?,
"thumbnailUrl": "string (path, required)",
"images": {
"main": string,
"main": "string (path, required)",
"angles": {
"front": string?,
"side": string?,
"top": string?
}
"front": "string (path, optional)",
"side": "string (path, optional)",
"top": "string (path, optional)"
},
"logo": "string (path, optional)"
},
"model": {
"format": "URDF" | "glTF" | "other",
"url": string (URL)
}?
"format": "string (enum: URDF|glTF|STL, optional)",
"url": "string (URL, optional)"
}
}
```
## Robot Specifications
### Robot Specifications
```json
"specs": {
"dimensions": {
"length": number,
"width": number,
"height": number,
"weight": number
"length": "number (meters, required)",
"width": "number (meters, required)",
"height": "number (meters, required)",
"weight": "number (kg, required)"
},
"capabilities": string[],
"maxSpeed": number,
"batteryLife": number
"capabilities": "string[] (required) - List of robot capabilities",
"maxSpeed": "number (m/s, optional)",
"batteryLife": "number (hours, optional)"
}
```
## ROS2 Configuration
### ROS2 Configuration
```json
"ros2Config": {
"namespace": string,
"nodePrefix": string,
"namespace": "string (required) - Default ROS2 namespace",
"nodePrefix": "string (required) - Node name prefix",
"defaultTopics": {
[key: string]: string
"[topicName]": "string (topic path) - Default topic mappings"
}
}
```
## Actions
## Action Definitions
Each action in the `actions` array follows this structure:
Actions define the operations that can be performed with the robot. Each action follows this HRIStudio-specific schema:
```json
{
"actionId": string,
"type": "move" | "speak" | "wait" | "input" | "gesture" | "record" | "condition" | "loop",
"title": string,
"description": string,
"icon": string?,
"parameters": {
"type": "object",
"id": "string (required) - Unique action identifier (snake_case)",
"name": "string (required) - Display name for UI",
"description": "string (optional) - Action description",
"category": "string (enum: movement|interaction|sensors|logic, required)",
"icon": "string (optional) - Lucide icon name",
"timeout": "number (milliseconds, optional) - Default timeout",
"retryable": "boolean (optional) - Whether action can be retried on failure",
"parameterSchema": {
"type": "object (required)",
"properties": {
[key: string]: {
"type": string,
"title": string,
"description": string?,
"default": any?,
"minimum": number?,
"maximum": number?,
"enum": string[]?,
"unit": string?
"[paramName]": {
"type": "string (JSON Schema type, required)",
"minimum": "number (optional) - For numeric types",
"maximum": "number (optional) - For numeric types",
"default": "any (optional) - Default value",
"description": "string (required) - Parameter description",
"enum": "string[] (optional) - For enum types"
}
},
"required": string[]
"required": "string[] (required) - List of required parameters"
},
"ros2": {
"messageType": string,
"topic": string?,
"service": string?,
"action": string?,
"messageType": "string (required) - ROS2 message type",
"topic": "string (optional) - Topic name for publishers",
"service": "string (optional) - Service name for service calls",
"action": "string (optional) - Action name for action calls",
"payloadMapping": {
"type": "direct" | "transform",
"map": object?,
"transformFn": string?
"type": "string (enum: transform|static, required)",
"transformFn": "string (optional) - Transform function name",
"payload": "object (optional) - Static payload for static type"
},
"qos": {
"reliability": "reliable" | "best_effort",
"durability": "volatile" | "transient_local",
"history": "keep_last" | "keep_all",
"depth": number?
}?
"reliability": "string (enum: reliable|best_effort, optional)",
"durability": "string (enum: volatile|transient_local, optional)",
"history": "string (enum: keep_last|keep_all, optional)",
"depth": "number (optional) - Queue depth for keep_last"
}
}
}
```
## QoS Settings
## Action Categories
When specifying ROS2 QoS settings:
HRIStudio organizes actions into these standard categories:
- `reliability`: Message delivery guarantee
- `reliable`: Guaranteed delivery
- `best_effort`: Fast but may drop messages
- **movement**: Robot locomotion and positioning
- **interaction**: Communication and social behaviors
- **sensors**: Data collection and environmental sensing
- **logic**: Control flow and decision making
- `durability`: Message persistence
- `volatile`: Only delivered to active subscribers
- `transient_local`: Stored for late-joining subscribers
## Trust Levels
- `history`: Message queue behavior
- `keep_last`: Store up to N messages (specify with depth)
- `keep_all`: Store all messages
Plugins are classified by trust level:
## Example
- **official**: Maintained by HRIStudio team or robot manufacturer
- **verified**: Third-party plugins that have been reviewed and tested
- **community**: User-contributed plugins without formal verification
See the TurtleBot3 Burger plugin for a complete example implementation.
## Validation Requirements
### Required Fields
All plugins must include:
- Core properties (robotId, name, platform, version)
- HRIStudio metadata (pluginApiVersion, hriStudioVersion, trustLevel, category)
- At least one action definition
- Valid manufacturer information
- Asset thumbnailUrl
### Naming Conventions
- `robotId`: lowercase with hyphens (e.g., "turtlebot3-burger")
- `action.id`: snake_case (e.g., "move_velocity")
- `category`: predefined enum values only
### Version Requirements
- Plugin version must follow semantic versioning (semver)
- HRIStudio version must use semver range syntax (e.g., ">=0.1.0")
## Example Implementation
See `plugins/turtlebot3-burger.json` for a complete reference implementation demonstrating all schema features and best practices.